Skip to content

Commit 3a848da

Browse files
committed
fix
1 parent 726dadd commit 3a848da

File tree

1 file changed

+28
-22
lines changed

1 file changed

+28
-22
lines changed

config.m4

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,39 @@ if test "$PHP_XPASS" != "no"; then
1212
PHP_EVAL_LIBLINE([$LIBXCRYPT_LIBS], [XPASS_SHARED_LIBADD])
1313

1414
old_CFLAGS=$CFLAGS; CFLAGS="$CFLAGS $LIBXCRYPT_CFLAGS"
15-
old_LIBS="$LIBS"; LIBS="$LIBXCRYPT_LIBS"
15+
old_LDFLAGS=$LDFLAGS; LDFLAGS="$LIBXCRYPT_LIBS $LDFLAGS"
16+
old_LIBS=$LIBS; LIBS="$LIBS $LIBXCRYPT_LIBS"
1617

1718
AC_MSG_CHECKING([for yescrypt])
18-
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
19-
#include <crypt.h>
20-
#include <string.h>
21-
]], [[
22-
struct crypt_data data;
23-
memset(&data, 0, sizeof(data));
24-
char *result = crypt_r("password", "$y$", &data);
25-
return (result != NULL && strncmp(result, "$y$", 3) == 0) ? 0 : 1;
26-
]])], [
27-
AC_MSG_RESULT([available])
28-
AC_DEFINE([HAVE_CRYPT_YESCRYPT], [1], [ Have yescrypt hash support ])
19+
AC_RUN_IFELSE([AC_LANG_SOURCE([[
20+
#include <string.h>
21+
#include <unistd.h>
22+
#include <crypt.h>
23+
#include <stdlib.h>
24+
25+
int main(void) {
26+
char salt[8];
27+
salt[0]='$'; salt[1]='y'; salt[2]='$'; salt[3]=0;
28+
return crypt_gensalt(salt, 0, NULL, 0) ? 0 : 1;
29+
}]])],[
30+
AC_DEFINE([HAVE_CRYPT_YESCRYPT], [1], [ Have yescrypt hash support ])
31+
AC_MSG_RESULT([available])
2932
], [
30-
AC_MSG_RESULT([missing])
33+
AC_MSG_RESULT([missing])
3134
])
3235

3336
AC_MSG_CHECKING([for sha512 algo])
34-
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
35-
#include <crypt.h>
36-
#include <string.h>
37-
]], [[
38-
struct crypt_data data;
39-
memset(&data, 0, sizeof(data));
40-
char *result = crypt_r("password", "$6$salt", &data);
41-
return (result != NULL && strncmp(result, "$6$", 3) == 0) ? 0 : 1;
42-
]])],[
37+
AC_RUN_IFELSE([AC_LANG_SOURCE([[
38+
#include <string.h>
39+
#include <unistd.h>
40+
#include <crypt.h>
41+
#include <stdlib.h>
42+
43+
int main(void) {
44+
char salt[8];
45+
salt[0]='$'; salt[1]='6'; salt[2]='$'; salt[3]=0;
46+
return crypt_gensalt(salt, 0, NULL, 0) ? 0 : 1;
47+
}]])],[
4348
AC_DEFINE([HAVE_CRYPT_SHA512], [1], [ Have sha512 hash support ])
4449
AC_MSG_RESULT([available])
4550
], [
@@ -48,6 +53,7 @@ if test "$PHP_XPASS" != "no"; then
4853

4954
CFLAGS=$old_CFLAGS
5055
LDFLAGS=$old_LDFLAGS
56+
LIBS=$old_LIBS
5157

5258
PHP_SUBST([XPASS_SHARED_LIBADD])
5359

0 commit comments

Comments
 (0)