summaryrefslogtreecommitdiff
path: root/patches-applied/038_support_hurd
blob: 52e0432702f84cdff11744b14e38ca164e843596 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
Prefer using getline() instead of a static buffer; makes pam_rhosts
portable to Hurd.

Authors: Michal 'hramrach' Suchanek" <hramrach_l@centrum.cz>,
         Steve Langasek <vorlon@debian.org>

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