From 9e20efe37517e8f4ad713d0bc1cf1d50c9c7459b Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Sun, 17 Nov 2002 05:44:21 +0000 Subject: [PATCH] * configure.in: Move check for pwdauth() to MC_MCSERVER_CHECKS. * acinclude.m4 (MC_MCSERVER_CHECKS): If using crypt(), check for shadow password support. --- ChangeLog | 4 ++++ acinclude.m4 | 32 ++++++++++++++++++++++++++------ configure.in | 2 +- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index b24939954..4237163b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2002-11-16 Pavel Roskin + * configure.in: Move check for pwdauth() to MC_MCSERVER_CHECKS. + * acinclude.m4 (MC_MCSERVER_CHECKS): If using crypt(), check for + shadow password support. + * acinclude.m4 (MC_MCSERVER_CHECKS): Don't limit PAM check to Linux. Use AC_SEARCH_LIBS to find crypt(). Consolidate mcserv libraries into MCSERVLIBS. diff --git a/acinclude.m4 b/acinclude.m4 index 068963217..55cfb069a 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -37,22 +37,27 @@ AC_DEFUN([MC_UNDELFS_CHECKS], [ dnl MC_MCSERVER_CHECKS dnl Check how mcserver should check passwords. -dnl Possible methods are PAM and libcrypt. +dnl Possible methods are PAM, pwdauth and crypt. +dnl The later works with both /etc/shadow and /etc/passwd. +dnl If PAM is found, other methods are not checked. AC_DEFUN([MC_MCSERVER_CHECKS], [ - mcserv_auth= - dnl Check if PAM can be used for mcserv AC_CHECK_LIB(dl, dlopen, [LIB_DL="-ldl"]) AC_CHECK_LIB(pam, pam_start, [ AC_DEFINE(HAVE_PAM, 1, [Define if PAM (Pluggable Authentication Modules) is available]) MCSERVLIBS="-lpam $LIB_DL" - mcserv_auth=pam], [], [$LIB_DL]) + mcserv_pam=yes], [], [$LIB_DL]) - dnl Fallback to libcrypt (uses passwords from /etc/passwd) - if test -z "$mcserv_auth"; then + dnl Check for crypt() - needed for both /etc/shadow and /etc/passwd. + if test -z "$mcserv_pam"; then + + dnl Check for pwdauth() - used on SunOS. + AC_CHECK_FUNCS([pwdauth]) + + dnl Check for crypt() AC_CHECK_HEADERS([crypt.h], [crypt_header=yes]) if test -n "$crypt_header"; then save_LIBS="$LIBS" @@ -63,6 +68,21 @@ AC_DEFUN([MC_MCSERVER_CHECKS], [ if test -n "$mcserv_auth"; then AC_DEFINE(HAVE_CRYPT, 1, [Define to use crypt function in mcserv]) + + dnl Check for shadow passwords + AC_CHECK_HEADERS([shadow.h shadow/shadow.h], + [shadow_header=yes; break]) + if test -n "$shadow_header"; then + save_LIBS="$LIBS" + LIBS="$MCSERVLIBS" + AC_SEARCH_LIBS(getspnam, [shadow], [mcserv_auth=shadow]) + MCSERVLIBS="$LIBS" + LIBS="$save_LIBS" + if test -n "$mcserv_auth"; then + AC_DEFINE(HAVE_SHADOW, 1, + [Define to use shadow passwords for mcserv]) + fi + fi fi fi fi diff --git a/configure.in b/configure.in index 626d6619b..b89bbef18 100644 --- a/configure.in +++ b/configure.in @@ -132,7 +132,7 @@ dnl Check availability of some functions dnl AC_CHECK_FUNCS([strerror statfs strftime \ - memmove pwdauth truncate initgroups putenv \ + memmove truncate initgroups putenv \ memset memcpy tcsetattr tcgetattr cfgetospeed \ sigaction sigemptyset sigprocmask sigaddset \ sysconf setuid setreuid telldir seekdir])