s3: PAM_RHOST and PAM_TTY are enums on FreeBSD
authorVolker Lendecke <vl@samba.org>
Mon, 23 Aug 2010 19:00:27 +0000 (21:00 +0200)
committerJeremy Allison <jra@samba.org>
Mon, 23 Aug 2010 23:26:36 +0000 (16:26 -0700)
(cherry picked from commit a16a56f60156b3284f9acef9a675122b36ebf7dc)

source3/auth/pampass.c
source3/configure.in

index e08670f481751add0301463e3dd77afc325f9bb5..d509092fea3e4d2bc2a3fc78ba527a1ed049133b 100644 (file)
@@ -477,7 +477,7 @@ static bool smb_pam_start(pam_handle_t **pamh, const char *user, const char *rho
                return False;
        }
 
-#ifdef PAM_RHOST
+#if HAVE_PAM_RHOST
        if (rhost == NULL) {
                our_rhost = client_name(get_client_fd());
                if (strequal(our_rhost,"UNKNOWN"))
@@ -494,7 +494,7 @@ static bool smb_pam_start(pam_handle_t **pamh, const char *user, const char *rho
                return False;
        }
 #endif
-#ifdef PAM_TTY
+#if HAVE_PAM_TTY
        DEBUG(4,("smb_pam_start: PAM: setting tty\n"));
        pam_error = pam_set_item(*pamh, PAM_TTY, "samba");
        if (!smb_pam_error_handler(*pamh, pam_error, "set tty failed", 0)) {
@@ -639,7 +639,7 @@ static bool smb_internal_pam_session(pam_handle_t *pamh, const char *user, const
 {
        int pam_error;
 
-#ifdef PAM_TTY
+#if HAVE_PAM_TTY
        DEBUG(4,("smb_internal_pam_session: PAM: tty set to: %s\n", tty));
        pam_error = pam_set_item(pamh, PAM_TTY, tty);
        if (!smb_pam_error_handler(pamh, pam_error, "set tty failed", 0))
index e8a54178885421111f1f650b7d3c66d738ebbfd1..73819b4d266799ca4e35b39515ded122bf2bcb71 100644 (file)
@@ -4582,6 +4582,29 @@ if test x"${try_pam}" != x"no";then
 
        AC_MSG_CHECKING(whether to have PAM MODULES support)
        AC_MSG_RESULT([$create_pam_modules])
+
+       AC_TRY_COMPILE([
+               #if defined(HAVE_SECURITY_PAM_APPL_H)
+               #include <security/pam_appl.h>
+               #elif defined(HAVE_PAM_PAM_APPL_H)
+               #include <pam/pam_appl.h>
+               #endif],[
+               pam_set_item(0, PAM_RHOST, 0);
+               ],
+               AC_DEFINE(HAVE_PAM_RHOST, 1,
+                         [Define to 1 if PAM_RHOST is available]),[])
+
+       AC_TRY_COMPILE([
+               #if defined(HAVE_SECURITY_PAM_APPL_H)
+               #include <security/pam_appl.h>
+               #elif defined(HAVE_PAM_PAM_APPL_H)
+               #include <pam/pam_appl.h>
+               #endif],[
+               pam_set_item(0, PAM_TTY, 0);
+               ],
+               AC_DEFINE(HAVE_PAM_TTY, 1,
+                         [Define to 1 if PAM_TTY is available]),[])
+
 fi # try_pam != no
 
 #################################################