]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - config-scripts/cups-pam.m4
Fix an issue with `PreserveJobHistory` and time values (Issue #5538)
[thirdparty/cups.git] / config-scripts / cups-pam.m4
index 3d5afbb56a829056db8f9ac97275838b6b1e7148..0a9157ac0b41d5929b9fb0329e0bb1cc75f5a0bc 100644 (file)
@@ -1,44 +1,28 @@
 dnl
-dnl "$Id: cups-pam.m4 177 2006-06-21 00:20:03Z jlovell $"
+dnl PAM stuff for CUPS.
 dnl
-dnl   PAM stuff for the Common UNIX Printing System (CUPS).
+dnl Copyright 2007-2017 by Apple Inc.
+dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
 dnl
-dnl   Copyright 1997-2005 by Easy Software Products, all rights reserved.
-dnl
-dnl   These coded instructions, statements, and computer programs are the
-dnl   property of Easy Software Products and are protected by Federal
-dnl   copyright law.  Distribution and use rights are outlined in the file
-dnl   "LICENSE.txt" which should have been included with this file.  If this
-dnl   file is missing or damaged please contact Easy Software Products
-dnl   at:
-dnl
-dnl       Attn: CUPS Licensing Information
-dnl       Easy Software Products
-dnl       44141 Airport View Drive, Suite 204
-dnl       Hollywood, Maryland 20636 USA
-dnl
-dnl       Voice: (301) 373-9600
-dnl       EMail: cups-info@cups.org
-dnl         WWW: http://www.cups.org
+dnl Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
 dnl
 
-AC_ARG_ENABLE(pam, [  --enable-pam            turn on PAM support, default=yes])
-
-dnl Don't use PAM with AIX...
-if test $uname = AIX; then
-       enable_pam=no
-fi
+AC_ARG_ENABLE(pam, [  --disable-pam           disable PAM support])
+AC_ARG_WITH(pam_module, [  --with-pam-module       set the PAM module to use])
 
 PAMDIR=""
-PAMFILE=""
+PAMFILE="pam.std"
 PAMLIBS=""
 PAMMOD="pam_unknown.so"
+PAMMODAUTH="pam_unknown.so"
 
 if test x$enable_pam != xno; then
        SAVELIBS="$LIBS"
 
        AC_CHECK_LIB(dl,dlopen)
        AC_CHECK_LIB(pam,pam_start)
+       AC_CHECK_LIB(pam,pam_set_item,AC_DEFINE(HAVE_PAM_SET_ITEM))
+       AC_CHECK_LIB(pam,pam_setcred,AC_DEFINE(HAVE_PAM_SETCRED))
        AC_CHECK_HEADER(security/pam_appl.h)
        if test x$ac_cv_header_security_pam_appl_h != xyes; then
                AC_CHECK_HEADER(pam/pam_appl.h,
@@ -64,26 +48,46 @@ if test x$enable_pam != xno; then
 
        LIBS="$SAVELIBS"
 
-       case "$uname" in
-               Darwin*)
-                       # Darwin, MacOS X
-                       PAMFILE="pam.darwin"
-                       ;;
-               IRIX)
-                       # SGI IRIX
-                       PAMFILE="pam.irix"
+       case "$host_os_name" in
+               darwin*)
+                       # Darwin/macOS
+                       if test "x$with_pam_module" != x; then
+                               PAMFILE="pam.$with_pam_module"
+                       elif test -f /usr/lib/pam/pam_opendirectory.so.2; then
+                               PAMFILE="pam.opendirectory"
+                       else
+                               PAMFILE="pam.securityserver"
+                       fi
                        ;;
+
                *)
                        # All others; this test might need to be updated
                        # as Linux distributors move things around...
-                       for mod in pam_unix2.so pam_unix.so pam_pwdb.so; do
-                               if test -f /lib/security/$mod; then
-                                       PAMMOD="$mod"
-                                       break;
+                       if test "x$with_pam_module" != x; then
+                               PAMMOD="pam_${with_pam_module}.so"
+                       elif test -f /etc/pam.d/common-auth; then
+                               PAMFILE="pam.common"
+                       else
+                               moddir=""
+                               for dir in /lib/security /lib64/security /lib/x86_64-linux-gnu/security /var/lib/pam; do
+                                       if test -d $dir; then
+                                               moddir=$dir
+                                               break;
+                                       fi
+                               done
+
+                               if test -f $moddir/pam_unix2.so; then
+                                       PAMMOD="pam_unix2.so"
+                               elif test -f $moddir/pam_unix.so; then
+                                       PAMMOD="pam_unix.so"
                                fi
-                       done
+                       fi
 
-                       PAMFILE="pam.std"
+                       if test "x$PAMMOD" = xpam_unix.so; then
+                               PAMMODAUTH="$PAMMOD shadow nodelay"
+                       else
+                               PAMMODAUTH="$PAMMOD nodelay"
+                       fi
                        ;;
        esac
 fi
@@ -92,7 +96,4 @@ AC_SUBST(PAMDIR)
 AC_SUBST(PAMFILE)
 AC_SUBST(PAMLIBS)
 AC_SUBST(PAMMOD)
-
-dnl
-dnl End of "$Id: cups-pam.m4 177 2006-06-21 00:20:03Z jlovell $".
-dnl
+AC_SUBST(PAMMODAUTH)