tony2001 Tue Dec 12 07:36:37 2006 UTC
Modified files:
/php-src/ext/standard crypt.c
/php-src configure.in acinclude.m4
Log:
fix #39795 (build fails on AIX because crypt_r() uses different data struct)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/crypt.c?r1=1.66&r2=1.67&diff_format=u
Index: php-src/ext/standard/crypt.c
diff -u php-src/ext/standard/crypt.c:1.66 php-src/ext/standard/crypt.c:1.67
--- php-src/ext/standard/crypt.c:1.66 Sun Dec 3 13:46:09 2006
+++ php-src/ext/standard/crypt.c Tue Dec 12 07:36:36 2006
@@ -17,7 +17,7 @@
| Rasmus Lerdorf <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: crypt.c,v 1.66 2006/12/03 13:46:09 tony2001 Exp $ */
+/* $Id: crypt.c,v 1.67 2006/12/12 07:36:36 tony2001 Exp $ */
#include <stdlib.h>
#include "php.h"
@@ -28,6 +28,9 @@
#include <unistd.h>
#endif
#if HAVE_CRYPT_H
+#if defined(CRYPT_R_GNU_SOURCE) && !defined(_GNU_SOURCE)
+#define _GNU_SOURCE
+#endif
#include <crypt.h>
#endif
#if TM_IN_SYS_TIME
@@ -147,8 +150,15 @@
}
#ifdef HAVE_CRYPT_R
{
+#if defined(CRYPT_R_STRUCT_CRYPT_DATA)
struct crypt_data buffer;
memset(&buffer, 0, sizeof(buffer));
+#elif defined(CRYPT_R_CRYPTD)
+ CRYPTD buffer;
+#else
+#error Data struct used by crypt_r() is unknown. Please report.
+#endif
+
RETURN_STRING(crypt_r(str, salt, &buffer), 1);
}
#else
http://cvs.php.net/viewvc.cgi/php-src/configure.in?r1=1.617&r2=1.618&diff_format=u
Index: php-src/configure.in
diff -u php-src/configure.in:1.617 php-src/configure.in:1.618
--- php-src/configure.in:1.617 Tue Dec 5 08:08:33 2006
+++ php-src/configure.in Tue Dec 12 07:36:37 2006
@@ -1,4 +1,4 @@
- ## $Id: configure.in,v 1.617 2006/12/05 08:08:33 dmitry Exp $ -*- autoconf -*-
+ ## $Id: configure.in,v 1.618 2006/12/12 07:36:37 tony2001 Exp $ -*- autoconf
-*-
dnl ## Process this file with autoconf to produce a configure script.
divert(1)
@@ -465,7 +465,6 @@
ctime_r \
cuserid \
crypt \
-crypt_r \
flock \
ftok \
funopen \
@@ -598,6 +597,11 @@
PHP_READDIR_R_TYPE
PHP_CHECK_IN_ADDR_T
+AC_CHECK_FUNCS(crypt_r, [ php_crypt_r="1" ], [ php_crypt_r="0" ])
+if test "x$php_crypt_r" = "x1"; then
+ PHP_CRYPT_R_STYLE
+fi
+
divert(4)
dnl ## In diversion 4 we check user-configurable general settings.
http://cvs.php.net/viewvc.cgi/php-src/acinclude.m4?r1=1.351&r2=1.352&diff_format=u
Index: php-src/acinclude.m4
diff -u php-src/acinclude.m4:1.351 php-src/acinclude.m4:1.352
--- php-src/acinclude.m4:1.351 Mon Dec 4 18:28:34 2006
+++ php-src/acinclude.m4 Tue Dec 12 07:36:37 2006
@@ -1,5 +1,5 @@
dnl
-dnl $Id: acinclude.m4,v 1.351 2006/12/04 18:28:34 tony2001 Exp $
+dnl $Id: acinclude.m4,v 1.352 2006/12/12 07:36:37 tony2001 Exp $
dnl
dnl This file contains local autoconf functions.
dnl
@@ -2590,3 +2590,55 @@
)
])
+dnl
+dnl PHP_CRYPT_R_STYLE
+dnl detect the style of crypt_r() is any is available
+dnl see APR_CHECK_CRYPT_R_STYLE() for original version
+dnl
+AC_DEFUN([PHP_CRYPT_R_STYLE],
+[
+ AC_CACHE_CHECK([which data struct is used by crypt_r], php_cv_crypt_r_style,[
+ php_cv_crypt_r_style=none
+ AC_TRY_COMPILE([
+#include <crypt.h>
+],[
+CRYPTD buffer;
+crypt_r("passwd", "hash", &buffer);
+],
+php_cv_crypt_r_style=cryptd)
+
+ if test "$php_cv_crypt_r_style" = "none"; then
+ AC_TRY_COMPILE([
+#include <crypt.h>
+],[
+struct crypt_data buffer;
+crypt_r("passwd", "hash", &buffer);
+],
+php_cv_crypt_r_style=struct_crypt_data)
+ fi
+
+ if test "$php_cv_crypt_r_style" = "none"; then
+ AC_TRY_COMPILE([
+#define _GNU_SOURCE
+#include <crypt.h>
+],[
+struct crypt_data buffer;
+crypt_r("passwd", "hash", &buffer);
+],
+php_cv_crypt_r_style=struct_crypt_data_gnu_source)
+ fi
+ ])
+
+ if test "$php_cv_crypt_r_style" = "cryptd"; then
+ AC_DEFINE(CRYPT_R_CRYPTD, 1, [Define if crypt_r has uses CRYPTD])
+ fi
+ if test "$php_cv_crypt_r_style" = "struct_crypt_data" -o
"$php_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 "$php_cv_crypt_r_style" = "struct_crypt_data_gnu_source"; then
+ AC_DEFINE(CRYPT_R_GNU_SOURCE, 1, [Define if struct crypt_data requires
_GNU_SOURCE])
+ fi
+ if test "$php_cv_crypt_r_style" = "none"; then
+ AC_MSG_ERROR([Unable to detect data struct is used by crypt_r])
+ fi
+])
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php