Prefer using getline() instead of a static buffer; makes pam_rhosts portable to Hurd. Authors: Michal 'hramrach' Suchanek" , Steve Langasek Upstream status: committed to CVS. Index: Linux-PAM/modules/pam_rhosts/pam_rhosts_auth.c =================================================================== --- Linux-PAM/modules/pam_rhosts/pam_rhosts_auth.c.orig +++ Linux-PAM/modules/pam_rhosts/pam_rhosts_auth.c @@ -293,7 +293,6 @@ /* 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; @@ -348,11 +347,17 @@ 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 */ @@ -401,7 +406,7 @@ hcheck=__icheckhost(pamh, opts, raddr, buf, rhost); if (hcheck<0) - return(1); + break; if (hcheck) { /* Then check user part */ @@ -411,18 +416,23 @@ 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; } /* Index: Linux-PAM/modules/pam_limits/pam_limits.c =================================================================== --- Linux-PAM/modules/pam_limits/pam_limits.c.orig +++ Linux-PAM/modules/pam_limits/pam_limits.c @@ -14,7 +14,7 @@ */ #if !defined(linux) && !defined(__linux) -#error THIS CODE IS KNOWN TO WORK ONLY ON LINUX !!! +#warning THIS CODE IS KNOWN TO WORK ONLY ON LINUX !!! #endif #include "config.h" Index: Linux-PAM/modules/pam_xauth/pam_xauth.c =================================================================== --- Linux-PAM/modules/pam_xauth/pam_xauth.c.orig +++ Linux-PAM/modules/pam_xauth/pam_xauth.c @@ -63,6 +63,11 @@ #define XAUTHDEF ".Xauthority" #define XAUTHTMP ".xauthXXXXXX" +/* Hurd compatibility */ +#ifndef PATH_MAX +#define PATH_MAX 4096 +#endif + /* Possible paths to xauth executable */ static const char * const xauthpaths[] = { #ifdef PAM_PATH_XAUTH