From 1fac2c4937dae665d2f85628f861e8f4bdda4da8 Mon Sep 17 00:00:00 2001 From: "Andrew G. Morgan" Date: Tue, 13 Nov 2001 05:07:24 +0000 Subject: [PATCH 1/1] Relevant BUGIDs: 476986 Purpose of commit: new feature, cleanup Commit summary: --------------- patch from Nalin to support '+hostname' as equivalent to 'hostname'. fixed compiler warning by working out when to include header file. --- CHANGELOG | 2 ++ _pam_aconf.h.in | 4 ++++ configure | 2 +- configure.in | 2 +- modules/pam_rhosts/pam_rhosts_auth.c | 10 +++++++--- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 89d9989a..288873f9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -49,6 +49,8 @@ bug report - outstanding bugs are listed here: 0.76: please submit patches for this section with actual code/doc patches! +* pam_rhosts: Nalin adds support for '+hostname', and zdd fix + compilation warning. (Bug 476986 - agmorgan) * pam_motd: Nalin fixed compiler warning. (Bug 476938 - agmorgan) * pam_pwdb: Solar Designer pointed out that there was a problem with the compatibility support for md5 password hashing. (Bug 460717, diff --git a/_pam_aconf.h.in b/_pam_aconf.h.in index baa97170..1b2cea75 100644 --- a/_pam_aconf.h.in +++ b/_pam_aconf.h.in @@ -79,4 +79,8 @@ /* location of the mail spool directory */ #undef PAM_PATH_MAILDIR +/* where should we include setfsuid's prototype from? If this is not + defined, we get it from unistd.h */ +#undef HAVE_SYS_FSUID_H + #endif /* PAM_ACONF_H */ diff --git a/configure b/configure index 813c1e5a..f4b21869 100755 --- a/configure +++ b/configure @@ -2124,7 +2124,7 @@ EOF fi -for ac_hdr in fcntl.h limits.h malloc.h sys/file.h sys/ioctl.h sys/time.h syslog.h termio.h unistd.h +for ac_hdr in fcntl.h limits.h malloc.h sys/file.h sys/ioctl.h sys/time.h syslog.h termio.h unistd.h sys/fsuid.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 diff --git a/configure.in b/configure.in index 0227c412..0f5b8d89 100644 --- a/configure.in +++ b/configure.in @@ -222,7 +222,7 @@ dnl Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sys/file.h sys/ioctl.h sys/time.h syslog.h termio.h unistd.h) +AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sys/file.h sys/ioctl.h sys/time.h syslog.h termio.h unistd.h sys/fsuid.h) dnl Linux wants features.h in some of the source files. AC_CHECK_HEADERS(features.h) diff --git a/modules/pam_rhosts/pam_rhosts_auth.c b/modules/pam_rhosts/pam_rhosts_auth.c index b633a529..7ee77f1d 100644 --- a/modules/pam_rhosts/pam_rhosts_auth.c +++ b/modules/pam_rhosts/pam_rhosts_auth.c @@ -38,7 +38,7 @@ * SUCH DAMAGE. */ -#define _BSD_SOURCE +#include #define USER_RHOSTS_FILE "/.rhosts" /* prefixed by user's home dir */ @@ -46,9 +46,9 @@ #include #endif -#ifdef NEED_FSUID_H +#ifdef HAVE_SYS_FSUID_H #include -#endif /* NEED_FSUID_H */ +#endif /* HAVE_SYS_FSUID_H */ #include #include @@ -282,8 +282,12 @@ __icheckhost (pam_handle_t *pamh, struct _options *opts, U32 raddr return (1); /* asking for trouble, but ok.. */ /* If not promiscuous: handle as negative */ return (-1); + } else if (strncmp("+",lhost,1) == 0) { + /* '+hostname' is supposed to be equivalent to 'hostname' */ + lhost++; } + /* Try for raw ip address first. */ if (isdigit(*lhost) && (long)(laddr = inet_addr(lhost)) != -1) return (negate*(! (raddr ^ laddr))); -- 2.40.0