]> granicus.if.org Git - shadow/commitdiff
Don't ask for a password if there are no group passwords. Just directly
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sat, 10 Nov 2007 18:54:40 +0000 (18:54 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sat, 10 Nov 2007 18:54:40 +0000 (18:54 +0000)
give up. This comes from the Fedora's patch shadow-4.0.13-newgrpPwd.patch,
and seems to be the only part with an effect.

ChangeLog
NEWS
src/newgrp.c

index 7e70f78da85fefff6a33407c55f02e9ae3c732a2..cdb99473364f9ce525a987262c577a1e317e9441 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-11-10  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * NEWS, src/newgrp.c: Don't ask for a password if there are no
+       group passwords. Just directly give up. This comes from the
+       Fedora's patch shadow-4.0.13-newgrpPwd.patch, and seems to be the
+       only part with an effect.
+
 2007-11-10  Nicolas François  <nicolas.francois@centraliens.net>
 
        * NEWS, src/chgpasswd.c, src/chpasswd.c: Fix chpasswd and
diff --git a/NEWS b/NEWS
index 3b2449c04ad558f471312118c3ca837e4357aeb7..681b4c98cd36ced2a3ca6f163c0373e9cb56260c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,8 @@ shadow-4.0.18.1 -> shadow-4.0.18.2                                      UNRELEASED
   Thanks also to Greg Schafer <gschafer@zip.com.au>.
 - chgpasswd, chpasswd: Fix chpasswd and chgpasswd stack overflow. Based on
   Fedora's shadow-4.0.18.1-overflow.patch.
+- newgrp: Don't ask for a password if there are no group passwords. Just
+  directly give up.
 
 shadow-4.0.18.1 -> shadow-4.0.18.2                                     28-10-2007
 
index 1f53744182d9ef5de3aa632d420a20d8524147a5..5632bd02ba04d17ec237461b09b4a6efd6df3df2 100644 (file)
@@ -377,6 +377,16 @@ int main (int argc, char **argv)
         * unless she is listed as a member.  -- JWP
         */
        if (getuid () != 0 && needspasswd) {
+               if (grp->gr_passwd[0] == '\0') {
+                       /*
+                        * there is no password, print out "No password."
+                        * and give up
+                        */
+                       sleep (1);
+                       fputs (_("No password.\n"), stderr);
+                       goto failure;
+               }
+
                /*
                 * get the password from her, and set the salt for
                 * the decryption from the group file.
@@ -392,15 +402,6 @@ int main (int argc, char **argv)
                cpasswd = pw_encrypt (cp, grp->gr_passwd);
                strzero (cp);
 
-               if (grp->gr_passwd[0] == '\0') {
-                       /*
-                        * there is no password, print out "Sorry" and give up
-                        */
-                       sleep (1);
-                       fputs (_("No password.\n"), stderr);
-                       goto failure;
-               }
-
                if (strcmp (cpasswd, grp->gr_passwd) != 0) {
                        SYSLOG ((LOG_INFO,
                                 "Invalid password for group `%s' from `%s'",