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