1 diff -r -u cyrus-sasl-2.1.26-orig/pwcheck/pwcheck_getpwnam.c cyrus-sasl-2.1.26/pwcheck/pwcheck_getpwnam.c
2 --- cyrus-sasl-2.1.26-orig/pwcheck/pwcheck_getpwnam.c 2012-01-28 00:31:36.000000000 +0100
3 +++ cyrus-sasl-2.1.26/pwcheck/pwcheck_getpwnam.c 2014-07-16 13:14:09.989720984 +0200
4 @@ -32,6 +32,7 @@
5 char *password;
6 {
7 char* r;
8 + char* crpt_passwd;
9 struct passwd *pwd;
10
11 pwd = getpwnam(userid);
12 @@ -41,7 +42,7 @@
13 else if (pwd->pw_passwd[0] == '*') {
14 r = "Account disabled";
15 }
16 - else if (strcmp(pwd->pw_passwd, crypt(password, pwd->pw_passwd)) != 0) {
17 + else if (!(crpt_passwd = crypt(password, pwd->pw_passwd)) || strcmp(pwd->pw_passwd, (const char *)crpt_passwd) != 0) {
18 r = "Incorrect password";
19 }
20 else {
21 diff -r -u cyrus-sasl-2.1.26-orig/pwcheck/pwcheck_getspnam.c cyrus-sasl-2.1.26/pwcheck/pwcheck_getspnam.c
22 --- cyrus-sasl-2.1.26-orig/pwcheck/pwcheck_getspnam.c 2012-01-28 00:31:36.000000000 +0100
23 +++ cyrus-sasl-2.1.26/pwcheck/pwcheck_getspnam.c 2014-07-16 13:22:36.257720924 +0200
24 @@ -32,13 +32,14 @@
25 char *password;
26 {
27 struct spwd *pwd;
28 + char *crpt_passwd;
29
30 pwd = getspnam(userid);
31 if (!pwd) {
32 return "Userid not found";
33 }
34
35 - if (strcmp(pwd->sp_pwdp, crypt(password, pwd->sp_pwdp)) != 0) {
36 + if (!(crpt_passwd = crypt(password, pwd->sp_pwdp)) || strcmp(pwd->sp_pwdp, (const char *)crpt_passwd) != 0) {
37 return "Incorrect password";
38 }
39 else {
40 diff -r -u cyrus-sasl-2.1.26-orig/saslauthd/auth_getpwent.c cyrus-sasl-2.1.26/saslauthd/auth_getpwent.c
41 --- cyrus-sasl-2.1.26-orig/saslauthd/auth_getpwent.c 2012-10-12 16:05:48.000000000 +0200
42 +++ cyrus-sasl-2.1.26/saslauthd/auth_getpwent.c 2014-07-16 13:16:29.569720968 +0200
43 @@ -77,6 +77,7 @@
44 {
45 /* VARIABLES */
46 struct passwd *pw; /* pointer to passwd file entry */
47 + char *crpt_passwd; /* encrypted password */
48 int errnum;
49 /* END VARIABLES */
50
51 @@ -105,7 +106,7 @@
52 }
53 }
54
55 - if (strcmp(pw->pw_passwd, (const char *)crypt(password, pw->pw_passwd))) {
56 + if (!(crpt_passwd = crypt(password, pw->pw_passwd)) || strcmp(pw->pw_passwd, (const char *)crpt_passwd)) {
57 if (flags & VERBOSE) {
58 syslog(LOG_DEBUG, "DEBUG: auth_getpwent: %s: invalid password", login);
59 }
60 diff -r -u cyrus-sasl-2.1.26-orig/saslauthd/auth_shadow.c cyrus-sasl-2.1.26/saslauthd/auth_shadow.c
61 --- cyrus-sasl-2.1.26-orig/saslauthd/auth_shadow.c 2012-10-12 16:05:48.000000000 +0200
62 +++ cyrus-sasl-2.1.26/saslauthd/auth_shadow.c 2014-07-16 13:18:20.208720954 +0200
63 @@ -210,8 +210,7 @@
64 RETURN("NO Insufficient permission to access NIS authentication database (saslauthd)");
65 }
66
67 - cpw = strdup((const char *)crypt(password, sp->sp_pwdp));
68 - if (strcmp(sp->sp_pwdp, cpw)) {
69 + if (!(cpw = crypt(password, sp->sp_pwdp)) || strcmp(sp->sp_pwdp, (const char *)cpw)) {
70 if (flags & VERBOSE) {
71 /*
72 * This _should_ reveal the SHADOW_PW_LOCKED prefix to an
73 @@ -221,10 +220,8 @@
74 syslog(LOG_DEBUG, "DEBUG: auth_shadow: pw mismatch: '%s' != '%s'",
75 sp->sp_pwdp, cpw);
76 }
77 - free(cpw);
78 RETURN("NO Incorrect password");
79 }
80 - free(cpw);
81
82 /*
83 * The following fields will be set to -1 if:
84 @@ -286,7 +283,7 @@
85 RETURN("NO Invalid username");
86 }
87
88 - if (strcmp(upw->upw_passwd, crypt(password, upw->upw_passwd)) != 0) {
89 + if (!(cpw = crypt(password, upw->upw_passwd)) || (strcmp(upw->upw_passwd, (const char *)cpw) != 0)) {
90 if (flags & VERBOSE) {
91 syslog(LOG_DEBUG, "auth_shadow: pw mismatch: %s != %s",
92 password, upw->upw_passwd);
|