File: cups-pam.m4

package info (click to toggle)
cups 2.4.16-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 33,500 kB
  • sloc: ansic: 159,650; cpp: 8,595; sh: 5,475; makefile: 2,770; php: 17; python: 10
file content (106 lines) | stat: -rw-r--r-- 2,793 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
dnl
dnl PAM stuff for CUPS.
dnl
dnl Copyright © 2020-2024 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
dnl information.
dnl

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"
PAMLIBS=""
PAMMOD="pam_unknown.so"
PAMMODAUTH="pam_unknown.so"

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], [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?])
	])
    ])

    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
	    AS_IF([test -d $dir], [
		PAMDIR="$dir"
		break;
	    ])
	done
    ])

    LIBS="$SAVELIBS"

    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"
	], [test -f /etc/pam.d/password-auth], [
	    PAMFILE="pam.password"
	], [test -f /etc/pam.d/system-auth], [
	    PAMFILE="pam.system"
	], [
	    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

	    AS_IF([test -f $moddir/pam_unix2.so], [
		PAMMOD="pam_unix2.so"
	    ], [test -f $moddir/pam_unix.so], [
		PAMMOD="pam_unix.so"
	    ])
	])

	AS_IF([test "x$PAMMOD" = xpam_unix.so], [
	    PAMMODAUTH="$PAMMOD shadow nodelay"
	], [
	    PAMMODAUTH="$PAMMOD nodelay"
	])
    ])
])

AC_SUBST([PAMDIR])
AC_SUBST([PAMFILE])
AC_SUBST([PAMLIBS])
AC_SUBST([PAMMOD])
AC_SUBST([PAMMODAUTH])