mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 00:37:00 +08:00
ocpasswd: attempt to use sha2crypt only in glibc
uclibc's crypt(3) is so dumb it will not error if $5$ is specified as salt, but not supported.
This commit is contained in:
13
configure.ac
13
configure.ac
@@ -162,6 +162,18 @@ AC_LIB_HAVE_LINKFLAGS(readline,, [
|
||||
fi
|
||||
fi
|
||||
|
||||
have_glibc=no
|
||||
AC_LIB_HAVE_LINKFLAGS(c,, [
|
||||
#include <stdio.h>
|
||||
#include <gnu/libc-version.h>
|
||||
#include <stdio.h>], [ puts (gnu_get_libc_version ()); return 0; ])
|
||||
if test x$ac_cv_libc = xyes; then
|
||||
AC_DEFINE(TRY_SHA2_CRYPT, 1, [have original glibc])
|
||||
have_glibc=yes
|
||||
else
|
||||
have_glibc=no
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(pam,
|
||||
AS_HELP_STRING([--without-pam], [do not include PAM support]),
|
||||
test_for_pam=$withval,
|
||||
@@ -460,6 +472,7 @@ Summary of build options:
|
||||
dbus: ${dbus_enabled}
|
||||
readline: ${have_readline}
|
||||
libnl3: ${have_libnl3}
|
||||
glibc (sha2crypt): ${have_glibc}
|
||||
local talloc: ${with_local_talloc}
|
||||
local protobuf-c: ${with_local_protobuf_c}
|
||||
local PCL library: ${with_local_pcl}
|
||||
|
||||
@@ -69,7 +69,11 @@ crypt_int(const char *fpasswd, const char *username, const char *groupname,
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#ifdef TRY_SHA2_CRYPT
|
||||
strcpy(salt, "$5$");
|
||||
#else
|
||||
strcpy(salt, "$1$");
|
||||
#endif
|
||||
p = salt + 3;
|
||||
|
||||
for (i = 0; i < sizeof(_salt); i++) {
|
||||
|
||||
Reference in New Issue
Block a user