]> granicus.if.org Git - sudo/commitdiff
Add support to user_in_group() for treating group names that begin with
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 29 Mar 2011 16:37:56 +0000 (12:37 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 29 Mar 2011 16:37:56 +0000 (12:37 -0400)
a '#' as gids.

--HG--
branch : 1.7

pwutil.c

index 8cb3998a72dcc2c4fadf23732412d6324bd4303b..548da4d2d85eaaf97f3cd860acc15442fcf1361e 100644 (file)
--- a/pwutil.c
+++ b/pwutil.c
@@ -677,7 +677,9 @@ user_in_group(pw, group)
 #ifdef HAVE_SETAUTHDB
     aix_setauthdb(pw->pw_name);
 #endif
-    grp = sudo_getgrnam(group);
+    /* A group name that begins with a '#' may be a gid. */
+    if ((grp = sudo_getgrnam(group)) == NULL && *group == '#')
+       grp = sudo_getgrgid(atoi(group + 1));
 #ifdef HAVE_SETAUTHDB
     aix_restoreauthdb();
 #endif