summaryrefslogtreecommitdiff
path: root/build/apr_common.m4
diff options
context:
space:
mode:
authortrawick <trawick@13f79535-47bb-0310-9956-ffa450edef68>2002-05-10 19:10:58 +0000
committertrawick <trawick@13f79535-47bb-0310-9956-ffa450edef68>2002-05-10 19:10:58 +0000
commit59e107a68ec89ab9540337a2511fd095291ca31f (patch)
treed014adb65ce0f706c8da19cd6a1f2311ebc776f9 /build/apr_common.m4
parenta35597057c197e34c506a8c1a9a7f4041f8b1c98 (diff)
downloadlibapr-59e107a68ec89ab9540337a2511fd095291ca31f.tar.gz
Linux, AIX: Use crypt_r() instead of crypt() because the native
crypt() is not thread-safe. The misuse of crypt() led to intermittent failures with Apache basic authentication when crypt passwords were being used. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@63385 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'build/apr_common.m4')
-rw-r--r--build/apr_common.m453
1 files changed, 53 insertions, 0 deletions
diff --git a/build/apr_common.m4 b/build/apr_common.m4
index 7ec02223a..876396af2 100644
--- a/build/apr_common.m4
+++ b/build/apr_common.m4
@@ -459,6 +459,59 @@ fi
AC_MSG_RESULT([$msg])
] )
dnl
+dnl APR_CHECK_CRYPT_R_STYLE
+dnl
+dnl Decide which of a couple of flavors of crypt_r() is necessary for
+dnl this platform.
+dnl
+AC_DEFUN(APR_CHECK_CRYPT_R_STYLE,[
+AC_CACHE_CHECK(style of crypt_r, ac_cv_crypt_r_style,[
+dnl
+ac_cv_crypt_r_style=none
+dnl
+AC_TRY_COMPILE([
+#include <crypt.h>
+],[
+CRYPTD buffer;
+crypt_r("passwd", "hash", &buffer);
+], ac_cv_crypt_r_style=cryptd)
+dnl
+if test "$ac_cv_crypt_r_style" = "none"; then
+AC_TRY_COMPILE([
+#include <crypt.h>
+],[
+struct crypt_data buffer;
+crypt_r("passwd", "hash", &buffer);
+], ac_cv_crypt_r_style=struct_crypt_data)
+fi
+dnl
+if test "$ac_cv_crypt_r_style" = "none"; then
+dnl same as previous test, but see if defining _GNU_SOURCE helps
+AC_TRY_COMPILE([
+#define _GNU_SOURCE
+#include <crypt.h>
+],[
+struct crypt_data buffer;
+crypt_r("passwd", "hash", &buffer);
+], ac_cv_crypt_r_style=struct_crypt_data_gnu_source)
+fi
+dnl
+])
+if test "$ac_cv_crypt_r_style" = "cryptd"; then
+ AC_DEFINE(CRYPT_R_CRYPTD, 1, [Define if crypt_r has uses CRYPTD])
+fi
+dnl if we don't combine these conditions, CRYPT_R_STRUCT_CRYPT_DATA
+dnl will end up defined twice
+if test "$ac_cv_crypt_r_style" = "struct_crypt_data" -o \
+ "$ac_cv_crypt_r_style" = "struct_crypt_data_gnu_source"; then
+ AC_DEFINE(CRYPT_R_STRUCT_CRYPT_DATA, 1, [Define if crypt_r uses struct crypt_data])
+fi
+if test "$ac_cv_crypt_r_style" = "struct_crypt_data_gnu_source"; then
+ APR_ADDTO(CPPFLAGS, [-D_GNU_SOURCE])
+fi
+])
+
+dnl
dnl APR_CHECK_ICONV_INBUF
dnl
dnl Decide whether or not the inbuf parameter to iconv() is const.