apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r1449308 - /apr/apr/trunk/crypto/apr_passwd.c
Date Sat, 23 Feb 2013 12:20:59 GMT
Author: rjung
Date: Sat Feb 23 12:20:59 2013
New Revision: 1449308

URL: http://svn.apache.org/r1449308
Log:
Fix password validation failure for all crypt
and crypt_r based algorithms.

PR: 54603

Submitted by: Harvey Eneman <harvey.eneman oracle.com>

Modified:
    apr/apr/trunk/crypto/apr_passwd.c

Modified: apr/apr/trunk/crypto/apr_passwd.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/crypto/apr_passwd.c?rev=1449308&r1=1449307&r2=1449308&view=diff
==============================================================================
--- apr/apr/trunk/crypto/apr_passwd.c (original)
+++ apr/apr/trunk/crypto/apr_passwd.c Sat Feb 23 12:20:59 2013
@@ -103,19 +103,18 @@ APR_DECLARE(apr_status_t) apr_password_v
 #if !defined(WIN32) && !defined(BEOS) && !defined(NETWARE)
     char *crypt_pw;
 #endif
-    if (hash[0] == '$') {
-        if (hash[1] == '2' && (hash[2] == 'a' || hash[2] == 'y')
-            && hash[3] == '$')
-        {
-            if (_crypt_blowfish_rn(passwd, hash, sample, sizeof(sample)) == NULL)
-                return APR_FROM_OS_ERROR(errno);
-        }
-        else if (!strncmp(hash, apr1_id, strlen(apr1_id))) {
-            /*
-             * The hash was created using our custom algorithm.
-             */
-            apr_md5_encode(passwd, hash, sample, sizeof(sample));
-        }
+    if (hash[0] == '$'
+        && hash[1] == '2'
+        && (hash[2] == 'a' || hash[2] == 'y')
+        && hash[3] == '$') {
+        if (_crypt_blowfish_rn(passwd, hash, sample, sizeof(sample)) == NULL)
+            return APR_FROM_OS_ERROR(errno);
+    }
+    else if (!strncmp(hash, apr1_id, strlen(apr1_id))) {
+        /*
+         * The hash was created using our custom algorithm.
+         */
+        apr_md5_encode(passwd, hash, sample, sizeof(sample));
     }
     else if (!strncmp(hash, APR_SHA1PW_ID, APR_SHA1PW_IDLEN)) {
          apr_sha1_base64(passwd, (int)strlen(passwd), sample);



Mime
View raw message