summaryrefslogtreecommitdiff
path: root/modules/pam_unix
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2023-09-11 14:00:42 -0600
committerSam Hartman <hartmans@debian.org>2024-04-08 16:35:07 -0600
commit7c3bf06ec9917c3814b3ee661e1454df83fa06ff (patch)
tree4ac053240eef4c1ef9cea6e8d8c5f60b6068221b /modules/pam_unix
parent63faf8353290a9fba42693e59172b26c85b304bb (diff)
distinguish between password manipulation failure and missing user.
Gbp-Pq: Name 026_pam_unix_passwd_unknown_user
Diffstat (limited to 'modules/pam_unix')
-rw-r--r--modules/pam_unix/passverify.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/pam_unix/passverify.c b/modules/pam_unix/passverify.c
index 81b10d88..7ff8bf07 100644
--- a/modules/pam_unix/passverify.c
+++ b/modules/pam_unix/passverify.c
@@ -804,7 +804,7 @@ PAMH_ARG_DECL(int unix_update_passwd,
struct passwd *tmpent = NULL;
struct stat st;
FILE *pwfile, *opwfile;
- int err = 1;
+ int err = 1, found = 0;
int oldmask;
#ifdef WITH_SELINUX
char *prev_context_raw = NULL;
@@ -875,6 +875,7 @@ PAMH_ARG_DECL(int unix_update_passwd,
tmpent->pw_passwd = assigned_passwd.charp;
err = 0;
+ found = 1;
}
if (putpwent(tmpent, pwfile)) {
D(("error writing entry to password file: %m"));
@@ -917,7 +918,7 @@ done:
return PAM_SUCCESS;
} else {
unlink(PW_TMPFILE);
- return PAM_AUTHTOK_ERR;
+ return found ? PAM_AUTHTOK_ERR : PAM_USER_UNKNOWN;
}
}