]> granicus.if.org Git - linux-pam/commitdiff
Relevant BUGIDs: Debian bugs #76119, #165066
authorSteve Langasek <vorlon@debian.org>
Tue, 28 Aug 2007 02:27:17 +0000 (02:27 +0000)
committerSteve Langasek <vorlon@debian.org>
Tue, 28 Aug 2007 02:27:17 +0000 (02:27 +0000)
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.

ChangeLog
configure.in
modules/pam_limits/pam_limits.c
modules/pam_rhosts/pam_rhosts_auth.c
modules/pam_xauth/pam_xauth.c

index 9b777f4da71b4d44bb91165d0511960b6d7298e8..9bfa73412e30fa51a16bf5d6f922798165147b80 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+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.
+
 2007-08-26  Andrew Morgan  <morgan@kernel.org>
 
        * doc/man/pam.conf-syntax.xml
index 4c6a4c81ff39e5ea1600dfb0b4e7f4ef983c3995..856c054c355670681a6d0b8c5feef03ea3626a74 100644 (file)
@@ -396,7 +396,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 sys/fsuid.h inittypes.h)
+AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sys/file.h sys/ioctl.h sys/time.h syslog.h net/if.h termio.h unistd.h sys/fsuid.h inittypes.h)
 
 AC_CHECK_HEADERS(crypt.h)
 
index a4bc727fd93fc71e023861643dc38c3b5faafc36..961a7ad05f484cbd98dbfaa2319b861116837aaf 100644 (file)
@@ -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"
@@ -281,8 +281,10 @@ process_limit (const pam_handle_t *pamh, int source, const char *lim_type,
        limit_item = RLIMIT_NOFILE;
     else if (strcmp(lim_item, "memlock") == 0)
        limit_item = RLIMIT_MEMLOCK;
+#ifdef RLIMIT_AS
     else if (strcmp(lim_item, "as") == 0)
        limit_item = RLIMIT_AS;
+#endif /*RLIMIT_AS*/
 #ifdef RLIMIT_LOCKS
     else if (strcmp(lim_item, "locks") == 0)
        limit_item = RLIMIT_LOCKS;
@@ -389,7 +391,9 @@ process_limit (const pam_handle_t *pamh, int source, const char *lim_type,
         case RLIMIT_CORE:
         case RLIMIT_RSS:
         case RLIMIT_MEMLOCK:
+#ifdef RLIMIT_AS
         case RLIMIT_AS:
+#endif
          if (rlimit_value != RLIM_INFINITY)
           {
             if (rlimit_value >= RLIM_INFINITY/1024)
index b2248ccb996ad6c26e78feb3fe03b91eb60c5a4b..d50ed478965ee442d5bbb04516f598cd3b635cac 100644 (file)
 #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;
 }
 
 /*
index 3772bd061db3739fbc7443d9e4833572d5c6bfed..153210f101a94232bb267685dd5a5115d8db1b47 100644 (file)
 #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