]> granicus.if.org Git - shadow/commitdiff
Same fixes as applied to usermod: refuse to unlock an account when it
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sat, 17 Nov 2007 22:05:31 +0000 (22:05 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sat, 17 Nov 2007 22:05:31 +0000 (22:05 +0000)
would result in a passwordless account.

ChangeLog
NEWS
src/passwd.c

index 387aa271671f42625a2a90403232696de049bb38..17e66d70cbcc72e334caee618aafd3e120ea0aa6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@
        * NEWS, src/usermod.c: Refuse to unlock an account when it would
        result in a passwordless account.  Based on Openwall's patch
        shadow-4.0.4.1-owl-usermod-unlock.diff.
+       * NEWS, src/passwd.c: Likewise.
 
 2007-11-17  Nicolas François  <nicolas.francois@centraliens.net>
 
diff --git a/NEWS b/NEWS
index 91faa6fc0d6df8099fb34e8fcd5eedac8a96fb9b..f267accfaaca758b7d2ba3b93ca72180e8fb7f3f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -21,7 +21,7 @@ shadow-4.0.18.1 -> shadow-4.0.18.2                                    UNRELEASED
   (i.e. lookup in the local database for an user with an @). Thanks to
   Mike Frysinger for the patch.
 - Add support for uClibc with no l64a().
-- userdel/usermod: Fix infinite loop caused by erroneous group file
+- userdelusermod: Fix infinite loop caused by erroneous group file
   containing two entries with the same name. (The fix strategy differs
   from 
   (https://bugzilla.redhat.com/show_bug.cgi?id=240915)
@@ -41,7 +41,7 @@ shadow-4.0.18.1 -> shadow-4.0.18.2                                    UNRELEASED
   were always missing.
 - su: Avoid terminating the PAM library in the forked child. This is done
   later in the parent after closing the PAM session.
-- usermod: Refuse to unlock an account when it would result in a
+- passwd, usermod: Refuse to unlock an account when it would result in a
   passwordless account.
 
 *** documentation:
index dbe1a2db560a2c64ad9365ed5a6568a4f708cc10..30e3e9b4e591d0f13049fbf29317c3ba68441784 100644 (file)
@@ -438,8 +438,16 @@ static char *update_crypt_pw (char *cp)
        if (dflg)
                cp = "";        /* XXX warning: const */
 
-       if (uflg && *cp == '!')
-               cp++;
+       if (uflg && *cp == '!') {
+               if (cp[1] == '\0') {
+                       fprintf (stderr,
+                                _("%s: unlocking the user would result in a passwordless account.\n"
+                                  "You should set a password with usermod -p to unlock this user account.\n"),
+                                Prog);
+               } else {
+                       cp++;
+               }
+        }
 
        if (lflg && *cp != '!') {
                char *newpw = xmalloc (strlen (cp) + 2);