apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r1370627 - in /apr/apr-util/branches/1.5.x: ./ CHANGES crypto/apr_passwd.c
Date Wed, 08 Aug 2012 01:29:33 GMT
Author: trawick
Date: Wed Aug  8 01:29:33 2012
New Revision: 1370627

URL: http://svn.apache.org/viewvc?rev=1370627&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.5.x/   (props changed)
    apr/apr-util/branches/1.5.x/CHANGES
    apr/apr-util/branches/1.5.x/crypto/apr_passwd.c

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

Modified: apr/apr-util/branches/1.5.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.5.x/CHANGES?rev=1370627&r1=1370626&r2=1370627&view=diff
==============================================================================
--- apr/apr-util/branches/1.5.x/CHANGES [utf-8] (original)
+++ apr/apr-util/branches/1.5.x/CHANGES [utf-8] Wed Aug  8 01:29:33 2012
@@ -1,6 +1,9 @@
                                                      -*- coding: utf-8 -*-
 Changes with APR-util 1.5.1
 
+  *) 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.5.x/crypto/apr_passwd.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.5.x/crypto/apr_passwd.c?rev=1370627&r1=1370626&r2=1370627&view=diff
==============================================================================
--- apr/apr-util/branches/1.5.x/crypto/apr_passwd.c (original)
+++ apr/apr-util/branches/1.5.x/crypto/apr_passwd.c Wed Aug  8 01:29:33 2012
@@ -134,18 +134,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;



Mime
View raw message