Patch from Martin Schwenke Index: debian-pkg-pam/modules/pam_unix/passverify.c =================================================================== --- debian-pkg-pam.orig/modules/pam_unix/passverify.c 2009-04-17 12:46:54.000000000 -0700 +++ debian-pkg-pam/modules/pam_unix/passverify.c 2009-04-17 12:46:58.000000000 -0700 @@ -720,7 +720,7 @@ struct passwd *tmpent = NULL; struct stat st; FILE *pwfile, *opwfile; - int err = 1; + int err = 1, found = 0; int oldmask; #ifdef WITH_SELINUX security_context_t prev_context=NULL; @@ -791,6 +791,7 @@ tmpent->pw_passwd = assigned_passwd.charp; err = 0; + found = 1; } if (putpwent(tmpent, pwfile)) { D(("error writing entry to password file: %m")); @@ -832,7 +833,7 @@ return PAM_SUCCESS; } else { unlink(PW_TMPFILE); - return PAM_AUTHTOK_ERR; + return found ? PAM_AUTHTOK_ERR : PAM_USER_UNKNOWN; } } @@ -847,7 +848,7 @@ struct spwd *spwdent = NULL, *stmpent = NULL; struct stat st; FILE *pwfile, *opwfile; - int err = 1; + int err = 1, found = 0; int oldmask; #ifdef WITH_SELINUX security_context_t prev_context=NULL; @@ -918,6 +919,7 @@ stmpent->sp_pwdp = towhat; stmpent->sp_lstchg = time(NULL) / (60 * 60 * 24); err = 0; + found = 1; D(("Set password %s for %s", stmpent->sp_pwdp, forwho)); } @@ -964,7 +966,7 @@ return PAM_SUCCESS; } else { unlink(SH_TMPFILE); - return PAM_AUTHTOK_ERR; + return found ? PAM_AUTHTOK_ERR : PAM_USER_UNKNOWN; } }