]> granicus.if.org Git - shadow/commitdiff
* README, NEWS, configure.in, lib/pam_defs.h, src/login.c: Add
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Mon, 21 Jul 2008 21:14:06 +0000 (21:14 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Mon, 21 Jul 2008 21:14:06 +0000 (21:14 +0000)
support for OpenPAM.

ChangeLog
NEWS
README
configure.in
lib/pam_defs.h
src/login.c

index f58483856f3a8e3e3e642b6ce941724d0d08b5bc..a4d4e0d11b510511ee9df8ea9a1a2e56ab3a2580 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-21  Seraphim Mellos  <mellos@ceid.upatras.gr>
+
+       * README, NEWS, configure.in, lib/pam_defs.h, src/login.c: Add
+       support for OpenPAM.
+
 2008-07-12  Nicolas François  <nicolas.francois@centraliens.net>
 
        * src/chage.c: Ignore the return value of pam_end() before exiting.
diff --git a/NEWS b/NEWS
index 948286434155fe3935b2db3da195ec6ce4d439a5..a4de84965ea4ba2d39d7c3da4efd6b55d50ef7da 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ $Id$
 shadow-4.1.2.1 -> shadow-4.1.3                                         UNRELEASED
 
 *** general:
+- packaging
+  * Added support for OpenPAM.
 - newusers
   * Implement the -r, --system option.
 - usermod
diff --git a/README b/README
index 88e7346457e4b2a72bcc6612426cc16c4b3e1738..16128cf26ee8f6dac18ffc03f6d1dd042d2e8560 100644 (file)
--- a/README
+++ b/README
@@ -91,6 +91,7 @@ Phillip Street
 Rafał Maszkowski <rzm@icm.edu.pl>
 Rani Chouha <ranibey@smartec.com>
 Sami Kerola <kerolasa@rocketmail.com>
+Seraphim Mellos  <mellos@ceid.upatras.gr>
 Shane Watts <shane@nexus.mlckew.edu.au>
 Steve M. Robbins <steve@nyongwa.montreal.qc.ca>
 Thorsten Kukuk <kukuk@suse.de>
index c2c580a1bd95e507b496a266a04b7c6fdc3cacb9..6e88b6731bf72fe83100d6dbb162dd69e72d594b 100644 (file)
@@ -340,13 +340,29 @@ if test "$with_libpam" != "no"; then
                AC_MSG_ERROR(libpam not found)
        fi
 
-       AC_CHECK_LIB(pam_misc, main,
-                    [pam_misc_lib="yes"], [pam_misc_lib="no"])
-       if test "$pam_misc_lib$with_libpam" = "noyes" ; then
-               AC_MSG_ERROR(libpam_misc not found)
+       LIBPAM="-lpam"
+       pam_conv_function="no"
+
+       AC_CHECK_LIB(pam, openpam_ttyconv,
+               [pam_conv_function="openpam_ttyconv"],
+               AC_CHECK_LIB(pam_misc, misc_conv,
+                       [pam_conv_function="misc_conv"; LIBPAM="$LIBPAM -lpam_misc"])
+               )
+
+       if test "$pam_conv_function$with_libpam" = "noyes" ; then
+               AC_MSG_ERROR(PAM conversation function not found)
        fi
 
-       if test "$pam_lib$pam_misc_lib" = "yesyes" ; then
+       pam_headers_found=no
+       AC_CHECK_HEADERS( [security/openpam.h security/pam_misc.h],
+                        [ pam_headers_found=yes ; break ], [],
+                        [ #include <security/pam_appl.h> ] )
+        if test "$pam_headers_found$with_libpam" = "noyes" ; then
+                       AC_MSG_ERROR(PAM headers not found)
+        fi
+
+
+       if test "$pam_lib$pam_headers_found" = "yesyes" -a "$pam_conv_function" != "no" ; then
                with_libpam="yes"
        else
                with_libpam="no"
@@ -354,9 +370,22 @@ if test "$with_libpam" != "no"; then
 fi
 dnl Now with_libpam is either yes or no
 if test "$with_libpam" = "yes"; then
+       AC_CHECK_DECLS([PAM_ESTABLISH_CRED,
+               PAM_DELETE_CRED,
+               PAM_NEW_AUTHTOK_REQD,
+               PAM_DATA_SILENT],
+               [], [], [#include <security/pam_appl.h>])
+
+
+       save_libs=$LIBS
+        LIBS="$LIBS $LIBPAM"
+       AC_CHECK_FUNCS([pam_fail_delay])
+       LIBS=$save_libs
+
        AC_DEFINE(USE_PAM, 1, [Define to support Pluggable Authentication Modules])
+       AC_DEFINE_UNQUOTED(SHADOW_PAM_CONVERSATION, [$pam_conv_function],[PAM converstation to use])
        AM_CONDITIONAL(USE_PAM, [true])
-       LIBPAM="-lpam -lpam_misc"
+
        AC_MSG_CHECKING(use login and su access checking if PAM not used)
        AC_MSG_RESULT(no)
 else
index 23a399a0d22fa777537997f1d676d28f763bac11..343fbb453e79f97827f3b8217f96ab7ff6293d18 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <config.h>
 #include <security/pam_appl.h>
-#include <security/pam_misc.h>
+#ifdef HAVE_SECURITY_PAM_MISC_H
+# include <security/pam_misc.h>
+#endif
+#ifdef HAVE_SECURITY_OPENPAM_H
+# include <security/openpam.h>
+#endif
+
 
 static struct pam_conv conv = {
-       misc_conv,
+       SHADOW_PAM_CONVERSATION,
        NULL
 };
 
 /* compatibility with different versions of Linux-PAM */
-#ifndef PAM_ESTABLISH_CRED
+#if !HAVE_DECL_PAM_ESTABLISH_CRED
 #define PAM_ESTABLISH_CRED PAM_CRED_ESTABLISH
 #endif
-#ifndef PAM_DELETE_CRED
+#if !HAVE_DECL_PAM_DELETE_CRED
 #define PAM_DELETE_CRED PAM_CRED_DELETE
 #endif
-#ifndef PAM_NEW_AUTHTOK_REQD
+#if !HAVE_DECL_PAM_NEW_AUTHTOK_REQD
 #define PAM_NEW_AUTHTOK_REQD PAM_AUTHTOKEN_REQD
 #endif
-#ifndef PAM_DATA_SILENT
+#if !HAVE_DECL_PAM_DATA_SILENT
 #define PAM_DATA_SILENT 0
 #endif
index f23e185181209a46329e6cf5fd4a360c47d23af3..6344a9d494fefff4f282854cab40cae92b0fb321 100644 (file)
@@ -691,9 +691,11 @@ int main (int argc, char **argv)
                          failed = false;
 
                          failcount++;
+#ifdef HAVE_PAM_FAIL_DELAY
                          if (delay > 0) {
                            retcode = pam_fail_delay(pamh, 1000000*delay);
                          }
+#endif
 
                          retcode = pam_authenticate (pamh, 0);