[PATCH 3/3] mgmt.c: check that the socket is owned by the current user, not root
Ronnie Sahlberg <[email protected]> Tue, 7 Apr 2015 11:29:09 -0700
| Newsgroups | org.kernel.vger.stgt |
|---|---|
| Message-ID | <[email protected]> |
Change the ipc_perm() check from being a check that the socket user and group is set to root into instead check that the socket 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 <[email protected]> --- usr/mgmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/mgmt.c b/usr/mgmt.c index 364b3c8..ebe0fd6 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