From: Neil Brown <neilb@suse.de>
To: "Steinar H. Gunderson" <sgunderson@bigfoot.com>
Cc: nfs@lists.sourceforge.net
Subject: Re: Multiple ranges in squash_uids
Date: Mon, 24 Sep 2007 17:21:43 +1000 [thread overview]
Message-ID: <18167.25991.404551.826517@notabene.brown> (raw)
In-Reply-To: message from Steinar H. Gunderson on Saturday September 22
On Saturday September 22, sgunderson@bigfoot.com wrote:
> Hi,
>
> A user recently complained that you cannot use options like
> "squash_uids=1000-1005,2000-3000", even though the manual page says it's
> supported. The issue is that the option tokenizer thinks "2000-3000" is a
> separate option, so although the uid range parser does handle multiple ranges
> correctly, it doesn't work right.
>
> The user also supplied a patch (see
> http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=nfs-utils_parse_squashids_fix.diff;att=1;bug=442370),
> but I'm not sure if it's the best way to do it. Any suggestions?
Yes.... the suggested patch treats a comma followed by a digit
differently from a comma followed by a non-digit. I agree that is
ugly, though the code in parsesquash does exactly the same thing.
I would rather change the separator character to e.g. ':', like:
diff --git a/support/nfs/exports.c b/support/nfs/exports.c
index c82bb0e..029a4d4 100644
--- a/support/nfs/exports.c
+++ b/support/nfs/exports.c
@@ -678,9 +678,6 @@ parsesquash(char *list, int **idp, int *lenp, char **ep)
int len = *lenp;
int *id = *idp;
- if (**ep)
- *--(*ep) = ',';
-
do {
id0 = parsenum(&cp);
if (*cp == '-') {
@@ -697,17 +694,15 @@ parsesquash(char *list, int **idp, int *lenp, char **ep)
id = (int *) xrealloc(id, (len + 8) * sizeof(*id));
id[len++] = id0;
id[len++] = id1;
- if (!*cp || *cp == ')' || (*cp == ',' && !isdigit(cp[1])))
+ if (cp >= *ep)
break;
- if (*cp != ',') {
+ if (*cp != ':') {
syntaxerr("bad uid/gid list");
return -1;
}
cp++;
} while(1);
- if (**ep == ',') (*ep)++;
-
*lenp = len;
*idp = id;
return 1;
(plus a patch to fix the manpage)..
except that this is all completely irrelevant to nfs-utils as we don't
support squash_uids or squash_gids, and never have done.
I wonder what manpage the customer was reading when they saw that:
The manpage shows "squash_uids=0-15,20,25-50" as a valid entry for the
/etc/exports file.
It appears in exports.man, but is commented out.
NeilBrownm
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
prev parent reply other threads:[~2007-09-24 7:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-22 10:11 Multiple ranges in squash_uids Steinar H. Gunderson
2007-09-24 7:21 ` Neil Brown [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=18167.25991.404551.826517@notabene.brown \
--to=neilb@suse.de \
--cc=nfs@lists.sourceforge.net \
--cc=sgunderson@bigfoot.com \
/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