diff options
Diffstat (limited to 'Linux-PAM/modules/pam_rhosts')
-rw-r--r-- | Linux-PAM/modules/pam_rhosts/Makefile.am | 5 | ||||
-rw-r--r-- | Linux-PAM/modules/pam_rhosts/Makefile.in | 10 | ||||
-rw-r--r-- | Linux-PAM/modules/pam_rhosts/pam_rhosts_auth.c | 31 |
3 files changed, 29 insertions, 17 deletions
diff --git a/Linux-PAM/modules/pam_rhosts/Makefile.am b/Linux-PAM/modules/pam_rhosts/Makefile.am index d4ca7578..26fdf9c6 100644 --- a/Linux-PAM/modules/pam_rhosts/Makefile.am +++ b/Linux-PAM/modules/pam_rhosts/Makefile.am @@ -16,13 +16,14 @@ securelibdir = $(SECUREDIR) secureconfdir = $(SCONFIGDIR) AM_CFLAGS = -I$(top_srcdir)/libpam/include -I$(top_srcdir)/libpamc/include -AM_LDFLAGS = -no-undefined -avoid-version -module \ - -L$(top_builddir)/libpam -lpam +AM_LDFLAGS = -no-undefined -avoid-version -module if HAVE_VERSIONING AM_LDFLAGS += -Wl,--version-script=$(srcdir)/../modules.map endif securelib_LTLIBRARIES = pam_rhosts_auth.la pam_rhosts.la +pam_rhosts_auth_la_LIBADD = -L$(top_builddir)/libpam -lpam +pam_rhosts_la_LIBADD = -L$(top_builddir)/libpam -lpam if ENABLE_REGENERATE_MAN noinst_DATA = README diff --git a/Linux-PAM/modules/pam_rhosts/Makefile.in b/Linux-PAM/modules/pam_rhosts/Makefile.in index 138a1195..99415320 100644 --- a/Linux-PAM/modules/pam_rhosts/Makefile.in +++ b/Linux-PAM/modules/pam_rhosts/Makefile.in @@ -64,10 +64,10 @@ am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(securelibdir)" "$(DESTDIR)$(man8dir)" securelibLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(securelib_LTLIBRARIES) -pam_rhosts_la_LIBADD = +pam_rhosts_la_DEPENDENCIES = pam_rhosts_la_SOURCES = pam_rhosts.c pam_rhosts_la_OBJECTS = pam_rhosts.lo -pam_rhosts_auth_la_LIBADD = +pam_rhosts_auth_la_DEPENDENCIES = pam_rhosts_auth_la_SOURCES = pam_rhosts_auth.c pam_rhosts_auth_la_OBJECTS = pam_rhosts_auth.lo DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ @@ -178,6 +178,7 @@ POSUB = @POSUB@ RANLIB = @RANLIB@ SCONFIGDIR = @SCONFIGDIR@ SECUREDIR = @SECUREDIR@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -255,9 +256,10 @@ XMLS = README.xml pam_rhosts.8.xml securelibdir = $(SECUREDIR) secureconfdir = $(SCONFIGDIR) AM_CFLAGS = -I$(top_srcdir)/libpam/include -I$(top_srcdir)/libpamc/include -AM_LDFLAGS = -no-undefined -avoid-version -module \ - -L$(top_builddir)/libpam -lpam $(am__append_1) +AM_LDFLAGS = -no-undefined -avoid-version -module $(am__append_1) securelib_LTLIBRARIES = pam_rhosts_auth.la pam_rhosts.la +pam_rhosts_auth_la_LIBADD = -L$(top_builddir)/libpam -lpam +pam_rhosts_la_LIBADD = -L$(top_builddir)/libpam -lpam @ENABLE_REGENERATE_MAN_TRUE@noinst_DATA = README all: all-am diff --git a/Linux-PAM/modules/pam_rhosts/pam_rhosts_auth.c b/Linux-PAM/modules/pam_rhosts/pam_rhosts_auth.c index b2248ccb..48fdeced 100644 --- a/Linux-PAM/modules/pam_rhosts/pam_rhosts_auth.c +++ b/Linux-PAM/modules/pam_rhosts/pam_rhosts_auth.c @@ -64,11 +64,10 @@ #include <sys/fsuid.h> #endif /* HAVE_SYS_FSUID_H */ #ifdef HAVE_NET_IF_H -#include <sys/if.h> +#include <net/if.h> #endif #include <sys/types.h> #include <sys/uio.h> -#include <net/if.h> #include <netinet/in.h> #ifndef MAXDNAME @@ -268,7 +267,7 @@ __icheckhost (pam_handle_t *pamh, struct _options *opts, u_int32_t raddr /* Try for raw ip address first. */ - if (isdigit(*lhost) && (long)(laddr = inet_addr(lhost)) != -1) + if (isdigit(*lhost) && (int32_t)(laddr = inet_addr(lhost) != -1)) return (negate*(! (raddr ^ laddr))); /* Better be a hostname. */ @@ -294,7 +293,6 @@ __icheckuser (pam_handle_t *pamh, struct _options *opts, /* luser is user entry from .rhosts/hosts.equiv file ruser is user id on remote host - rhost is the remote host name */ const void *user; @@ -349,11 +347,17 @@ __ivaliduser (pam_handle_t *pamh, struct _options *opts, register const char *user; register char *p; int hcheck, ucheck; - char buf[MAXHOSTNAMELEN + 128]; /* host + login */ + int retval = 1; +#ifdef HAVE_GETLINE + char *buf=NULL; + size_t buflen=0; - buf[sizeof (buf)-1] = '\0'; /* terminate line */ + while (getline(&buf,&buflen,hostf) > 0) { +#else + char buf[MAXHOSTNAMELEN + 128]; /* host + login */ while (fgets(buf, sizeof(buf), hostf) != NULL) { /* hostf file line */ +#endif p = buf; /* from beginning of file.. */ /* Skip empty or comment lines */ @@ -402,7 +406,7 @@ __ivaliduser (pam_handle_t *pamh, struct _options *opts, hcheck=__icheckhost(pamh, opts, raddr, buf, rhost); if (hcheck<0) - return(1); + break; if (hcheck) { /* Then check user part */ @@ -412,18 +416,23 @@ __ivaliduser (pam_handle_t *pamh, struct _options *opts, ucheck=__icheckuser(pamh, opts, user, ruser); /* Positive 'host user' match? */ - if (ucheck>0) - return(0); + if (ucheck>0) { + retval = 0; + break; + } /* Negative 'host -user' match? */ if (ucheck<0) - return(1); + break; /* Neither, go on looking for match */ } } +#ifdef HAVE_GETLINE + if(buf)free(buf); +#endif - return (1); + return retval; } /* |