Same fixes as applied to usermod: refuse to unlock an account when it

would result in a passwordless account.
This commit is contained in:
nekral-guest
2007-11-17 22:05:31 +00:00
parent 85463e754d
commit 0743a7236d
3 changed files with 13 additions and 4 deletions

View 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);