From fe2c9909cd127b5be0f103b8e633807c6afde000 Mon Sep 17 00:00:00 2001 From: Will Johansson Date: Tue, 9 Dec 2014 18:40:31 -0800 Subject: 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 --- login-utils/login.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'login-utils/login.c') 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 #include #include -#include +#ifdef HAVE_SECURITY_PAM_MISC_H +# include +#elif defined(HAVE_SECURITY_OPENPAM_H) +# include +#endif #include #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); -- cgit v1.2.3-55-g7522