| From 1d1d3b59af50c40efcc74f9c3f37b446a921e83e Mon Sep 17 00:00:00 2001 |
| From: Yousong Zhou <yszhou4tech@gmail.com> |
| Date: Wed, 17 Jun 2015 18:19:23 +0800 |
| Subject: [PATCH] build: ignore pam_rhosts if neither ruserok nor ruserok_af is |
| available. |
| |
| * configure.ac: check for ruserok and ruserok_af |
| * modules/Makefile.am: ignore pam_rhosts/ if it's disabled |
| * modules/pam_rhosts/pam_rhosts.c: include stdlib.h for malloc and free |
| |
| Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> |
| [Retrieved from: |
| https://github.com/linux-pam/linux-pam/commit/1d1d3b59af50c40efcc74f9c3f37b446a921e83e] |
| Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> |
| --- |
| configure.ac | 5 ++++- |
| modules/Makefile.am | 11 ++++++++--- |
| modules/pam_rhosts/pam_rhosts.c | 1 + |
| 3 files changed, 13 insertions(+), 4 deletions(-) |
| |
| diff --git a/configure.ac b/configure.ac |
| index 3012ceb5..69748614 100644 |
| --- a/configure.ac |
| +++ b/configure.ac |
| @@ -532,7 +532,10 @@ AC_CHECK_FUNCS(fseeko getdomainname gethostname gettimeofday lckpwdf mkdir selec |
| AC_CHECK_FUNCS(strcspn strdup strspn strstr strtol uname) |
| AC_CHECK_FUNCS(getutent_r getpwnam_r getpwuid_r getgrnam_r getgrgid_r getspnam_r) |
| AC_CHECK_FUNCS(getgrouplist getline getdelim) |
| -AC_CHECK_FUNCS(inet_ntop inet_pton innetgr ruserok_af) |
| +AC_CHECK_FUNCS(inet_ntop inet_pton innetgr) |
| +AC_CHECK_FUNCS([ruserok_af ruserok], [break]) |
| + |
| +AM_CONDITIONAL([COND_BUILD_PAM_RHOSTS], [test "$ac_cv_func_ruserok_af" = yes -o "$ac_cv_func_ruserok" = yes]) |
| |
| AC_CHECK_FUNCS(unshare, [UNSHARE=yes], [UNSHARE=no]) |
| AM_CONDITIONAL([HAVE_UNSHARE], [test "$UNSHARE" = yes]) |
| diff --git a/modules/Makefile.am b/modules/Makefile.am |
| index 0c80cea9..9ad26a9b 100644 |
| --- a/modules/Makefile.am |
| +++ b/modules/Makefile.am |
| @@ -2,16 +2,21 @@ |
| # Copyright (c) 2005, 2006, 2008 Thorsten Kukuk <kukuk@thkukuk.de> |
| # |
| |
| -SUBDIRS = pam_access pam_cracklib pam_debug pam_deny pam_echo \ |
| +if COND_BUILD_PAM_RHOSTS |
| + MAYBE_PAM_RHOSTS = pam_rhosts |
| +endif |
| + |
| +SUBDIRS := pam_access pam_cracklib pam_debug pam_deny pam_echo \ |
| pam_env pam_exec pam_faildelay pam_filter pam_ftp \ |
| pam_group pam_issue pam_keyinit pam_lastlog pam_limits \ |
| pam_listfile pam_localuser pam_loginuid pam_mail \ |
| pam_mkhomedir pam_motd pam_namespace pam_nologin \ |
| - pam_permit pam_pwhistory pam_rhosts pam_rootok pam_securetty \ |
| + pam_permit pam_pwhistory pam_rootok pam_securetty \ |
| pam_selinux pam_sepermit pam_shells pam_stress \ |
| pam_succeed_if pam_tally pam_tally2 pam_time pam_timestamp \ |
| pam_tty_audit pam_umask \ |
| - pam_unix pam_userdb pam_warn pam_wheel pam_xauth |
| + pam_unix pam_userdb pam_warn pam_wheel pam_xauth \ |
| + $(MAYBE_PAM_RHOSTS) |
| |
| CLEANFILES = *~ |
| |
| diff --git a/modules/pam_rhosts/pam_rhosts.c b/modules/pam_rhosts/pam_rhosts.c |
| index ed98d630..60c9e854 100644 |
| --- a/modules/pam_rhosts/pam_rhosts.c |
| +++ b/modules/pam_rhosts/pam_rhosts.c |
| @@ -35,6 +35,7 @@ |
| #include <pwd.h> |
| #include <netdb.h> |
| #include <string.h> |
| +#include <stdlib.h> |
| #include <syslog.h> |
| |
| #define PAM_SM_AUTH /* only defines this management group */ |