|
|
794a5c |
diff -up cyrus-sasl-2.1.26/pwcheck/pwcheck_getpwnam.c.null-crypt cyrus-sasl-2.1.26/pwcheck/pwcheck_getpwnam.c
|
|
|
794a5c |
--- cyrus-sasl-2.1.26/pwcheck/pwcheck_getpwnam.c.null-crypt 2012-01-28 00:31:36.000000000 +0100
|
|
|
794a5c |
+++ cyrus-sasl-2.1.26/pwcheck/pwcheck_getpwnam.c 2012-12-20 17:00:14.614580310 +0100
|
|
|
794a5c |
@@ -31,7 +31,7 @@ char *pwcheck(userid, password)
|
|
|
794a5c |
char *userid;
|
|
|
794a5c |
char *password;
|
|
|
794a5c |
{
|
|
|
794a5c |
- char* r;
|
|
|
794a5c |
+ char* r, *cryptbuf;
|
|
|
794a5c |
struct passwd *pwd;
|
|
|
794a5c |
|
|
|
794a5c |
pwd = getpwnam(userid);
|
|
|
794a5c |
@@ -41,11 +41,13 @@ char *password;
|
|
|
794a5c |
else if (pwd->pw_passwd[0] == '*') {
|
|
|
794a5c |
r = "Account disabled";
|
|
|
794a5c |
}
|
|
|
794a5c |
- else if (strcmp(pwd->pw_passwd, crypt(password, pwd->pw_passwd)) != 0) {
|
|
|
794a5c |
- r = "Incorrect password";
|
|
|
794a5c |
- }
|
|
|
794a5c |
else {
|
|
|
794a5c |
- r = "OK";
|
|
|
794a5c |
+ cryptbuf = crypt(password, pwd->pw_passwd);
|
|
|
794a5c |
+ if((cryptbuf == NULL) || (strcmp(pwd->pw_passwd, cryptbuf) != 0)) {
|
|
|
794a5c |
+ r = "Incorrect password";
|
|
|
794a5c |
+ } else {
|
|
|
794a5c |
+ r = "OK";
|
|
|
794a5c |
+ }
|
|
|
794a5c |
}
|
|
|
794a5c |
|
|
|
794a5c |
endpwent();
|
|
|
794a5c |
diff -up cyrus-sasl-2.1.26/saslauthd/auth_getpwent.c.null-crypt cyrus-sasl-2.1.26/saslauthd/auth_getpwent.c
|
|
|
794a5c |
--- cyrus-sasl-2.1.26/saslauthd/auth_getpwent.c.null-crypt 2012-10-12 16:05:48.000000000 +0200
|
|
|
794a5c |
+++ cyrus-sasl-2.1.26/saslauthd/auth_getpwent.c 2012-12-20 17:03:17.940793653 +0100
|
|
|
794a5c |
@@ -78,6 +78,7 @@ auth_getpwent (
|
|
|
794a5c |
/* VARIABLES */
|
|
|
794a5c |
struct passwd *pw; /* pointer to passwd file entry */
|
|
|
794a5c |
int errnum;
|
|
|
794a5c |
+ char *cryptbuf;
|
|
|
794a5c |
/* END VARIABLES */
|
|
|
794a5c |
|
|
|
794a5c |
errno = 0;
|
|
|
794a5c |
@@ -105,7 +106,8 @@ auth_getpwent (
|
|
|
794a5c |
}
|
|
|
794a5c |
}
|
|
|
794a5c |
|
|
|
794a5c |
- if (strcmp(pw->pw_passwd, (const char *)crypt(password, pw->pw_passwd))) {
|
|
|
794a5c |
+ cryptbuf = crypt(password, pw->pw_passwd);
|
|
|
794a5c |
+ if ((cryptbuf == NULL) || strcmp(pw->pw_passwd, cryptbuf)) {
|
|
|
794a5c |
if (flags & VERBOSE) {
|
|
|
794a5c |
syslog(LOG_DEBUG, "DEBUG: auth_getpwent: %s: invalid password", login);
|
|
|
794a5c |
}
|
|
|
794a5c |
diff -up cyrus-sasl-2.1.26/saslauthd/auth_shadow.c.null-crypt cyrus-sasl-2.1.26/saslauthd/auth_shadow.c
|
|
|
794a5c |
--- cyrus-sasl-2.1.26/saslauthd/auth_shadow.c.null-crypt 2012-12-20 17:00:14.000000000 +0100
|
|
|
794a5c |
+++ cyrus-sasl-2.1.26/saslauthd/auth_shadow.c 2012-12-20 17:16:44.190360006 +0100
|
|
|
794a5c |
@@ -214,8 +214,8 @@ auth_shadow (
|
|
|
794a5c |
RETURN("NO Insufficient permission to access NIS authentication database (saslauthd)");
|
|
|
794a5c |
}
|
|
|
794a5c |
|
|
|
794a5c |
- cpw = strdup((const char *)crypt(password, sp->sp_pwdp));
|
|
|
794a5c |
- if (strcmp(sp->sp_pwdp, cpw)) {
|
|
|
794a5c |
+ cpw = crypt(password, sp->sp_pwdp);
|
|
|
794a5c |
+ if ((cpw == NULL) || strcmp(sp->sp_pwdp, cpw)) {
|
|
|
794a5c |
if (flags & VERBOSE) {
|
|
|
794a5c |
/*
|
|
|
794a5c |
* This _should_ reveal the SHADOW_PW_LOCKED prefix to an
|
|
|
794a5c |
@@ -225,10 +225,8 @@ auth_shadow (
|
|
|
794a5c |
syslog(LOG_DEBUG, "DEBUG: auth_shadow: pw mismatch: '%s' != '%s'",
|
|
|
794a5c |
sp->sp_pwdp, cpw);
|
|
|
794a5c |
}
|
|
|
794a5c |
- free(cpw);
|
|
|
794a5c |
RETURN("NO Incorrect password");
|
|
|
794a5c |
}
|
|
|
794a5c |
- free(cpw);
|
|
|
794a5c |
|
|
|
794a5c |
/*
|
|
|
794a5c |
* The following fields will be set to -1 if:
|
|
|
794a5c |
@@ -290,7 +288,8 @@ auth_shadow (
|
|
|
794a5c |
RETURN("NO Invalid username");
|
|
|
794a5c |
}
|
|
|
794a5c |
|
|
|
794a5c |
- if (strcmp(upw->upw_passwd, crypt(password, upw->upw_passwd)) != 0) {
|
|
|
794a5c |
+ cpw = crypt(password, upw->upw_passwd);
|
|
|
794a5c |
+ if ((cpw == NULL) || strcmp(upw->upw_passwd, cpw) != 0) {
|
|
|
794a5c |
if (flags & VERBOSE) {
|
|
|
794a5c |
syslog(LOG_DEBUG, "auth_shadow: pw mismatch: %s != %s",
|
|
|
794a5c |
password, upw->upw_passwd);
|