Skip to contentSkip to conversation

mcstrans: remove unused getpeercon_raw() call

PATCH Applied Yuli Khodorkovskiy 2 participants 3 messages Oct 24, 2018 – Oct 26, 2018 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mcstrans: remove unused getpeercon_raw() call

There is a call to getpeercon_raw() in mcstransd, but nothing is done with the context. The purpose of process_request() is to translate a context and we would like that to succeed even if, for some reason, getpeercon_raw() fails.

---
 mcstrans/src/mcstransd.c | 10 ----------
 1 file changed, 10 deletions(-)

v2:
- Remove comment about MLS clearance check in peercon

mcstrans/src/mcstransd.c +0 -10
index d7fc5dea..85899493 100644
@@ -142,17 +142,8 @@ process_request(int fd, uint32_t function, char *data1, char *UNUSED(data2))
 {
 	int32_t result;
 	char *out = NULL;
-	char *peercon = NULL;
 	int ret;
 
-	ret = getpeercon_raw(fd, &peercon);
-	if (ret < 0)
-		return ret;
-
-	/* TODO: Check if MLS clearance (in peercon) dominates the MLS label
-	 * (in the request input).
-	 */
-  
 	switch (function) {
 	case SETRANS_INIT:
 		result = 0;
@@ -184,7 +175,6 @@ process_request(int fd, uint32_t function, char *data1, char *UNUSED(data2))
 	}
 
 	free(out);
-	freecon(peercon);
 
 	return ret;
 }
Signature · 1 line
2.19.0
Acked-by on v2 1/1
#1 lore raw
Quoted 7 lines · Yuli Khodorkovskiy

There is a call to getpeercon_raw() in mcstransd, but nothing is done with the context. The purpose of process_request() is to translate a context and we would like that to succeed even if, for some reason, getpeercon_raw() fails.

Quoted 38 lines
---
  mcstrans/src/mcstransd.c | 10 ----------
  1 file changed, 10 deletions(-)

v2:
- Remove comment about MLS clearance check in peercon

mcstrans/src/mcstransd.c +0 -10
index d7fc5dea..85899493 100644
@@ -142,17 +142,8 @@ process_request(int fd, uint32_t function, char *data1, char *UNUSED(data2))
  {
  	int32_t result;
  	char *out = NULL;
-	char *peercon = NULL;
  	int ret;
 
-	ret = getpeercon_raw(fd, &peercon);
-	if (ret < 0)
-		return ret;
-
-	/* TODO: Check if MLS clearance (in peercon) dominates the MLS label
-	 * (in the request input).
-	 */
-
  	switch (function) {
  	case SETRANS_INIT:
  		result = 0;
@@ -184,7 +175,6 @@ process_request(int fd, uint32_t function, char *data1, char *UNUSED(data2))
  	}
 
  	free(out);
-	freecon(peercon);
 
  	return ret;
  }
#2 lore raw
In reply to Yuli Khodorkovskiy
Quoted 7 lines · Yuli Khodorkovskiy

There is a call to getpeercon_raw() in mcstransd, but nothing is done with the context. The purpose of process_request() is to translate a context and we would like that to succeed even if, for some reason, getpeercon_raw() fails.

Thanks, applied.

Quoted 38 lines
---
  mcstrans/src/mcstransd.c | 10 ----------
  1 file changed, 10 deletions(-)

v2:
- Remove comment about MLS clearance check in peercon

mcstrans/src/mcstransd.c +0 -10
index d7fc5dea..85899493 100644
@@ -142,17 +142,8 @@ process_request(int fd, uint32_t function, char *data1, char *UNUSED(data2))
  {
  	int32_t result;
  	char *out = NULL;
-	char *peercon = NULL;
  	int ret;
 
-	ret = getpeercon_raw(fd, &peercon);
-	if (ret < 0)
-		return ret;
-
-	/* TODO: Check if MLS clearance (in peercon) dominates the MLS label
-	 * (in the request input).
-	 */
-
  	switch (function) {
  	case SETRANS_INIT:
  		result = 0;
@@ -184,7 +175,6 @@ process_request(int fd, uint32_t function, char *data1, char *UNUSED(data2))
  	}
 
  	free(out);
-	freecon(peercon);
 
  	return ret;
  }