0002-Conditionally-compile-per-ruserok-availability.patch 1.68 KB
ruserok is not available/functional in uclibc, provide conditions
for compilation where needed.

Patch originally by Dmitry Golubovsky <golubovsky@gmail.com> -
porting to linux-pam 1.2.1.

Signed-off-by: Brendan Heading <brendanheading@gmail.com>

Upstream-status: pending

---
 configure.ac                    | 2 +-
 modules/pam_rhosts/pam_rhosts.c | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 08e4530..fd2fd23 100644
--- a/configure.ac
+++ b/configure.ac
@@ -542,7 +542,7 @@ 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 ruserok_af ruserok)
 
 AC_CHECK_FUNCS(unshare, [UNSHARE=yes], [UNSHARE=no])
 AM_CONDITIONAL([HAVE_UNSHARE], [test "$UNSHARE" = yes])
diff --git a/modules/pam_rhosts/pam_rhosts.c b/modules/pam_rhosts/pam_rhosts.c
index bc9e76f..909db29 100644
--- a/modules/pam_rhosts/pam_rhosts.c
+++ b/modules/pam_rhosts/pam_rhosts.c
@@ -114,8 +114,12 @@ int pam_sm_authenticate (pam_handle_t *pamh, int flags, int argc,
 #ifdef HAVE_RUSEROK_AF
     retval = ruserok_af (rhost, as_root, ruser, luser, PF_UNSPEC);
 #else
+  #ifdef HAVE_RUSEROK
     retval = ruserok (rhost, as_root, ruser, luser);
-#endif
+  #else
+    retval = -1;
+  #endif  /* HAVE_RUSEROK */
+#endif  /*HAVE_RUSEROK_AF */
     if (retval != 0) {
       if (!opt_silent || opt_debug)
 	pam_syslog(pamh, LOG_WARNING, "denied access to %s@%s as %s",
-- 
2.4.3