From: Frank Sorenson <sorenson@redhat.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH 2/5] sunrpc: add generic_auth hash_cred() function
Date: Thu, 29 Sep 2016 10:44:38 -0500 [thread overview]
Message-ID: <1475163881-12438-3-git-send-email-sorenson@redhat.com> (raw)
In-Reply-To: <1475163881-12438-1-git-send-email-sorenson@redhat.com>
Add a hash_cred() function for generic_auth, using both the
uid and gid from the auth_cred.
Signed-off-by: Frank Sorenson <sorenson@redhat.com>
---
net/sunrpc/auth_generic.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/net/sunrpc/auth_generic.c b/net/sunrpc/auth_generic.c
index 1682195..0494513 100644
--- a/net/sunrpc/auth_generic.c
+++ b/net/sunrpc/auth_generic.c
@@ -78,6 +78,14 @@ static struct rpc_cred *generic_bind_cred(struct rpc_task *task,
return auth->au_ops->lookup_cred(auth, acred, lookupflags);
}
+static int
+generic_hash_cred(struct auth_cred *acred, unsigned int hashbits)
+{
+ return hash_64(from_kgid(&init_user_ns, acred->gid) |
+ ((u64)from_kuid(&init_user_ns, acred->uid) <<
+ (sizeof(gid_t) * 8)), hashbits);
+}
+
/*
* Lookup generic creds for current process
*/
@@ -258,6 +266,7 @@ generic_key_timeout(struct rpc_auth *auth, struct rpc_cred *cred)
static const struct rpc_authops generic_auth_ops = {
.owner = THIS_MODULE,
.au_name = "Generic",
+ .hash_cred = generic_hash_cred,
.lookup_cred = generic_lookup_cred,
.crcreate = generic_create_cred,
.key_timeout = generic_key_timeout,
--
2.5.5
next prev parent reply other threads:[~2016-09-29 15:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-29 15:44 [PATCH 0/5] Add auth-specific auth_cred hash functions Frank Sorenson
2016-09-29 15:44 ` [PATCH 1/5] sunrpc: add hash_cred() function to rpc_authops struct Frank Sorenson
2016-09-29 15:44 ` Frank Sorenson [this message]
2016-09-29 15:44 ` [PATCH 3/5] sunrpc: add auth_unix hash_cred() function Frank Sorenson
2016-09-29 15:44 ` [PATCH 4/5] sunrpc: add RPCSEC_GSS " Frank Sorenson
2016-09-29 15:44 ` [PATCH 5/5] sunrpc: replace generic auth_cred hash with auth-specific function Frank Sorenson
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=1475163881-12438-3-git-send-email-sorenson@redhat.com \
--to=sorenson@redhat.com \
--cc=linux-nfs@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 NNTP newsgroup(s).