summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrawick <trawick@13f79535-47bb-0310-9956-ffa450edef68>2014-08-19 11:45:07 +0000
committertrawick <trawick@13f79535-47bb-0310-9956-ffa450edef68>2014-08-19 11:45:07 +0000
commitec228e6847e1ef5bcc8f734733805a10833e543b (patch)
treed2a64a7a2f0b83538af0bc79c5c803a931e8c078
parent55b5aada962532161402e82ba380e57f7e3bf854 (diff)
downloadlibapr-util-ec228e6847e1ef5bcc8f734733805a10833e543b.tar.gz
Merge r1618843 from apr trunk:
Fix Android compile error caused by assumption that crypt is available. PR: 56627 Submitted by: Fredrik Fornwall <fredrik fornwall.net>, trawick git-svn-id: http://svn.apache.org/repos/asf/apr/apr-util/branches/1.5.x@1618845 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--CHANGES3
-rw-r--r--crypto/apr_passwd.c10
2 files changed, 11 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index 197ad4d7..fa90f5df 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
-*- coding: utf-8 -*-
Changes with APR-util 1.5.4
+ *) Fix compile failure for Android. PR 56627. [Fredrik Fornwall
+ <fredrik fornwall.net>, Jeff Trawick]
+
*) Fix to let ODBC driver build with MSVC6, which does not have intptr_t
[Tom Donovan]
diff --git a/crypto/apr_passwd.c b/crypto/apr_passwd.c
index 1b4b47bd..c961de2b 100644
--- a/crypto/apr_passwd.c
+++ b/crypto/apr_passwd.c
@@ -66,6 +66,12 @@ static void crypt_mutex_unlock(void)
#endif
#endif
+#if defined(WIN32) || defined(BEOS) || defined(NETWARE) || defined(__ANDROID__)
+#define CRYPT_MISSING 1
+#else
+#define CRYPT_MISSING 0
+#endif
+
/*
* Validate a plaintext password against a smashed one. Uses either
* crypt() (if available) or apr_md5_encode() or apr_sha1_base64(), depending
@@ -77,7 +83,7 @@ APU_DECLARE(apr_status_t) apr_password_validate(const char *passwd,
const char *hash)
{
char sample[200];
-#if !defined(WIN32) && !defined(BEOS) && !defined(NETWARE)
+#if !CRYPT_MISSING
char *crypt_pw;
#endif
if (hash[0] == '$'
@@ -100,7 +106,7 @@ APU_DECLARE(apr_status_t) apr_password_validate(const char *passwd,
/*
* It's not our algorithm, so feed it to crypt() if possible.
*/
-#if defined(WIN32) || defined(BEOS) || defined(NETWARE)
+#if CRYPT_MISSING
return (strcmp(passwd, hash) == 0) ? APR_SUCCESS : APR_EMISMATCH;
#elif defined(CRYPT_R_CRYPTD)
apr_status_t rv;