From: Steve Dickson <steved@redhat.com>
To: Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Subject: [PATCH 2/2] Add server support to use of numeric strings for uid and gids.
Date: Tue, 17 Aug 2010 15:38:45 -0400 [thread overview]
Message-ID: <1282073925-18707-3-git-send-email-steved@redhat.com> (raw)
In-Reply-To: <1282073925-18707-1-git-send-email-steved@redhat.com>
When a uid or gid does not map into the a domain and the
new 'NumericIDs' variable is enabled in idmapd.conf, the server
will send out numeric representations, strings without the
@domain part, of the given id.
Signed-off-by: Steve Dickson <steved@redhat.com>
---
utils/idmapd/idmapd.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c
index d6799c9..7f1291d 100644
--- a/utils/idmapd/idmapd.c
+++ b/utils/idmapd/idmapd.c
@@ -794,15 +794,22 @@ nfsopen(struct idmap_client *ic)
static void
idtonameres(struct idmap_msg *im)
{
- char domain[NFS4_MAX_DOMAIN_LEN];
+ char domain[NFS4_MAX_DOMAIN_LEN], *numids;
int ret = 0;
ret = nfs4_get_default_domain(NULL, domain, sizeof(domain));
+ numids = conf_get_str("Mapping", "NumericIDs");
+
switch (im->im_type) {
case IDMAP_TYPE_USER:
ret = nfs4_uid_to_name(im->im_id, domain, im->im_name,
sizeof(im->im_name));
if (ret) {
+ if (numids && strcasecmp(numids, "yes") == 0) {
+ sprintf(im->im_name, "%d", im->im_id);
+ ret=0;
+ break;
+ }
if (strlen(nobodyuser) < sizeof(im->im_name))
strcpy(im->im_name, nobodyuser);
else
@@ -813,6 +820,11 @@ idtonameres(struct idmap_msg *im)
ret = nfs4_gid_to_name(im->im_id, domain, im->im_name,
sizeof(im->im_name));
if (ret) {
+ if (numids && strcasecmp(numids, "yes") == 0) {
+ sprintf(im->im_name, "%d", im->im_id);
+ ret=0;
+ break;
+ }
if (strlen(nobodygroup) < sizeof(im->im_name))
strcpy(im->im_name, nobodygroup);
else
--
1.7.1
next prev parent reply other threads:[~2010-08-17 19:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-17 19:38 [PATCH 0/2] Support for Numeric Representations of UIDs and GIDs Steve Dickson
2010-08-17 19:38 ` [PATCH 1/2] Teach clients to map numeric strings into valid uids and gids Steve Dickson
2010-08-17 20:27 ` Trond Myklebust
2010-08-17 21:35 ` Steve Dickson
2010-08-17 21:47 ` Trond Myklebust
2010-08-17 22:07 ` Steve Dickson
2010-08-17 22:13 ` Trond Myklebust
2010-08-17 22:25 ` Steve Dickson
2010-08-17 19:38 ` Steve Dickson [this message]
2010-08-17 20:28 ` [PATCH 2/2] Add server support to use of numeric strings for uid " Trond Myklebust
2010-08-17 19:51 ` [PATCH 0/2] Support for Numeric Representations of UIDs and GIDs Tom Haynes
2010-08-17 20:04 ` Steve Dickson
[not found] ` <4C6AEB43.5080508-AfCzQyP5zfLQT0dZR+AlfA@public.gmane.org>
2010-08-17 20:30 ` Tom Haynes
2010-08-18 18:20 ` J. Bruce Fields
2010-08-18 19:09 ` Steve Dickson
2010-08-18 19:17 ` J. Bruce Fields
2010-08-18 19:23 ` Trond Myklebust
[not found] ` <1282159391.8540.90.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2010-08-18 19:33 ` Steve Dickson
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=1282073925-18707-3-git-send-email-steved@redhat.com \
--to=steved@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).