You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by tr...@apache.org on 2012/08/08 03:34:19 UTC

svn commit: r1370628 - in /apr/apr-util/branches/1.4.x: ./ CHANGES crypto/apr_md5.c

Author: trawick
Date: Wed Aug  8 01:34:19 2012
New Revision: 1370628

URL: http://svn.apache.org/viewvc?rev=1370628&view=rev
Log:
merge r1370626 from trunk:

apr_password_validate(): Fix intermittent errors on systems
such as FreeBSD where the crypt() function is used.

Modified:
    apr/apr-util/branches/1.4.x/   (props changed)
    apr/apr-util/branches/1.4.x/CHANGES
    apr/apr-util/branches/1.4.x/crypto/apr_md5.c

Propchange: apr/apr-util/branches/1.4.x/
------------------------------------------------------------------------------
  Merged /apr/apr/trunk:r1370626

Modified: apr/apr-util/branches/1.4.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.4.x/CHANGES?rev=1370628&r1=1370627&r2=1370628&view=diff
==============================================================================
--- apr/apr-util/branches/1.4.x/CHANGES [utf-8] (original)
+++ apr/apr-util/branches/1.4.x/CHANGES [utf-8] Wed Aug  8 01:34:19 2012
@@ -1,6 +1,9 @@
                                                      -*- coding: utf-8 -*-
 Changes with APR-util 1.4.3
 
+  *) apr_password_validate(): Fix intermittent errors on systems
+     such as FreeBSD where the crypt() function is used.  [Jeff Trawick]
+
   *) Improve platform detection for bundled expat by updating
      config.guess and config.sub. [Rainer Jung]
 

Modified: apr/apr-util/branches/1.4.x/crypto/apr_md5.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.4.x/crypto/apr_md5.c?rev=1370628&r1=1370627&r2=1370628&view=diff
==============================================================================
--- apr/apr-util/branches/1.4.x/crypto/apr_md5.c (original)
+++ apr/apr-util/branches/1.4.x/crypto/apr_md5.c Wed Aug  8 01:34:19 2012
@@ -748,18 +748,23 @@ APU_DECLARE(apr_status_t) apr_password_v
 #if defined(_AIX) && APR_HAS_THREADS
 #error Configuration error!  crypt_r() should have been selected!
 #endif
+        {
+            apr_status_t rv;
 
-        /* Handle thread safety issues by holding a mutex around the
-         * call to crypt().
-         */
-        crypt_mutex_lock();
-        crypt_pw = crypt(passwd, hash);
-        if (!crypt_pw) {
+            /* Handle thread safety issues by holding a mutex around the
+             * call to crypt().
+             */
+            crypt_mutex_lock();
+            crypt_pw = crypt(passwd, hash);
+            if (!crypt_pw) {
+                rv = APR_EMISMATCH;
+            }
+            else {
+                rv = (strcmp(crypt_pw, hash) == 0) ? APR_SUCCESS : APR_EMISMATCH;
+            }
             crypt_mutex_unlock();
-            return APR_EMISMATCH;
+            return rv;
         }
-        crypt_mutex_unlock();
-        return (strcmp(crypt_pw, hash) == 0) ? APR_SUCCESS : APR_EMISMATCH;
 #endif
     }
     return (strcmp(sample, hash) == 0) ? APR_SUCCESS : APR_EMISMATCH;