summaryrefslogtreecommitdiffstats
path: root/login-utils/login.c
diff options
context:
space:
mode:
authorWill Johansson2014-12-10 03:40:31 +0100
committerKarel Zak2014-12-15 10:16:03 +0100
commitfe2c9909cd127b5be0f103b8e633807c6afde000 (patch)
tree6d6b9b36aa0e9884a3785303cbe06a79b6a15c31 /login-utils/login.c
parentlslogins: fix -l -g logic (diff)
downloadkernel-qcow2-util-linux-fe2c9909cd127b5be0f103b8e633807c6afde000.tar.gz
kernel-qcow2-util-linux-fe2c9909cd127b5be0f103b8e633807c6afde000.tar.xz
kernel-qcow2-util-linux-fe2c9909cd127b5be0f103b8e633807c6afde000.zip
login-utils: Enable building util-linux against OpenPAM
OpenPAM is compatible with util-linux, with a few changes, namely using OpenPAM's conversation function, openpam_ttyconv. We check for Linux-PAM by querying for security/pam_misc.h, and OpenPAM by querying for security/openpam.h. Signed-off-by: Will Johansson <will.johansson@gmail.com>
Diffstat (limited to 'login-utils/login.c')
-rw-r--r--login-utils/login.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/login-utils/login.c b/login-utils/login.c
index 554643559..540554e77 100644
--- a/login-utils/login.c
+++ b/login-utils/login.c
@@ -55,7 +55,11 @@
#include <netdb.h>
#include <lastlog.h>
#include <security/pam_appl.h>
-#include <security/pam_misc.h>
+#ifdef HAVE_SECURITY_PAM_MISC_H
+# include <security/pam_misc.h>
+#elif defined(HAVE_SECURITY_OPENPAM_H)
+# include <security/openpam.h>
+#endif
#include <sys/sendfile.h>
#ifdef HAVE_LIBAUDIT
@@ -1124,9 +1128,14 @@ int main(int argc, char **argv)
struct passwd *pwd = NULL, _pwd;
struct login_context cxt = {
- .tty_mode = TTY_MODE, /* tty chmod() */
- .pid = getpid(), /* PID */
- .conv = { misc_conv, NULL } /* PAM conversation function */
+ .tty_mode = TTY_MODE, /* tty chmod() */
+ .pid = getpid(), /* PID */
+#ifdef HAVE_SECURITY_PAM_MISC_H
+ .conv = { misc_conv, NULL } /* Linux-PAM conversation function */
+#elif defined(HAVE_SECURITY_OPENPAM_H)
+ .conv = { openpam_ttyconv, NULL } /* OpenPAM conversation function */
+#endif
+
};
timeout = (unsigned int)getlogindefs_num("LOGIN_TIMEOUT", LOGIN_TIMEOUT);