]> granicus.if.org Git - shadow/commitdiff
Do not request a password when a user uses newgrp to switch to her primary
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sat, 17 Nov 2007 16:19:00 +0000 (16:19 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sat, 17 Nov 2007 16:19:00 +0000 (16:19 +0000)
group.  Debian patch 497_newgrp_primary_group.

ChangeLog
src/newgrp.c

index c38fd6da7049b6b497d6eddea9997c06a198411a..026394de22e00f3149480eecd2b8b43b01df6f2c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-11-17  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * src/newgrp.c: Do not request a password when a user uses newgrp
+       to switch to her primary group.
+       Debian patch 497_newgrp_primary_group.
+
 2007-11-17  Nicolas François  <nicolas.francois@centraliens.net>
 
        * src/login.c: Log an error if the password entry could not be
index ae2b8d7e8fc38c2e8894460aefc785bbaab1621b..38947bdf6545ceec745ae43fa7affec15b24f5ef 100644 (file)
@@ -348,12 +348,15 @@ int main (int argc, char **argv)
 #endif
 
        /*
-        * see if she is a member of this group. If she isn't a member, she
-        * needs to provide the group password. If there is no group
-        * password, she will be denied access anyway.
+        * see if she is a member of this group (i.e. in the list of
+        * members of the group, or if the group is her primary group).
+        *
+        * If she isn't a member, she needs to provide the group password.
+        * If there is no group password, she will be denied access
+        * anyway.
         *
         */
-       if (!is_on_list (grp->gr_mem, name))
+       if (grp->gr_gid != pwd->pw_gid && !is_on_list (grp->gr_mem, name))
                needspasswd = 1;
 
        /*