Multiple ranges in squash_uids
Subsystems (2)
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 */
Signature · 9 lines
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 - [email protected] https://lists.sourceforge.net/lists/listinfo/nfs
Quoted 11 lines · On Saturday September 22, [email protected] 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:
support/nfs/exports.c +2 -7
@@ -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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs