diff options
author | Steve Langasek <steve.langasek@ubuntu.com> | 2019-01-03 16:09:38 -0800 |
---|---|---|
committer | Steve Langasek <steve.langasek@ubuntu.com> | 2019-01-03 16:09:38 -0800 |
commit | 03398c56c56ed427818d2ce879d45d1009f7d46b (patch) | |
tree | 9a7bc0d7d15ac988ac9ad31ad18a769030faced7 /Linux-PAM/modules/pam_rhosts/pam_rhosts_auth.c | |
parent | e78677298d54010c3a62b932baefdae152fd0fed (diff) | |
parent | 281e859131adad49301befbc50cfc5cd282c6937 (diff) | |
download | pam-03398c56c56ed427818d2ce879d45d1009f7d46b.tar.gz pam-03398c56c56ed427818d2ce879d45d1009f7d46b.tar.bz2 pam-03398c56c56ed427818d2ce879d45d1009f7d46b.zip |
merge upstream version 0.99.9.0
Diffstat (limited to 'Linux-PAM/modules/pam_rhosts/pam_rhosts_auth.c')
-rw-r--r-- | Linux-PAM/modules/pam_rhosts/pam_rhosts_auth.c | 31 |
1 files changed, 20 insertions, 11 deletions
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; } /* |