7a98835d44c0effb6212d7da351cbff3f4dbab6c
[openwrt/svn-archive/archive.git] / net / krb5 / patches / 001-uclibc-symbol-collision-fix.patch
1 diff -u --recursive --new-file krb5-1.7-vanilla/src/appl/gssftp/ftp/Makefile.in krb5-1.7/src/appl/gssftp/ftp/Makefile.in
2 --- krb5-1.7-vanilla/src/appl/gssftp/ftp/Makefile.in 2009-09-30 22:58:22.000000000 -0400
3 +++ krb5-1.7/src/appl/gssftp/ftp/Makefile.in 2009-10-01 15:35:02.000000000 -0400
4 @@ -12,14 +12,14 @@
5 SRCS = $(srcdir)/cmds.c $(srcdir)/cmdtab.c $(srcdir)/domacro.c \
6 $(srcdir)/ftp.c $(srcdir)/getpass.c $(srcdir)/glob.c \
7 $(srcdir)/main.c $(srcdir)/radix.c \
8 - $(srcdir)/ruserpass.c $(srcdir)/secure.c
9 + $(srcdir)/ruserpw.c $(srcdir)/secure.c
10
11
12 OBJS = $(OUTPRE)cmds.$(OBJEXT) $(OUTPRE)cmdtab.$(OBJEXT) \
13 $(OUTPRE)domacro.$(OBJEXT) $(OUTPRE)ftp.$(OBJEXT) \
14 $(OUTPRE)getpass.$(OBJEXT) $(OUTPRE)glob.$(OBJEXT) \
15 $(OUTPRE)main.$(OBJEXT) $(OUTPRE)radix.$(OBJEXT) \
16 - $(OUTPRE)ruserpass.$(OBJEXT) $(OUTPRE)secure.$(OBJEXT)
17 + $(OUTPRE)ruserpw.$(OBJEXT) $(OUTPRE)secure.$(OBJEXT)
18
19 LOCALINCLUDES = -I$(srcdir)/.. -I$(srcdir)
20
21 @@ -47,7 +47,7 @@
22 done
23
24 ftp.o cmds.o main.o: $(srcdir)/../arpa/ftp.h
25 -ftp.o cmds.o cmdtab.o domacro.o main.o ruserpass.o: $(srcdir)/ftp_var.h
26 +ftp.o cmds.o cmdtab.o domacro.o main.o ruserpw.o: $(srcdir)/ftp_var.h
27 secure.o: secure.h
28
29 cmds.o: $(srcdir)/cmds.c
30 @@ -57,7 +57,7 @@
31 glob.o: $(srcdir)/glob.c
32 main.o: $(srcdir)/main.c
33 pclose.o: $(srcdir)/pclose.c
34 -ruserpass.o: $(srcdir)/ruserpass.c
35 +ruserpw.o: $(srcdir)/ruserpw.c
36 domacro.o: $(srcdir)/domacro.c
37 radix.o: $(srcdir)/radix.c
38 secure.o: $(srcdir)/secure.c
39 diff -u --recursive --new-file krb5-1.7-vanilla/src/appl/gssftp/ftp/deps krb5-1.7/src/appl/gssftp/ftp/deps
40 --- krb5-1.7-vanilla/src/appl/gssftp/ftp/deps 2009-09-30 22:58:24.000000000 -0400
41 +++ krb5-1.7/src/appl/gssftp/ftp/deps 2009-10-01 15:35:02.000000000 -0400
42 @@ -22,7 +22,7 @@
43 $(SRCTOP)/include/port-sockets.h $(srcdir)/../arpa/ftp.h \
44 ftp_var.h main.c
45 $(OUTPRE)radix.$(OBJEXT): ftp_var.h radix.c
46 -$(OUTPRE)ruserpass.$(OBJEXT): ftp_var.h ruserpass.c
47 +$(OUTPRE)ruserpw.$(OBJEXT): ftp_var.h ruserpw.c
48 $(OUTPRE)secure.$(OBJEXT): $(BUILDTOP)/include/autoconf.h \
49 $(BUILDTOP)/include/gssapi/gssapi.h $(BUILDTOP)/include/gssapi/gssapi_generic.h \
50 $(srcdir)/../arpa/ftp.h secure.c secure.h
51 diff -u --recursive --new-file krb5-1.7-vanilla/src/appl/gssftp/ftp/ftp.c krb5-1.7/src/appl/gssftp/ftp/ftp.c
52 --- krb5-1.7-vanilla/src/appl/gssftp/ftp/ftp.c 2009-09-30 22:58:22.000000000 -0400
53 +++ krb5-1.7/src/appl/gssftp/ftp/ftp.c 2009-10-01 15:35:03.000000000 -0400
54 @@ -318,7 +318,7 @@
55 int n, aflag = 0;
56
57 l_user = pass = l_acct = 0;
58 - if (ruserpass(host, &l_user, &pass, &l_acct) < 0) {
59 + if (ruserpw(host, &l_user, &pass, &l_acct) < 0) {
60 code = -1;
61 return(0);
62 }
63 diff -u --recursive --new-file krb5-1.7-vanilla/src/appl/gssftp/ftp/ftp_var.h krb5-1.7/src/appl/gssftp/ftp/ftp_var.h
64 --- krb5-1.7-vanilla/src/appl/gssftp/ftp/ftp_var.h 2009-09-30 22:58:23.000000000 -0400
65 +++ krb5-1.7/src/appl/gssftp/ftp/ftp_var.h 2009-10-01 15:35:03.000000000 -0400
66 @@ -274,8 +274,8 @@
67 struct cmd *getcmd (char *);
68
69
70 -/* ruserpass.c */
71 -int ruserpass (char *, char **, char **, char **);
72 +/* ruserpw.c */
73 +int ruserpw (char *, char **, char **, char **);
74
75 /* radix.h */
76 int radix_encode (unsigned char *, unsigned char *, int *, int);
77 diff -u --recursive --new-file krb5-1.7-vanilla/src/appl/gssftp/ftp/ruserpass.c krb5-1.7/src/appl/gssftp/ftp/ruserpass.c
78 --- krb5-1.7-vanilla/src/appl/gssftp/ftp/ruserpass.c 2009-09-30 22:58:24.000000000 -0400
79 +++ krb5-1.7/src/appl/gssftp/ftp/ruserpass.c 1969-12-31 19:00:00.000000000 -0500
80 @@ -1,293 +0,0 @@
81 -/*
82 - * Copyright (c) 1985 Regents of the University of California.
83 - * All rights reserved.
84 - *
85 - * Redistribution and use in source and binary forms, with or without
86 - * modification, are permitted provided that the following conditions
87 - * are met:
88 - * 1. Redistributions of source code must retain the above copyright
89 - * notice, this list of conditions and the following disclaimer.
90 - * 2. Redistributions in binary form must reproduce the above copyright
91 - * notice, this list of conditions and the following disclaimer in the
92 - * documentation and/or other materials provided with the distribution.
93 - * 3. All advertising materials mentioning features or use of this software
94 - * must display the following acknowledgement:
95 - * This product includes software developed by the University of
96 - * California, Berkeley and its contributors.
97 - * 4. Neither the name of the University nor the names of its contributors
98 - * may be used to endorse or promote products derived from this software
99 - * without specific prior written permission.
100 - *
101 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
102 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
103 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
104 - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
105 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
106 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
107 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
108 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
109 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
110 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
111 - * SUCH DAMAGE.
112 - */
113 -
114 -#ifndef lint
115 -static char sccsid[] = "@(#)ruserpass.c 5.3 (Berkeley) 3/1/91";
116 -#endif /* not lint */
117 -
118 -#include <sys/types.h>
119 -#include <stdio.h>
120 -#include <string.h>
121 -#ifdef HAVE_STDLIB_H
122 -#include <stdlib.h>
123 -#endif
124 -#ifdef HAVE_UNISTD_H
125 -#include <unistd.h>
126 -#endif
127 -#include <ctype.h>
128 -#include <sys/stat.h>
129 -#include <errno.h>
130 -#include "ftp_var.h"
131 -
132 -#ifdef _WIN32
133 -#include <win-mac.h>
134 -#endif
135 -
136 -#ifndef MAXHOSTNAMELEN
137 -#define MAXHOSTNAMELEN 64
138 -#endif
139 -
140 -static int token (void);
141 -static FILE *cfile;
142 -
143 -#define DEFAULT 1
144 -#define LOGIN 2
145 -#define PASSWD 3
146 -#define ACCOUNT 4
147 -#define MACDEF 5
148 -#define ID 10
149 -#define MACH 11
150 -
151 -static char tokval[100];
152 -
153 -static struct toktab {
154 - char *tokstr;
155 - int tval;
156 -} toktab[]= {
157 - { "default", DEFAULT },
158 - { "login", LOGIN },
159 - { "password", PASSWD },
160 - { "passwd", PASSWD },
161 - { "account", ACCOUNT },
162 - { "machine", MACH },
163 - { "macdef", MACDEF },
164 - { NULL, 0 }
165 -};
166 -
167 -
168 -static int
169 -token()
170 -{
171 - char *cp;
172 - int c;
173 - struct toktab *t;
174 -
175 - if (feof(cfile))
176 - return (0);
177 - while ((c = getc(cfile)) != EOF &&
178 - (c == '\n' || c == '\t' || c == ' ' || c == ','))
179 - continue;
180 - if (c == EOF)
181 - return (0);
182 - cp = tokval;
183 - if (c == '"') {
184 - while ((c = getc(cfile)) != EOF && c != '"') {
185 - if (c == '\\')
186 - c = getc(cfile);
187 - *cp++ = c;
188 - }
189 - } else {
190 - *cp++ = c;
191 - while ((c = getc(cfile)) != EOF
192 - && c != '\n' && c != '\t' && c != ' ' && c != ',') {
193 - if (c == '\\')
194 - c = getc(cfile);
195 - *cp++ = c;
196 - }
197 - }
198 - *cp = 0;
199 - if (tokval[0] == 0)
200 - return (0);
201 - for (t = toktab; t->tokstr; t++)
202 - if (!strcmp(t->tokstr, tokval))
203 - return (t->tval);
204 - return (ID);
205 -}
206 -
207 -int
208 -ruserpass(host, aname, apass, aacct)
209 - char *host, **aname, **apass, **aacct;
210 -{
211 - char *hdir, buf[FTP_BUFSIZ], *tmp;
212 - char myname[MAXHOSTNAMELEN + 1], *mydomain;
213 - int t, i, c, usedefault = 0;
214 - struct stat stb;
215 -
216 - hdir = getenv("HOME");
217 - if (hdir == NULL)
218 - hdir = ".";
219 - (void) snprintf(buf, sizeof(buf), "%s/.netrc", hdir);
220 - cfile = fopen(buf, "r");
221 - if (cfile == NULL) {
222 - if (errno != ENOENT)
223 - perror(buf);
224 - return(0);
225 - }
226 - if (gethostname(myname, sizeof(myname)) < 0)
227 - myname[0] = '\0';
228 - if ((mydomain = strchr(myname, '.')) == NULL)
229 - mydomain = "";
230 -next:
231 - while ((t = token())) switch(t) {
232 -
233 - case DEFAULT:
234 - usedefault = 1;
235 - /* FALL THROUGH */
236 -
237 - case MACH:
238 - if (!usedefault) {
239 - if (token() != ID)
240 - continue;
241 - /*
242 - * Allow match either for user's input host name
243 - * or official hostname. Also allow match of
244 - * incompletely-specified host in local domain.
245 - */
246 - if (strcasecmp(host, tokval) == 0)
247 - goto match;
248 - if (strcasecmp(hostname, tokval) == 0)
249 - goto match;
250 - if ((tmp = strchr(hostname, '.')) != NULL &&
251 - strcasecmp(tmp, mydomain) == 0 &&
252 - strncasecmp(hostname, tokval,
253 - (unsigned) (tmp-hostname)) == 0 &&
254 - tokval[tmp - hostname] == '\0')
255 - goto match;
256 - if ((tmp = strchr(host, '.')) != NULL &&
257 - strcasecmp(tmp, mydomain) == 0 &&
258 - strncasecmp(host, tokval,
259 - (unsigned ) (tmp - host)) == 0 &&
260 - tokval[tmp - host] == '\0')
261 - goto match;
262 - continue;
263 - }
264 - match:
265 - while ((t = token()) && t != MACH && t != DEFAULT) switch(t) {
266 -
267 - case LOGIN:
268 - if (token()) {
269 - if (*aname == 0) {
270 - *aname = strdup(tokval);
271 - } else {
272 - if (strcmp(*aname, tokval))
273 - goto next;
274 - }
275 - }
276 - break;
277 - case PASSWD:
278 - if (strcmp(*aname, "anonymous") &&
279 - fstat(fileno(cfile), &stb) >= 0 &&
280 - (stb.st_mode & 077) != 0) {
281 - fprintf(stderr, "Error - .netrc file not correct mode.\n");
282 - fprintf(stderr, "Remove password or correct mode.\n");
283 - goto bad;
284 - }
285 - if (token() && *apass == 0) {
286 - *apass = strdup(tokval);
287 - }
288 - break;
289 - case ACCOUNT:
290 - if (fstat(fileno(cfile), &stb) >= 0
291 - && (stb.st_mode & 077) != 0) {
292 - fprintf(stderr, "Error - .netrc file not correct mode.\n");
293 - fprintf(stderr, "Remove account or correct mode.\n");
294 - goto bad;
295 - }
296 - if (token() && *aacct == 0) {
297 - *aacct = strdup(tokval);
298 - }
299 - break;
300 - case MACDEF:
301 - if (proxy) {
302 - (void) fclose(cfile);
303 - return(0);
304 - }
305 - while ((c = getc(cfile)) != EOF)
306 - if (c != ' ' && c != '\t')
307 - break;
308 - if (c == EOF || c == '\n') {
309 - printf("Missing macdef name argument.\n");
310 - goto bad;
311 - }
312 - if (macnum == 16) {
313 - printf("Limit of 16 macros have already been defined\n");
314 - goto bad;
315 - }
316 - tmp = macros[macnum].mac_name;
317 - *tmp++ = c;
318 - for (i=0; i < 8 && (c=getc(cfile)) != EOF &&
319 - !isspace(c); ++i) {
320 - *tmp++ = c;
321 - }
322 - if (c == EOF) {
323 - printf("Macro definition missing null line terminator.\n");
324 - goto bad;
325 - }
326 - *tmp = '\0';
327 - if (c != '\n') {
328 - while ((c=getc(cfile)) != EOF && c != '\n');
329 - }
330 - if (c == EOF) {
331 - printf("Macro definition missing null line terminator.\n");
332 - goto bad;
333 - }
334 - if (macnum == 0) {
335 - macros[macnum].mac_start = macbuf;
336 - }
337 - else {
338 - macros[macnum].mac_start = macros[macnum-1].mac_end + 1;
339 - }
340 - tmp = macros[macnum].mac_start;
341 - while (tmp != macbuf + 4096) {
342 - if ((c=getc(cfile)) == EOF) {
343 - printf("Macro definition missing null line terminator.\n");
344 - goto bad;
345 - }
346 - *tmp = c;
347 - if (*tmp == '\n') {
348 - if (*(tmp-1) == '\0') {
349 - macros[macnum++].mac_end = tmp - 1;
350 - break;
351 - }
352 - *tmp = '\0';
353 - }
354 - tmp++;
355 - }
356 - if (tmp == macbuf + 4096) {
357 - printf("4K macro buffer exceeded\n");
358 - goto bad;
359 - }
360 - break;
361 - default:
362 - fprintf(stderr, "Unknown .netrc keyword %s\n", tokval);
363 - break;
364 - }
365 - goto done;
366 - }
367 -done:
368 - (void) fclose(cfile);
369 - return(0);
370 -bad:
371 - (void) fclose(cfile);
372 - return(-1);
373 -}
374 diff -u --recursive --new-file krb5-1.7-vanilla/src/appl/gssftp/ftp/ruserpw.c krb5-1.7/src/appl/gssftp/ftp/ruserpw.c
375 --- krb5-1.7-vanilla/src/appl/gssftp/ftp/ruserpw.c 1969-12-31 19:00:00.000000000 -0500
376 +++ krb5-1.7/src/appl/gssftp/ftp/ruserpw.c 2009-10-01 15:35:57.000000000 -0400
377 @@ -0,0 +1,293 @@
378 +/*
379 + * Copyright (c) 1985 Regents of the University of California.
380 + * All rights reserved.
381 + *
382 + * Redistribution and use in source and binary forms, with or without
383 + * modification, are permitted provided that the following conditions
384 + * are met:
385 + * 1. Redistributions of source code must retain the above copyright
386 + * notice, this list of conditions and the following disclaimer.
387 + * 2. Redistributions in binary form must reproduce the above copyright
388 + * notice, this list of conditions and the following disclaimer in the
389 + * documentation and/or other materials provided with the distribution.
390 + * 3. All advertising materials mentioning features or use of this software
391 + * must display the following acknowledgement:
392 + * This product includes software developed by the University of
393 + * California, Berkeley and its contributors.
394 + * 4. Neither the name of the University nor the names of its contributors
395 + * may be used to endorse or promote products derived from this software
396 + * without specific prior written permission.
397 + *
398 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
399 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
400 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
401 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
402 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
403 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
404 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
405 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
406 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
407 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
408 + * SUCH DAMAGE.
409 + */
410 +
411 +#ifndef lint
412 +static char sccsid[] = "@(#)ruserpw.c 5.3 (Berkeley) 3/1/91";
413 +#endif /* not lint */
414 +
415 +#include <sys/types.h>
416 +#include <stdio.h>
417 +#include <string.h>
418 +#ifdef HAVE_STDLIB_H
419 +#include <stdlib.h>
420 +#endif
421 +#ifdef HAVE_UNISTD_H
422 +#include <unistd.h>
423 +#endif
424 +#include <ctype.h>
425 +#include <sys/stat.h>
426 +#include <errno.h>
427 +#include "ftp_var.h"
428 +
429 +#ifdef _WIN32
430 +#include <win-mac.h>
431 +#endif
432 +
433 +#ifndef MAXHOSTNAMELEN
434 +#define MAXHOSTNAMELEN 64
435 +#endif
436 +
437 +static int token (void);
438 +static FILE *cfile;
439 +
440 +#define DEFAULT 1
441 +#define LOGIN 2
442 +#define PASSWD 3
443 +#define ACCOUNT 4
444 +#define MACDEF 5
445 +#define ID 10
446 +#define MACH 11
447 +
448 +static char tokval[100];
449 +
450 +static struct toktab {
451 + char *tokstr;
452 + int tval;
453 +} toktab[]= {
454 + { "default", DEFAULT },
455 + { "login", LOGIN },
456 + { "password", PASSWD },
457 + { "passwd", PASSWD },
458 + { "account", ACCOUNT },
459 + { "machine", MACH },
460 + { "macdef", MACDEF },
461 + { NULL, 0 }
462 +};
463 +
464 +
465 +static int
466 +token()
467 +{
468 + char *cp;
469 + int c;
470 + struct toktab *t;
471 +
472 + if (feof(cfile))
473 + return (0);
474 + while ((c = getc(cfile)) != EOF &&
475 + (c == '\n' || c == '\t' || c == ' ' || c == ','))
476 + continue;
477 + if (c == EOF)
478 + return (0);
479 + cp = tokval;
480 + if (c == '"') {
481 + while ((c = getc(cfile)) != EOF && c != '"') {
482 + if (c == '\\')
483 + c = getc(cfile);
484 + *cp++ = c;
485 + }
486 + } else {
487 + *cp++ = c;
488 + while ((c = getc(cfile)) != EOF
489 + && c != '\n' && c != '\t' && c != ' ' && c != ',') {
490 + if (c == '\\')
491 + c = getc(cfile);
492 + *cp++ = c;
493 + }
494 + }
495 + *cp = 0;
496 + if (tokval[0] == 0)
497 + return (0);
498 + for (t = toktab; t->tokstr; t++)
499 + if (!strcmp(t->tokstr, tokval))
500 + return (t->tval);
501 + return (ID);
502 +}
503 +
504 +int
505 +ruserpw(host, aname, apass, aacct)
506 + char *host, **aname, **apass, **aacct;
507 +{
508 + char *hdir, buf[FTP_BUFSIZ], *tmp;
509 + char myname[MAXHOSTNAMELEN + 1], *mydomain;
510 + int t, i, c, usedefault = 0;
511 + struct stat stb;
512 +
513 + hdir = getenv("HOME");
514 + if (hdir == NULL)
515 + hdir = ".";
516 + (void) snprintf(buf, sizeof(buf), "%s/.netrc", hdir);
517 + cfile = fopen(buf, "r");
518 + if (cfile == NULL) {
519 + if (errno != ENOENT)
520 + perror(buf);
521 + return(0);
522 + }
523 + if (gethostname(myname, sizeof(myname)) < 0)
524 + myname[0] = '\0';
525 + if ((mydomain = strchr(myname, '.')) == NULL)
526 + mydomain = "";
527 +next:
528 + while ((t = token())) switch(t) {
529 +
530 + case DEFAULT:
531 + usedefault = 1;
532 + /* FALL THROUGH */
533 +
534 + case MACH:
535 + if (!usedefault) {
536 + if (token() != ID)
537 + continue;
538 + /*
539 + * Allow match either for user's input host name
540 + * or official hostname. Also allow match of
541 + * incompletely-specified host in local domain.
542 + */
543 + if (strcasecmp(host, tokval) == 0)
544 + goto match;
545 + if (strcasecmp(hostname, tokval) == 0)
546 + goto match;
547 + if ((tmp = strchr(hostname, '.')) != NULL &&
548 + strcasecmp(tmp, mydomain) == 0 &&
549 + strncasecmp(hostname, tokval,
550 + (unsigned) (tmp-hostname)) == 0 &&
551 + tokval[tmp - hostname] == '\0')
552 + goto match;
553 + if ((tmp = strchr(host, '.')) != NULL &&
554 + strcasecmp(tmp, mydomain) == 0 &&
555 + strncasecmp(host, tokval,
556 + (unsigned ) (tmp - host)) == 0 &&
557 + tokval[tmp - host] == '\0')
558 + goto match;
559 + continue;
560 + }
561 + match:
562 + while ((t = token()) && t != MACH && t != DEFAULT) switch(t) {
563 +
564 + case LOGIN:
565 + if (token()) {
566 + if (*aname == 0) {
567 + *aname = strdup(tokval);
568 + } else {
569 + if (strcmp(*aname, tokval))
570 + goto next;
571 + }
572 + }
573 + break;
574 + case PASSWD:
575 + if (strcmp(*aname, "anonymous") &&
576 + fstat(fileno(cfile), &stb) >= 0 &&
577 + (stb.st_mode & 077) != 0) {
578 + fprintf(stderr, "Error - .netrc file not correct mode.\n");
579 + fprintf(stderr, "Remove password or correct mode.\n");
580 + goto bad;
581 + }
582 + if (token() && *apass == 0) {
583 + *apass = strdup(tokval);
584 + }
585 + break;
586 + case ACCOUNT:
587 + if (fstat(fileno(cfile), &stb) >= 0
588 + && (stb.st_mode & 077) != 0) {
589 + fprintf(stderr, "Error - .netrc file not correct mode.\n");
590 + fprintf(stderr, "Remove account or correct mode.\n");
591 + goto bad;
592 + }
593 + if (token() && *aacct == 0) {
594 + *aacct = strdup(tokval);
595 + }
596 + break;
597 + case MACDEF:
598 + if (proxy) {
599 + (void) fclose(cfile);
600 + return(0);
601 + }
602 + while ((c = getc(cfile)) != EOF)
603 + if (c != ' ' && c != '\t')
604 + break;
605 + if (c == EOF || c == '\n') {
606 + printf("Missing macdef name argument.\n");
607 + goto bad;
608 + }
609 + if (macnum == 16) {
610 + printf("Limit of 16 macros have already been defined\n");
611 + goto bad;
612 + }
613 + tmp = macros[macnum].mac_name;
614 + *tmp++ = c;
615 + for (i=0; i < 8 && (c=getc(cfile)) != EOF &&
616 + !isspace(c); ++i) {
617 + *tmp++ = c;
618 + }
619 + if (c == EOF) {
620 + printf("Macro definition missing null line terminator.\n");
621 + goto bad;
622 + }
623 + *tmp = '\0';
624 + if (c != '\n') {
625 + while ((c=getc(cfile)) != EOF && c != '\n');
626 + }
627 + if (c == EOF) {
628 + printf("Macro definition missing null line terminator.\n");
629 + goto bad;
630 + }
631 + if (macnum == 0) {
632 + macros[macnum].mac_start = macbuf;
633 + }
634 + else {
635 + macros[macnum].mac_start = macros[macnum-1].mac_end + 1;
636 + }
637 + tmp = macros[macnum].mac_start;
638 + while (tmp != macbuf + 4096) {
639 + if ((c=getc(cfile)) == EOF) {
640 + printf("Macro definition missing null line terminator.\n");
641 + goto bad;
642 + }
643 + *tmp = c;
644 + if (*tmp == '\n') {
645 + if (*(tmp-1) == '\0') {
646 + macros[macnum++].mac_end = tmp - 1;
647 + break;
648 + }
649 + *tmp = '\0';
650 + }
651 + tmp++;
652 + }
653 + if (tmp == macbuf + 4096) {
654 + printf("4K macro buffer exceeded\n");
655 + goto bad;
656 + }
657 + break;
658 + default:
659 + fprintf(stderr, "Unknown .netrc keyword %s\n", tokval);
660 + break;
661 + }
662 + goto done;
663 + }
664 +done:
665 + (void) fclose(cfile);
666 + return(0);
667 +bad:
668 + (void) fclose(cfile);
669 + return(-1);
670 +}