X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fuserspec.c;h=388f72332a1c4cef4a474431dd9e2187ec15c695;hb=969fe755730d23ba7ff21ae7511f66067d0a94d8;hp=fa2f26fa097286d941ec11d66c9fda72309abebd;hpb=42956c5d101d677aa660e1cdd5df3d8ab1a1d348;p=gnulib.git diff --git a/lib/userspec.c b/lib/userspec.c index fa2f26fa0..388f72332 100644 --- a/lib/userspec.c +++ b/lib/userspec.c @@ -1,5 +1,5 @@ /* userspec.c -- Parse a user and group string. - Copyright (C) 1989-1992, 1997-1998, 2000, 2002-2009 Free Software + Copyright (C) 1989-1992, 1997-1998, 2000, 2002-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify @@ -169,7 +169,7 @@ parse_with_separator (char const *spec, char const *separator, { unsigned long int tmp; if (xstrtoul (u, NULL, 10, &tmp, "") == LONGINT_OK - && tmp <= MAXUID) + && tmp <= MAXUID && (uid_t) tmp != (uid_t) -1) unum = tmp; else error_msg = E_invalid_user; @@ -200,7 +200,8 @@ parse_with_separator (char const *spec, char const *separator, if (grp == NULL) { unsigned long int tmp; - if (xstrtoul (g, NULL, 10, &tmp, "") == LONGINT_OK && tmp <= MAXGID) + if (xstrtoul (g, NULL, 10, &tmp, "") == LONGINT_OK + && tmp <= MAXGID && (gid_t) tmp != (gid_t) -1) gnum = tmp; else error_msg = E_invalid_group;