]> arthur.barton.de Git - netatalk.git/blob - macros/pam-check.m4
Remove variable expansion for BSD printers. Fixes CVE-2008-5718.
[netatalk.git] / macros / pam-check.m4
1 dnl $Id: pam-check.m4,v 1.2.10.3 2004-04-04 17:44:18 bfernhomberg Exp $
2 dnl PAM finding macro
3
4 AC_DEFUN([AC_PATH_PAM], [
5         AC_ARG_WITH(pam, [  --with-pam[[=PATH]]       specify path to PAM installation [[auto]]],
6                 [
7                         require_pam="yes"
8                         if test "x$withval" = "xno"; then
9                                 PAMDIR="NONE"
10                                 require_pam="never"
11                         elif test "x$withval" = "xyes"; then
12                                 PAMDIR="NONE"
13                         else
14                                 PAMDIR="$withval"
15                         fi
16                 ],
17                 [PAMDIR="NONE";require_pam="no"]
18         )
19
20         AC_MSG_CHECKING([for PAM installation directory])
21         if test "$host_os" != "solaris"; then
22                 if test "x$PAMDIR" = "xNONE" -a "x$require_pam" != "xnever"; then
23                   dnl Test for PAM
24                   pam_paths="/ /usr/ /usr/local/"
25                   for path in $pam_paths; do
26                         if test -d "${path}etc/pam.d"; then
27                                 PAMDIR="$path"
28                                 break
29                         fi
30                   done
31                 fi
32
33                 if test "x$PAMDIR" != "xNONE"; then
34                         AC_MSG_RESULT([yes (path: ${PAMDIR}etc/pam.d)])
35                 else
36                         AC_MSG_RESULT([no])
37                 fi
38         else
39                 AC_MSG_RESULT([/etc/pam.conf (solaris)])
40         fi
41                 
42         pam_found="no"
43         if test "x$require_pam" != "xnever"; then
44
45                 savedCFLAGS="$CFLAGS"
46                 savedLDFLAGS="$LDFLAGS"
47                 savedLIBS="$LIBS"
48
49                 if test "x$PAMDIR" != "xNONE" -a "x$PAMDIR" != "x/"; then
50                         PAM_CFLAGS="-I${PAMDIR}include"
51                         PAM_LDFLAGS="-L${PAMDIR}lib"
52                         LDFLAGS="$LDFLAGS $PAM_LDFLAGS"
53                         CFLAGS="$CFLAGS $PAM_CFLAGS"
54                 fi
55
56                 AC_CHECK_HEADERS(security/pam_appl.h pam/pam_appl.h)
57
58                 if test x"$ac_cv_header_security_pam_appl_h" = x"no" -a x"$ac_cv_header_pam_pam_appl_h" = x"no"; then
59                         pam_found=no
60                 else
61                         AC_CHECK_LIB(pam, pam_set_item, [
62                                 PAM_LIBS="$PAM_LDFLAGS -lpam"
63                                 pam_found="yes"
64                         ])
65                 fi
66                 CFLAGS="$savedCFLAGS"
67                 LDFLAGS="$savedLDFLAGS"
68                 LIBS="$savedLIBS"
69         fi
70
71         netatalk_cv_install_pam=yes
72         if test x"$pam_found" = "xyes" -a "x$PAMDIR" = "xNONE"; then
73                 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.])
74                 netatalk_cv_install_pam=no
75         fi
76
77         AC_MSG_CHECKING([whether to enable PAM support])
78         if test "x$pam_found" = "xno"; then
79                 if test "x$require_pam" = "xyes"; then
80                         AC_MSG_ERROR([PAM support missing])
81                 else
82                         AC_MSG_RESULT([no])
83                 fi
84                 ifelse([$2], , :, [$2])
85         else
86                 AC_MSG_RESULT([yes])
87                 ifelse([$1], , :, [$1])
88         fi
89
90         LIB_REMOVE_USR_LIB(PAM_LIBS)
91         CFLAGS_REMOVE_USR_INCLUDE(PAM_CFLAGS)
92         AC_SUBST(PAMDIR)
93         AC_SUBST(PAM_CFLAGS)
94         AC_SUBST(PAM_LIBS)
95 ])