Blame SOURCES/cyrus-sasl-2.1.26-null-crypt.patch

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