dnl
dnl PAM stuff for CUPS.
dnl
-dnl Copyright 2007-2017 by Apple Inc.
-dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
+dnl Copyright © 2021 by OpenPrinting.
+dnl Copyright © 2007-2017 by Apple Inc.
+dnl Copyright © 1997-2005 by Easy Software Products, all rights reserved.
dnl
-dnl Licensed under Apache License v2.0. See the file "LICENSE" for more information.
+dnl Licensed under Apache License v2.0. See the file "LICENSE" for more
+dnl information.
dnl
-AC_ARG_ENABLE(pam, [ --disable-pam disable PAM support])
-AC_ARG_WITH(pam_module, [ --with-pam-module set the PAM module to use])
+AC_ARG_ENABLE([pam], AS_HELP_STRING([--disable-pam], [disable PAM support]))
+AC_ARG_WITH([pam_module], AS_HELP_STRING([--with-pam-module], [set the PAM module to use]))
PAMDIR=""
PAMFILE="pam.std"
PAMMOD="pam_unknown.so"
PAMMODAUTH="pam_unknown.so"
-if test x$enable_pam != xno; then
- SAVELIBS="$LIBS"
+AS_IF([test x$enable_pam != xno], [
+ 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,
- AC_DEFINE(HAVE_PAM_PAM_APPL_H))
- fi
+ AC_CHECK_LIB([dl], [dlopen])
+ AC_CHECK_LIB([pam], [pam_start])
+ AC_CHECK_LIB([pam], [pam_set_item], [
+ AC_DEFINE([HAVE_PAM_SET_ITEM], [1], [Have pam_set_item function?])
+ ])
+ AC_CHECK_LIB([pam], [pam_setcred], [
+ AC_DEFINE([HAVE_PAM_SETCRED], [1], [Have pam_setcred function?])
+ ])
+ AC_CHECK_HEADER([security/pam_appl.h])
+ AS_IF([test x$ac_cv_header_security_pam_appl_h != xyes], [
+ AC_CHECK_HEADER([pam/pam_appl.h], [
+ AC_DEFINE([HAVE_PAM_PAM_APPL_H], [1], [Have <pam/pam_appl.h> header?])
+ ])
+ ])
- if test x$ac_cv_lib_pam_pam_start != xno; then
- # Set the necessary libraries for PAM...
- if test x$ac_cv_lib_dl_dlopen != xno; then
- PAMLIBS="-lpam -ldl"
- else
- PAMLIBS="-lpam"
- fi
+ AS_IF([test x$ac_cv_lib_pam_pam_start != xno], [
+ # Set the necessary libraries for PAM...
+ AS_IF([test x$ac_cv_lib_dl_dlopen != xno], [
+ PAMLIBS="-lpam -ldl"
+ ], [
+ PAMLIBS="-lpam"
+ ])
- # Find the PAM configuration directory, if any...
- for dir in /private/etc/pam.d /etc/pam.d; do
- if test -d $dir; then
- PAMDIR=$dir
- break;
- fi
- done
- fi
+ # Find the PAM configuration directory, if any...
+ for dir in /private/etc/pam.d /etc/pam.d; do
+ AS_IF([test -d $dir], [
+ PAMDIR="$dir"
+ break;
+ ])
+ done
+ ])
- LIBS="$SAVELIBS"
+ LIBS="$SAVELIBS"
- 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
- ;;
+ AS_CASE(["$host_os_name"], [darwin*], [
+ # Darwin/macOS
+ AS_IF([test "x$with_pam_module" != x], [
+ PAMFILE="pam.$with_pam_module"
+ ], [test -f /usr/lib/pam/pam_opendirectory.so.2], [
+ PAMFILE="pam.opendirectory"
+ ], [
+ PAMFILE="pam.securityserver"
+ ])
+ ], [*], [
+ # All others; this test might need to be updated
+ # as Linux distributors move things around...
+ AS_IF([test "x$with_pam_module" != x], [
+ PAMMOD="pam_${with_pam_module}.so"
+ ], [test -f /etc/pam.d/common-auth], [
+ PAMFILE="pam.common"
+ ], [
+ moddir=""
+ for dir in /lib/security /lib64/security /lib/x86_64-linux-gnu/security /var/lib/pam; do
+ AS_IF([test -d $dir], [
+ moddir="$dir"
+ break;
+ ])
+ done
- *)
- # All others; this test might need to be updated
- # as Linux distributors move things around...
- 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
+ AS_IF([test -f $moddir/pam_unix2.so], [
+ PAMMOD="pam_unix2.so"
+ ], [test -f $moddir/pam_unix.so], [
+ PAMMOD="pam_unix.so"
+ ])
+ ])
- 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
- fi
+ AS_IF([test "x$PAMMOD" = xpam_unix.so], [
+ PAMMODAUTH="$PAMMOD shadow nodelay"
+ ], [
+ PAMMODAUTH="$PAMMOD nodelay"
+ ])
+ ])
+])
- if test "x$PAMMOD" = xpam_unix.so; then
- PAMMODAUTH="$PAMMOD shadow nodelay"
- else
- PAMMODAUTH="$PAMMOD nodelay"
- fi
- ;;
- esac
-fi
-
-AC_SUBST(PAMDIR)
-AC_SUBST(PAMFILE)
-AC_SUBST(PAMLIBS)
-AC_SUBST(PAMMOD)
-AC_SUBST(PAMMODAUTH)
+AC_SUBST([PAMDIR])
+AC_SUBST([PAMFILE])
+AC_SUBST([PAMLIBS])
+AC_SUBST([PAMMOD])
+AC_SUBST([PAMMODAUTH])
PAMMOD="pam_unknown.so"
PAMMODAUTH="pam_unknown.so"
-if test x$enable_pam != xno; then
- SAVELIBS="$LIBS"
+if test x$enable_pam != xno
+then :
+
+ SAVELIBS="$LIBS"
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
printf %s "checking for dlopen in -ldl... " >&6; }
if test ${ac_cv_lib_dl_dlopen+y}
then :
fi
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pam_start in -lpam" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pam_start in -lpam" >&5
printf %s "checking for pam_start in -lpam... " >&6; }
if test ${ac_cv_lib_pam_pam_start+y}
then :
fi
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pam_set_item in -lpam" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pam_set_item in -lpam" >&5
printf %s "checking for pam_set_item in -lpam... " >&6; }
if test ${ac_cv_lib_pam_pam_set_item+y}
then :
printf "%s\n" "$ac_cv_lib_pam_pam_set_item" >&6; }
if test "x$ac_cv_lib_pam_pam_set_item" = xyes
then :
- printf "%s\n" "#define HAVE_PAM_SET_ITEM 1" >>confdefs.h
+
+
+printf "%s\n" "#define HAVE_PAM_SET_ITEM 1" >>confdefs.h
+
fi
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pam_setcred in -lpam" >&5
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pam_setcred in -lpam" >&5
printf %s "checking for pam_setcred in -lpam... " >&6; }
if test ${ac_cv_lib_pam_pam_setcred+y}
then :
printf "%s\n" "$ac_cv_lib_pam_pam_setcred" >&6; }
if test "x$ac_cv_lib_pam_pam_setcred" = xyes
then :
- printf "%s\n" "#define HAVE_PAM_SETCRED 1" >>confdefs.h
+
+
+printf "%s\n" "#define HAVE_PAM_SETCRED 1" >>confdefs.h
+
fi
- ac_fn_c_check_header_compile "$LINENO" "security/pam_appl.h" "ac_cv_header_security_pam_appl_h" "$ac_includes_default"
+ ac_fn_c_check_header_compile "$LINENO" "security/pam_appl.h" "ac_cv_header_security_pam_appl_h" "$ac_includes_default"
if test "x$ac_cv_header_security_pam_appl_h" = xyes
then :
fi
- if test x$ac_cv_header_security_pam_appl_h != xyes; then
- ac_fn_c_check_header_compile "$LINENO" "pam/pam_appl.h" "ac_cv_header_pam_pam_appl_h" "$ac_includes_default"
+ if test x$ac_cv_header_security_pam_appl_h != xyes
+then :
+
+ ac_fn_c_check_header_compile "$LINENO" "pam/pam_appl.h" "ac_cv_header_pam_pam_appl_h" "$ac_includes_default"
if test "x$ac_cv_header_pam_pam_appl_h" = xyes
then :
- printf "%s\n" "#define HAVE_PAM_PAM_APPL_H 1" >>confdefs.h
+
+
+printf "%s\n" "#define HAVE_PAM_PAM_APPL_H 1" >>confdefs.h
+
fi
- fi
- if test x$ac_cv_lib_pam_pam_start != xno; then
- # Set the necessary libraries for PAM...
- if test x$ac_cv_lib_dl_dlopen != xno; then
- PAMLIBS="-lpam -ldl"
- else
- PAMLIBS="-lpam"
- fi
+fi
- # Find the PAM configuration directory, if any...
- for dir in /private/etc/pam.d /etc/pam.d; do
- if test -d $dir; then
- PAMDIR=$dir
- break;
- fi
- done
- fi
+ if test x$ac_cv_lib_pam_pam_start != xno
+then :
- LIBS="$SAVELIBS"
+ # Set the necessary libraries for PAM...
+ if test x$ac_cv_lib_dl_dlopen != xno
+then :
- 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
- ;;
+ PAMLIBS="-lpam -ldl"
- *)
- # All others; this test might need to be updated
- # as Linux distributors move things around...
- 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
- fi
+else $as_nop
+
+ PAMLIBS="-lpam"
+
+fi
+
+ # Find the PAM configuration directory, if any...
+ for dir in /private/etc/pam.d /etc/pam.d; do
+ if test -d $dir
+then :
+
+ PAMDIR="$dir"
+ break;
+
+fi
+ done
+
+fi
+
+ LIBS="$SAVELIBS"
+
+ 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 $as_nop
+
+ PAMFILE="pam.securityserver"
+
+fi
+ ;; #(
+ *) :
+
+ # All others; this test might need to be updated
+ # as Linux distributors move things around...
+ 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 $as_nop
+
+ 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
+
+fi
+
+ if test "x$PAMMOD" = xpam_unix.so
+then :
+
+ PAMMODAUTH="$PAMMOD shadow nodelay"
+
+else $as_nop
+
+ PAMMODAUTH="$PAMMOD nodelay"
+
+fi
+ ;; #(
+ *) :
+ ;;
+esac
- if test "x$PAMMOD" = xpam_unix.so; then
- PAMMODAUTH="$PAMMOD shadow nodelay"
- else
- PAMMODAUTH="$PAMMOD nodelay"
- fi
- ;;
- esac
fi