]> arthur.barton.de Git - netatalk.git/blobdiff - macros/pam-check.m4
Writing metadata xattr on directories with sticky bit set, FR#94
[netatalk.git] / macros / pam-check.m4
index ac4ffc604f306acb58f8ec5787915e336c64fc02..609c92dcae18885775afd8b744b1d6a5a73f9b73 100644 (file)
@@ -1,7 +1,7 @@
-dnl $Id: pam-check.m4,v 1.3 2005-04-28 20:50:05 bfernhomberg Exp $
 dnl PAM finding macro
 
-AC_DEFUN([AC_PATH_PAM], [
+AC_DEFUN([AC_NETATALK_PATH_PAM], [
+    netatalk_cv_use_pam=no
        AC_ARG_WITH(pam, [  --with-pam[[=PATH]]       specify path to PAM installation [[auto]]],
                [
                        require_pam="yes"
@@ -72,10 +72,57 @@ AC_DEFUN([AC_PATH_PAM], [
        if test x"$pam_found" = "xyes" -a "x$PAMDIR" = "xNONE"; then
                AC_MSG_WARN([PAM support can be compiled, but the install location for the netatalk.pamd file could not be determined. Either install this file by hand or specify the install path.])
                netatalk_cv_install_pam=no
+    else
+        dnl Check for some system|common auth file
+        AC_MSG_CHECKING([for includable common PAM config])
+        pampath="${PAMDIR}etc/pam.d"
+        dnl Debian/SuSE
+        if test -f "$pampath/common-auth" ; then
+           PAM_DIRECTIVE=include
+           PAM_AUTH=common-auth
+           PAM_ACCOUNT=common-account
+           PAM_PASSWORD=common-password
+           PAM_SESSION=common-session
+        dnl RHEL/FC
+        elif test -f "$pampath/system-auth" ; then
+           PAM_DIRECTIVE=include
+           PAM_AUTH=system-auth
+           PAM_ACCOUNT=system-auth
+           PAM_PASSWORD=system-auth
+           PAM_SESSION=system-auth
+        dnl FreeBSD
+        elif test -f "$pampath/system" ; then
+           PAM_DIRECTIVE=include
+           PAM_AUTH=system
+           PAM_ACCOUNT=system
+           PAM_PASSWORD=system
+           PAM_SESSION=system
+        dnl Solaris 11+
+        elif test -f "$pampath/other" ; then
+           PAM_DIRECTIVE=include
+           PAM_AUTH=${PAMDIR}etc/pam.d/other
+           PAM_ACCOUNT=${PAMDIR}etc/pam.d/other
+           PAM_PASSWORD=${PAMDIR}etc/pam.d/other
+           PAM_SESSION=${PAMDIR}etc/pam.d/other
+        dnl Fallback
+        else
+           PAM_DIRECTIVE=required
+           PAM_AUTH=pam_unix.so
+           PAM_ACCOUNT=pam_unix.so
+           PAM_PASSWORD="pam_unix.so use_authtok"
+           PAM_SESSION=pam_unix.so
+        fi  
+
+        if test "x$PAM_DIRECTIVE" != "xrequired" ; then
+            AC_MSG_RESULT([yes ($PAM_DIRECTIVE $PAM_AUTH)])
+        else
+            AC_MSG_RESULT([no (using defaut pam_unix.so)])
+        fi
        fi
 
        AC_MSG_CHECKING([whether to enable PAM support])
        if test "x$pam_found" = "xno"; then
+               netatalk_cv_install_pam=no
                if test "x$require_pam" = "xyes"; then
                        AC_MSG_ERROR([PAM support missing])
                else
@@ -85,11 +132,29 @@ AC_DEFUN([AC_PATH_PAM], [
        else
                AC_MSG_RESULT([yes])
                ifelse([$1], , :, [$1])
+        use_pam_so=yes
+           compile_pam=yes
+           netatalk_cv_use_pam=yes
+           AC_DEFINE(USE_PAM, 1, [Define to enable PAM support])
        fi
 
-        LIB_REMOVE_USR_LIB(PAM_LIBS)
-        CFLAGS_REMOVE_USR_INCLUDE(PAM_CFLAGS)
+    AC_ARG_WITH(
+        pam-confdir,
+        [AS_HELP_STRING([--with-pam-confdir=PATH],[Path to PAM config dir (default: ${sysconfdir}/pam.d)])],
+        ac_cv_pamdir=$withval,
+        ac_cv_pamdir='${sysconfdir}/pam.d'
+    )
+
+    PAMDIR="$ac_cv_pamdir"
+
+    LIB_REMOVE_USR_LIB(PAM_LIBS)
+    CFLAGS_REMOVE_USR_INCLUDE(PAM_CFLAGS)
        AC_SUBST(PAMDIR)
        AC_SUBST(PAM_CFLAGS)
        AC_SUBST(PAM_LIBS)
+    AC_SUBST(PAM_DIRECTIVE)
+    AC_SUBST(PAM_AUTH)
+    AC_SUBST(PAM_ACCOUNT)
+    AC_SUBST(PAM_PASSWORD)
+    AC_SUBST(PAM_SESSION)
 ])