[PATCH 3/3] mgmt.c: check that the connecting user is the same as the user tgtd runs as

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Change the ipc_perm() check from being a check that the connected user and group
is set to root into instead check that the user/group matches
the running tgtd process.
This is needed in order to run tgtd as a normal non-root user.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx>
---
 usr/mgmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr/mgmt.c b/usr/mgmt.c
index 3587f4b..c2bd176 100644
--- a/usr/mgmt.c
+++ b/usr/mgmt.c
@@ -569,7 +569,7 @@ static int ipc_perm(int fd)
 		return -1;
 	}
 
-	if (cred.uid || cred.gid)
+	if (cred.uid != getuid() || cred.gid != getgid())
 		return -EPERM;
 
 	return 0;
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux