diff options
author | Steve Langasek <vorlon@debian.org> | 2007-08-28 02:27:17 +0000 |
---|---|---|
committer | Steve Langasek <vorlon@debian.org> | 2007-08-28 02:27:17 +0000 |
commit | af0308708c9308953542815f9e3a9dce7db09edc (patch) | |
tree | 74d06f5fc8a9878a0c80ff7e03e8c532c3b6cadf /modules/pam_rhosts | |
parent | bf7ac853c1d6b9ba2949ef9547230c4d59f7ee13 (diff) | |
download | pam-af0308708c9308953542815f9e3a9dce7db09edc.tar.gz pam-af0308708c9308953542815f9e3a9dce7db09edc.tar.bz2 pam-af0308708c9308953542815f9e3a9dce7db09edc.zip |
Relevant BUGIDs: Debian bugs #76119, #165066
Purpose of commit: portability
Commit summary:
---------------
2007-08-27 Steve Langasek <vorlon@debian.org>
* modules/pam_limits/pam_limits.c: when building on non-Linux
systems, give a warning only, not an error; no one seems to
remember why this error was here in the first place, but leave
something in that might still grab the attention of non-Linux
users.
Patch from Michal Suchanek <hramrach_l@centrum.cz>.
* configure.in, modules/pam_rhosts/pam_rhosts_auth.c: check for
the presence of net/if.h before using, required for Hurd
compatibility.
Patch from Igor Khavkine <i_khavki@alcor.concordia.ca>.
* modules/pam_limits/pam_limits.c: conditionalize the use of
RLIMIT_AS, which is not present on the Hurd.
Patch from Igor Khavkine <i_khavki@alcor.concordia.ca>.
* modules/pam_rhosts/pam_rhosts_auth.c: use getline() instead of
a static buffer when available; fixes the build on systems
without MAXHOSTNAMELEN (i.e., the Hurd).
* modules/pam_xauth/pam_xauth.c: make sure PATH_MAX is defined
before using it.
Diffstat (limited to 'modules/pam_rhosts')
-rw-r--r-- | modules/pam_rhosts/pam_rhosts_auth.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/modules/pam_rhosts/pam_rhosts_auth.c b/modules/pam_rhosts/pam_rhosts_auth.c index b2248ccb..d50ed478 100644 --- a/modules/pam_rhosts/pam_rhosts_auth.c +++ b/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 @@ -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; + int buflen=0; - buf[sizeof (buf)-1] = '\0'; /* terminate line */ + while (getline(&buf,&buflen,hostf)) { +#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; } /* |