1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
Patch from Martin Schwenke <martin@meltin.net>
Index: pam.deb/modules/pam_unix/passverify.c
===================================================================
--- pam.deb.orig/modules/pam_unix/passverify.c
+++ pam.deb/modules/pam_unix/passverify.c
@@ -715,7 +715,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;
@@ -786,6 +786,7 @@
tmpent->pw_passwd = assigned_passwd.charp;
err = 0;
+ found = 1;
}
if (putpwent(tmpent, pwfile)) {
D(("error writing entry to password file: %m"));
@@ -827,7 +828,7 @@
return PAM_SUCCESS;
} else {
unlink(PW_TMPFILE);
- return PAM_AUTHTOK_ERR;
+ return found ? PAM_AUTHTOK_ERR : PAM_USER_UNKNOWN;
}
}
@@ -842,7 +843,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;
@@ -913,6 +914,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));
}
@@ -959,7 +961,7 @@
return PAM_SUCCESS;
} else {
unlink(SH_TMPFILE);
- return PAM_AUTHTOK_ERR;
+ return found ? PAM_AUTHTOK_ERR : PAM_USER_UNKNOWN;
}
}
|