All of lore.kernel.org
 help / color / mirror / Atom feed
* Multiple ranges in squash_uids
@ 2007-09-22 10:11 Steinar H. Gunderson
  2007-09-24  7:21 ` Neil Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Steinar H. Gunderson @ 2007-09-22 10:11 UTC (permalink / raw)
  To: nfs

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?

/* Steinar */
-- 
Homepage: http://www.sesse.net/

-------------------------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Multiple ranges in squash_uids
  2007-09-22 10:11 Multiple ranges in squash_uids Steinar H. Gunderson
@ 2007-09-24  7:21 ` Neil Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Neil Brown @ 2007-09-24  7:21 UTC (permalink / raw)
  To: Steinar H. Gunderson; +Cc: nfs

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-09-24  7:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-22 10:11 Multiple ranges in squash_uids Steinar H. Gunderson
2007-09-24  7:21 ` Neil Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.