~ubuntu-branches/ubuntu/breezy/pam/breezy

« back to all changes in this revision

Viewing changes to debian/patches/020_hurd

  • Committer: Bazaar Package Importer
  • Author(s): Sam Hartman
  • Date: 2004-06-28 14:28:08 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040628142808-adikk7vtfg3pzcjw
Tags: 0.76-22
* Add uploaders
* Document location of repository
* Fix options containing arguments in pam_unix, Closes: #254904

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
diff -urN Linux-PAM-0.72.orig/modules/pam_filter/pam_filter.c Linux-PAM-0.72/modules/pam_filter/pam_filter.c
2
 
--- Linux-PAM-0.72.orig/modules/pam_filter/pam_filter.c Sun Dec 31 05:06:58 2000
3
 
+++ Linux-PAM-0.72/modules/pam_filter/pam_filter.c      Sun Dec 31 05:11:05 2000
4
 
@@ -19,7 +19,7 @@
5
 
 #include <sys/stat.h>
6
 
 #include <sys/socket.h>
7
 
 #include <sys/ioctl.h>
8
 
-#include <termio.h>
9
 
+#include <termios.h>
10
 
 
11
 
 #include <signal.h>
12
 
 
13
 
@@ -276,7 +276,7 @@
14
 
 {
15
 
     int status=-1;
16
 
     char terminal[TERMINAL_LEN];
17
 
-    struct termio stored_mode;           /* initial terminal mode settings */
18
 
+    struct termios stored_mode;           /* initial terminal mode settings */
19
 
     int fd[2], child=0, child2=0, aterminal;
20
 
 
21
 
     if (filtername == NULL || *filtername != '/') {
22
 
@@ -305,13 +305,13 @@
23
 
 
24
 
        /* this is termio terminal handling... */
25
 
 
26
 
-       if (ioctl(STDIN_FILENO, TCGETA, (char *) &stored_mode ) < 0) {
27
 
+       if (tcgetattr(STDIN_FILENO, &stored_mode) < 0) {
28
 
            /* in trouble, so close down */
29
 
            close(fd[0]);
30
 
            _pam_log(LOG_CRIT, "couldn't copy terminal mode");
31
 
            return PAM_ABORT;
32
 
        } else {
33
 
-           struct termio t_mode = stored_mode;
34
 
+           struct termios t_mode = stored_mode;
35
 
 
36
 
            t_mode.c_iflag = 0;            /* no input control */
37
 
            t_mode.c_oflag &= ~OPOST;      /* no ouput post processing */
38
 
@@ -324,7 +324,7 @@
39
 
            t_mode.c_cc[VMIN] = 1; /* number of chars to satisfy a read */
40
 
            t_mode.c_cc[VTIME] = 0;          /* 0/10th second for chars */
41
 
 
42
 
-           if (ioctl(STDIN_FILENO, TCSETA, (char *) &t_mode) < 0) {
43
 
+           if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &t_mode) < 0) {
44
 
                close(fd[0]);
45
 
                _pam_log(LOG_WARNING, "couldn't put terminal in RAW mode");
46
 
                return PAM_ABORT;
47
 
@@ -354,7 +354,7 @@
48
 
 
49
 
        _pam_log(LOG_WARNING,"first fork failed");
50
 
        if (aterminal) {
51
 
-           (void) ioctl(STDIN_FILENO, TCSETA, (char *) &stored_mode);
52
 
+           (void) tcsetattr(STDIN_FILENO, TCSAFLUSH, &stored_mode);
53
 
        }
54
 
 
55
 
        return PAM_AUTH_ERR;
56
 
@@ -396,7 +396,7 @@
57
 
            /* initialize the child's terminal to be the way the
58
 
               parent's was before we set it into RAW mode */
59
 
 
60
 
-           if (ioctl(fd[1], TCSETA, (char *) &stored_mode) < 0) {
61
 
+           if (tcsetattr(fd[1], TCSANOW, &stored_mode) < 0) {
62
 
                _pam_log(LOG_WARNING,"cannot set slave terminal mode; %s"
63
 
                         ,terminal);
64
 
                close(fd[1]);
65
 
@@ -570,7 +570,7 @@
66
 
 
67
 
     if (aterminal) {
68
 
        /* reset to initial terminal mode */
69
 
-       (void) ioctl(STDIN_FILENO, TCSETA, (char *) &stored_mode);
70
 
+       (void) tcsetattr(STDIN_FILENO, TCSANOW, &stored_mode);
71
 
     }
72
 
 
73
 
     if (ctrl & FILTER_DEBUG) {
74
 
diff -urN Linux-PAM-0.72.orig/modules/pam_limits/pam_limits.c Linux-PAM-0.72/modules/pam_limits/pam_limits.c
75
 
--- Linux-PAM-0.72.orig/modules/pam_limits/pam_limits.c Sun Dec 31 05:06:58 2000
76
 
+++ Linux-PAM-0.72/modules/pam_limits/pam_limits.c      Sun Dec 31 05:12:25 2000
77
 
@@ -289,8 +289,10 @@
78
 
        limit_item = RLIMIT_NOFILE;
79
 
     else if (strcmp(lim_item, "memlock") == 0)
80
 
        limit_item = RLIMIT_MEMLOCK;
81
 
+#ifdef RLIMIT_AS
82
 
     else if (strcmp(lim_item, "as") == 0)
83
 
        limit_item = RLIMIT_AS;
84
 
+#endif
85
 
     else if (strcmp(lim_item, "maxlogins") == 0) {
86
 
        limit_item = LIMIT_LOGIN;
87
 
        flag_numsyslogins = 0;
88
 
@@ -343,7 +345,9 @@
89
 
         case RLIMIT_CORE:
90
 
         case RLIMIT_RSS:
91
 
         case RLIMIT_MEMLOCK:
92
 
+#ifdef RLIMIT_AS
93
 
         case RLIMIT_AS:
94
 
+#endif
95
 
             limit_value *= 1024;
96
 
             break;
97
 
     }
98
 
diff -urN Linux-PAM-0.72.orig/modules/pam_rhosts/Makefile Linux-PAM-0.72/modules/pam_rhosts/Makefile
99
 
--- Linux-PAM-0.72.orig/modules/pam_rhosts/Makefile     Sun Dec 31 05:06:59 2000
100
 
+++ Linux-PAM-0.72/modules/pam_rhosts/Makefile  Sun Dec 31 05:09:14 2000
101
 
@@ -26,11 +26,14 @@
102
 
 ifeq ($(shell if [ -f /usr/include/fsuid.h ]; then echo yes ; fi),yes)
103
 
  CFLAGS += -DHAVE_FSUID_H
104
 
 endif
105
 
-ifeq ($(shell if [ -f /usr/include/sys/fsuid.h ]; then echo yes ; fi),yes)
106
 
- CFLAGS += -DHAVE_SYS_FSUID_H -D_GNU_SOURCE
107
 
-endif
108
 
+#ifeq ($(shell if [ -f /usr/include/sys/fsuid.h ]; then echo yes ; fi),yes)
109
 
+ #CFLAGS += -DHAVE_SYS_FSUID_H -D_GNU_SOURCE
110
 
+#endif
111
 
 ifeq ($(shell if [ -f /usr/include/endian.h ]; then echo yes ; fi),yes)
112
 
  CFLAGS += -DHAVE_ENDIAN_H
113
 
+endif
114
 
+ifeq ($(shell if [ -f /usr/include/net/if.h ]; then echo yes ; fi),yes)
115
 
+ CFLAGS += -DHAVE_NET_IF_H
116
 
 endif
117
 
 
118
 
 ####################### don't edit below #######################
119
 
diff -urN Linux-PAM-0.72.orig/modules/pam_rhosts/pam_rhosts_auth.c Linux-PAM-0.72/modules/pam_rhosts/pam_rhosts_auth.c
120
 
--- Linux-PAM-0.72.orig/modules/pam_rhosts/pam_rhosts_auth.c    Sun Dec 31 05:06:59 2000
121
 
+++ Linux-PAM-0.72/modules/pam_rhosts/pam_rhosts_auth.c Sun Dec 31 05:09:14 2000
122
 
@@ -48,6 +48,10 @@
123
 
 #include <sys/fsuid.h>
124
 
 #endif
125
 
 
126
 
+#ifdef HAVE_NET_IF_H
127
 
+#include <net/if.h>
128
 
+#endif
129
 
+
130
 
 #include <sys/types.h>
131
 
 #include <sys/uio.h>
132
 
 #include <string.h>
133
 
@@ -64,18 +68,9 @@
134
 
 #include <sys/time.h>
135
 
 #include <arpa/inet.h>
136
 
 
137
 
-#ifndef MAXDNAME
138
 
-#define MAXDNAME  256
139
 
-#endif
140
 
-
141
 
 #include <stdarg.h>
142
 
 #include <ctype.h>
143
 
 
144
 
-#include <net/if.h>
145
 
-#ifdef HAVE_SYS_FSUID_H
146
 
-#include <sys/fsuid.h>
147
 
-#endif
148
 
-
149
 
 #include <pwd.h>
150
 
 #include <grp.h>
151
 
 #include <sys/file.h>
152
 
@@ -91,8 +86,13 @@
153
 
 #include <security/pam_modules.h>
154
 
 #include <security/_pam_macros.h>
155
 
 
156
 
+#ifdef _ISOC9X_SOURCE
157
 
+#include <inttypes.h>
158
 
+#define U32 uint32_t
159
 
+#else
160
 
 /* to the best of my knowledge, all modern UNIX boxes have 32 bit integers */
161
 
 #define U32 unsigned int
162
 
+#endif /* _ISOC9X_SOURCE */
163
 
 
164
 
 
165
 
 /*
166
 
@@ -359,11 +359,27 @@
167
 
     register const char *user;
168
 
     register char *p;
169
 
     int hcheck, ucheck;
170
 
+#ifdef MAXHOSTNAMELEN
171
 
     char buf[MAXHOSTNAMELEN + 128];                       /* host + login */
172
 
+#else
173
 
+               char *buf = NULL, *old_buf = 0;
174
 
+               size_t buf_len = 0;
175
 
+#endif
176
 
 
177
 
+#ifdef MAXHOSTNAMELEN
178
 
     buf[sizeof (buf)-1] = '\0';                        /* terminate line */
179
 
 
180
 
-    while (fgets(buf, sizeof(buf), hostf) != NULL) {   /* hostf file line */
181
 
+    while (fgets(buf, sizeof(buf), hostf) != NULL)   /* hostf file line */
182
 
+#else
183
 
+    while (getline(&buf, &buf_len, hostf) > 0)
184
 
+#endif
185
 
+    {
186
 
+#ifndef MAXHOSTNAMELEN
187
 
+        if (old_buf)
188
 
+          free(old_buf);
189
 
+        old_buf = buf;
190
 
+        buf_len = 0;
191
 
+#endif
192
 
         p = buf;                              /* from beginning of file.. */
193
 
 
194
 
        /* Skip empty or comment lines */
195
 
@@ -371,6 +386,7 @@
196
 
            continue;
197
 
        }
198
 
 
199
 
+#ifdef MAXHOSTNAMELEN
200
 
        /* Skip lines that are too long. */
201
 
        if (strchr(p, '\n') == NULL) {
202
 
            int ch = getc(hostf);
203
 
@@ -379,6 +395,7 @@
204
 
                ch = getc(hostf);
205
 
            continue;
206
 
        }
207
 
+#endif
208
 
 
209
 
        /*
210
 
         * If there is a hostname at the start of the line.  Set it to
211
 
@@ -432,6 +449,10 @@
212
 
            /* Neither, go on looking for match */
213
 
        }
214
 
     }
215
 
+#ifndef MAXHOSTNAMELEN
216
 
+    free(buf);
217
 
+    buf = NULL;
218
 
+#endif
219
 
 
220
 
     return (1);
221
 
 }
222
 
@@ -457,7 +477,11 @@
223
 
     FILE *hostf;
224
 
     uid_t uid;
225
 
     int answer;
226
 
+#ifdef MAXPATHLEN
227
 
     char pbuf[MAXPATHLEN];               /* potential buffer overrun */
228
 
+#else
229
 
+    char *pbuf = 0;
230
 
+#endif
231
 
 
232
 
     if ((!superuser||opts->opt_hosts_equiv_rootok) && !opts->opt_no_hosts_equiv ) {
233
 
 
234
 
@@ -491,6 +515,7 @@
235
 
        return(1);
236
 
     }
237
 
 
238
 
+#ifdef MAXPATHLEN
239
 
     /* check for buffer overrun */
240
 
     if (strlen(pwd->pw_dir) + sizeof(USER_RHOSTS_FILE) + 2 >= MAXPATHLEN) {
241
 
        if (opts->opt_debug)
242
 
@@ -500,6 +525,26 @@
243
 
 
244
 
     (void) strcpy(pbuf, pwd->pw_dir);
245
 
     (void) strcat(pbuf, USER_RHOSTS_FILE);
246
 
+#else
247
 
+    {
248
 
+        long int pbuf_len = strlen(pwd->pw_dir) + sizeof(USER_RHOSTS_FILE);
249
 
+        long int path_max;
250
 
+        pbuf = (char *)malloc(pbuf_len + 1);
251
 
+        if (!pbuf) {
252
 
+           if (opts->opt_debug)
253
 
+               _pam_log(LOG_DEBUG,
254
 
+                   "not enough memory to store home directory for `%s'", luser);
255
 
+            return 1;
256
 
+        }
257
 
+        snprintf(pbuf, pbuf_len, "%s%s", pwd->pw_dir, USER_RHOSTS_FILE);
258
 
+        path_max = pathconf(pbuf, _PC_PATH_MAX);
259
 
+        if(!(path_max == -1 && !errno) && pbuf_len >= path_max)  {
260
 
+           if (opts->opt_debug)
261
 
+               _pam_log(LOG_DEBUG,"home directory for `%s' is too long",luser);
262
 
+           return 1;                               /* to dangerous to try */
263
 
+       }
264
 
+    }
265
 
+#endif
266
 
 
267
 
     /*
268
 
      * Change effective uid while _reading_ .rhosts. (not just
269
 
@@ -593,6 +638,9 @@
270
 
 
271
 
     if (hostf != NULL)
272
 
         (void) fclose(hostf);
273
 
+#ifndef MAXPATHLEN
274
 
+    free(pbuf);
275
 
+#endif
276
 
 
277
 
     return answer;
278
 
 }
279
 
diff -urN Linux-PAM-0.72.orig/modules/pam_unix/unix_chkpwd.c Linux-PAM-0.72/modules/pam_unix/unix_chkpwd.c
280
 
--- Linux-PAM-0.72.orig/modules/pam_unix/unix_chkpwd.c  Sun Dec 31 05:06:59 2000
281
 
+++ Linux-PAM-0.72/modules/pam_unix/unix_chkpwd.c       Sun Dec 31 05:09:14 2000
282
 
@@ -51,6 +51,11 @@
283
 
 
284
 
 static void su_sighandler(int sig)
285
 
 {
286
 
+#ifndef SA_RESETHAND
287
 
+       /* emulate the behavior of the SA_RESETHAND flag */
288
 
+       if (sig == SIGILL || sig == SIGTRAP || sig == SIGBUS || sig == SIGSEGV)
289
 
+               signal(sig, SIG_DFL);
290
 
+#endif
291
 
        if (sig > 0) {
292
 
                _log_err(LOG_NOTICE, "caught signal %d.", sig);
293
 
                exit(sig);
294
 
@@ -66,7 +71,9 @@
295
 
         */
296
 
        (void) memset((void *) &action, 0, sizeof(action));
297
 
        action.sa_handler = su_sighandler;
298
 
+#ifdef SA_RESETHAND
299
 
        action.sa_flags = SA_RESETHAND;
300
 
+#endif
301
 
        (void) sigaction(SIGILL, &action, NULL);
302
 
        (void) sigaction(SIGTRAP, &action, NULL);
303
 
        (void) sigaction(SIGBUS, &action, NULL);