From: Ronnie Sahlberg <ronniesahlberg@gmail.com>
To: stgt@vger.kernel.org
Cc: fujita.tomonori@lab.ntt.co.jp,
Ronnie Sahlberg <ronniesahlberg@gmail.com>
Subject: [PATCH 3/3] mgmt.c: check that the socket is owned by the current user, not root
Date: Tue, 7 Apr 2015 11:29:09 -0700 [thread overview]
Message-ID: <1428431349-24087-4-git-send-email-ronniesahlberg@gmail.com> (raw)
In-Reply-To: <1428431349-24087-1-git-send-email-ronniesahlberg@gmail.com>
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 <ronniesahlberg@gmail.com>
---
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
prev parent reply other threads:[~2015-04-07 18:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-07 18:29 [PATCH 0/3] Allow running tgtd as a non-root user Ronnie Sahlberg
2015-04-07 18:29 ` [PATCH 1/3] tgtd.c: allow oom adjust failures for non-root users Ronnie Sahlberg
2015-04-07 18:29 ` [PATCH 2/3] mgmt: change ipc socket address and make it group writeable Ronnie Sahlberg
2015-04-07 18:29 ` Ronnie Sahlberg [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1428431349-24087-4-git-send-email-ronniesahlberg@gmail.com \
--to=ronniesahlberg@gmail.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=stgt@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).