]> pere.pagekite.me Git - homepage.git/blob - linux/ypserv-2.8.90-20030602.diff
Switched blog to hungry.com for now. Updated all links.
[homepage.git] / linux / ypserv-2.8.90-20030602.diff
1 diff -ur src-2.8.90/acinclude.m4 src-2.8.90-local/acinclude.m4
2 --- src-2.8.90/acinclude.m4 2002-08-09 21:32:20.000000000 +0200
3 +++ src-2.8.90-local/acinclude.m4 2003-05-21 13:23:31.000000000 +0200
4 @@ -19,3 +19,19 @@
5 AC_MSG_RESULT(no)
6 fi], [AC_MSG_RESULT(no)])
7 ])
8 +
9 +dnl
10 +dnl JAPHAR_GREP_CFLAGS(flag, cmd_if_missing, cmd_if_present)
11 +dnl
12 +dnl From Japhar. Report changes to japhar@hungry.com
13 +dnl
14 +AC_DEFUN(JAPHAR_GREP_CFLAGS,
15 +[case "$CFLAGS" in
16 +"$1" | "$1 "* | *" $1" | *" $1 "* )
17 + ifelse($#, 3, [$3], [:])
18 + ;;
19 +*)
20 + $2
21 + ;;
22 +esac
23 +])
24 diff -ur src-2.8.90/configure.in src-2.8.90-local/configure.in
25 --- src-2.8.90/configure.in 2003-05-19 15:54:24.000000000 +0200
26 +++ src-2.8.90-local/configure.in 2003-06-02 14:25:23.000000000 +0200
27 @@ -40,8 +40,13 @@
28 YPBINDIR=${libexecdir}
29 fi
30 AC_SUBST(YPBINDIR)
31 -YPMAPDIR="/var/yp"
32 +
33 +dnl Location of the NIS maps. default: /var/yp
34 +AC_ARG_ENABLE(ypmapdir,
35 + [ --enable-ypmapdir=path Disable check for root password [default=/var/yp]],
36 + YPMAPDIR=$enableval, YPMAPDIR=/var/yp)
37 AC_SUBST(YPMAPDIR)
38 +
39 if test ${sbindir} = '${exec_prefix}/sbin'
40 then
41 if test "${exec_prefix}" = "NONE"
42 @@ -56,8 +61,6 @@
43 AC_SUBST(SBINDIR)
44
45 dnl Checks for programs.
46 -EXTRA_CFLAGS="-W -Wall -Wbad-function-cast -Wcast-align -Wcast-qual"
47 -AC_SUBST(EXTRA_CFLAGS)
48 AC_PROG_CC
49 AC_ISC_POSIX
50 AC_PROG_CPP
51 @@ -65,6 +68,25 @@
52 AC_PROG_MAKE_SET
53 AC_PROG_RANLIB
54
55 +if eval "test x$GCC = xyes"; then
56 + # Can not use -ansi as this make alloca() unavailable on Mac OS X 10.2
57 + for flag in \
58 + -pedantic \
59 + -W \
60 + -Wall \
61 + -Wbad-function-cast \
62 + -Wcast-align \
63 + -Wcast-qual \
64 + -Wmissing-declarations \
65 + -Wmissing-prototypes \
66 + -Wpointer-arith \
67 + -Wreturn-type \
68 + -Wstrict-prototypes
69 + do
70 + JAPHAR_GREP_CFLAGS($flag, [ CFLAGS="$CFLAGS $flag" ])
71 + done
72 +fi
73 +
74 AM_WITH_DMALLOC
75 AM_WITH_EFENCE
76
77 @@ -152,6 +174,7 @@
78 AC_CHECK_HEADERS(xcrypt.h crypt.h)
79 fi
80 AC_SUBST(LIBCRYPT)
81 +AC_CHECK_LIB(rpcsvc, getrpcport)
82 AC_CHECK_LIB(nsl,gethostbyname)
83 AC_CHECK_LIB(socket,socket)
84 AC_CHECK_LIB(resolv, res_gethostbyname, RESOLV="-lresolv", RESOLV="")
85 @@ -169,7 +192,7 @@
86 AC_HEADER_SYS_WAIT
87 AC_CHECK_HEADERS(fcntl.h paths.h sys/file.h sys/time.h syslog.h unistd.h)
88 AC_CHECK_HEADERS(getopt.h shadow.h rpc/clnt_soc.h rpc/svc_soc.h)
89 -AC_CHECK_HEADERS(netinet/in.h)
90 +AC_CHECK_HEADERS(netinet/in.h alloca.h poll.h)
91 AC_CHECK_TYPE(in_addr_t, ,[AC_DEFINE(in_addr_t,int,[Define to int if you don't have in_addr_t])],[#include <netinet/in.h>])
92
93 dnl Checks for typedefs, structures, and compiler characteristics.
94 @@ -192,9 +215,17 @@
95 dnl Checks for library functions.
96 AC_FUNC_MEMCMP
97 AC_FUNC_VPRINTF
98 -AC_CHECK_FUNCS(inet_aton vsyslog lckpwdf)
99 +AC_CHECK_FUNCS(inet_aton inet_pton vsyslog lckpwdf)
100 AC_CHECK_FUNCS(strdup strndup strerror strstr strsep stpcpy snprintf)
101 AC_CHECK_FUNCS(gethostname gettimeofday select socket uname getopt_long)
102 +
103 +AC_CHECK_FUNCS(xdr_domainname xdr_ypxfrstat xdr_ypresp_xfr xdr_ypreq_xfr)
104 +AC_CHECK_FUNCS(xdr_ypmap_parms xdr_ypreq_nokey xdr_ypresp_master xdr_mapname)
105 +AC_CHECK_FUNCS(xdr_peername xdr_ypstat xdr_ypbind_binding xdr_yppushresp_xfr)
106 +AC_CHECK_FUNCS(xdr_yppush_status)
107 +
108 +AC_CHECK_FUNCS(getrpcport svc_getcaller svc_getrpccaller)
109 +AC_CHECK_FUNCS(setenv putenv fgetpwent putpwent fgetgrent)
110 AC_CHECK_FUNCS(_rpc_dtablesize getdtablesize getspnam getline getdelim)
111 AC_CHECK_DECL(svc_max_pollfd,AC_DEFINE(HAVE_SVC_MAX_POLLFD, 1, [Define if the system supports svc_max_pollfd.]),, [#include <rpc/rpc.h>])
112
113 @@ -221,6 +252,7 @@
114 Libraries: ${LIBS} ${LIBDBM} ${LIBCRYPT}
115 Awk: ${AWK}
116 Shell: ${BASH}
117 + NIS map dir: ${YPMAPDIR}
118 Install path prefix: ${prefix}"
119 if test ${sysconfdir} != '${prefix}/etc'
120 then
121 diff -ur src-2.8.90/lib/Makefile.am src-2.8.90-local/lib/Makefile.am
122 --- src-2.8.90/lib/Makefile.am 2003-02-04 18:06:15.000000000 +0100
123 +++ src-2.8.90-local/lib/Makefile.am 2003-05-21 17:53:04.000000000 +0200
124 @@ -12,11 +12,11 @@
125
126 rpcsvc_HEADERS = ypxfrd.x
127
128 -AM_CFLAGS = @EXTRA_CFLAGS@
129 DEFS = @DEFS@ -D_REENTRANT=1 -DCONFDIR=\"$(sysconfdir)\"
130 INCLUDES = -I$(top_srcdir) -I$(top_builddir) -I$(srcdir)
131
132 libyp_a_SOURCES = log_msg.c ypserv_conf.c ypxfrd_xdr.c \
133 + compat.c compat.h \
134 ypproc_match_2.c securenets.c access.c yp_db.c
135
136 CLEANFILES = *~
137 diff -ur src-2.8.90/lib/access.c src-2.8.90-local/lib/access.c
138 --- src-2.8.90/lib/access.c 2003-03-03 11:43:39.000000000 +0100
139 +++ src-2.8.90-local/lib/access.c 2003-05-29 08:41:00.000000000 +0200
140 @@ -37,6 +37,7 @@
141 #include "access.h"
142 #include "yp_db.h"
143 #include "yp.h"
144 +#include "compat.h"
145
146 static conffile_t *conf = NULL;
147
148 @@ -130,7 +131,7 @@
149 int
150 is_valid (struct svc_req *rqstp, const char *map, const char *domain)
151 {
152 - struct sockaddr_in *sin;
153 + const struct sockaddr_in *sin;
154 int status;
155 static unsigned long int oldaddr = 0; /* so we dont log multiple times */
156 static int oldstatus = -1;
157 Only in src-2.8.90-local/lib: compat.c
158 Only in src-2.8.90-local/lib: compat.h
159 diff -ur src-2.8.90/lib/yp.h src-2.8.90-local/lib/yp.h
160 --- src-2.8.90/lib/yp.h 2001-02-18 10:19:09.000000000 +0100
161 +++ src-2.8.90-local/lib/yp.h 2003-05-28 17:43:21.000000000 +0200
162 @@ -8,7 +8,9 @@
163
164 #include <rpc/rpc.h>
165
166 +#if 0
167 #include <pthread.h>
168 +#endif
169
170 #ifdef __cplusplus
171 extern "C" {
172 @@ -30,7 +32,7 @@
173 YP_BADDB = -5,
174 YP_YPERR = -6,
175 YP_BADARGS = -7,
176 - YP_VERS = -8,
177 + YP_VERS = -8
178 };
179 typedef enum ypstat ypstat;
180
181 @@ -50,7 +52,7 @@
182 YPXFR_CLEAR = -11,
183 YPXFR_FORCE = -12,
184 YPXFR_XFRERR = -13,
185 - YPXFR_REFUSED = -14,
186 + YPXFR_REFUSED = -14
187 };
188 typedef enum ypxfrstat ypxfrstat;
189
190 @@ -176,7 +178,7 @@
191 YPPUSH_CLEAR = -11,
192 YPPUSH_FORCE = -12,
193 YPPUSH_XFRERR = -13,
194 - YPPUSH_REFUSED = -14,
195 + YPPUSH_REFUSED = -14
196 };
197 typedef enum yppush_status yppush_status;
198
199 @@ -188,7 +190,7 @@
200
201 enum ypbind_resptype {
202 YPBIND_SUCC_VAL = 1,
203 - YPBIND_FAIL_VAL = 2,
204 + YPBIND_FAIL_VAL = 2
205 };
206 typedef enum ypbind_resptype ypbind_resptype;
207
208 diff -ur src-2.8.90/lib/ypserv_conf.c src-2.8.90-local/lib/ypserv_conf.c
209 --- src-2.8.90/lib/ypserv_conf.c 2003-05-19 15:07:20.000000000 +0200
210 +++ src-2.8.90-local/lib/ypserv_conf.c 2003-05-28 18:36:04.000000000 +0200
211 @@ -28,10 +28,14 @@
212 #include <sys/types.h>
213 #include <netinet/in.h>
214 #include <arpa/inet.h>
215 +#ifdef HAVE_ALLOCA_H
216 #include <alloca.h>
217 +#endif /* HAVE_ALLOCA_H */
218 +#include <unistd.h>
219
220 #include "log_msg.h"
221 #include "ypserv_conf.h"
222 +#include "compat.h"
223
224 int dns_flag = 0;
225 int xfr_check_port = 0;
226 @@ -396,14 +400,11 @@
227 log_msg ("ypserv.conf: xfr_check_port: %d", xfr_check_port);
228 break;
229 }
230 -#ifdef __GNUC__
231 /* GCC syntax shows our intent much more clearly */
232 - case '1' ... '9':
233 -#else
234 + /* case '1' ... '9': */
235 case '1': case '2': case '3':
236 case '4': case '5': case '6':
237 case '7': case '8': case '9':
238 -#endif
239 case '*':
240 {
241 char *n, *d, *m, *s, *p, *f;
242 diff -uNr src-2.8.90/lib/compat.c src-2.8.90-local/lib/compat.c
243 --- src-2.8.90/lib/compat.c 1970-01-01 01:00:00.000000000 +0100
244 +++ src-2.8.90-local/lib/compat.c 2003-06-02 14:33:07.000000000 +0200
245 @@ -0,0 +1,597 @@
246 +#include <stdlib.h>
247 +#include <stdio.h>
248 +#include "compat.h"
249 +
250 +#ifndef HAVE_STPCPY
251 +char *stpcpy(char *s1, const char *s2)
252 +{
253 + /* This is a naive implementation for platforms missing the
254 + function. It should be rewritten. */
255 + strcpy(s1, s2);
256 + return s1 + strlen(s2);
257 +}
258 +#endif /* not HAVE_STPCPY */
259 +
260 +#ifndef HAVE_STRNDUP
261 +char *strndup (const char * s, int size)
262 +{
263 + int len = strlen(s) + 1;
264 + char *retval;
265 +
266 + len = len > size ? size : len;
267 + retval = malloc(len);
268 + strcpy(retval, s);
269 + retval[len-1] = '\0';
270 +
271 + return retval;
272 +}
273 +#endif /* not HAVE_STRNDUP */
274 +
275 +#ifndef HAVE_GETOPT_LONG
276 +int
277 +getopt_long (int argc, char *const *argv, const char *shortopts,
278 + const struct option *longopts, int *longind)
279 +{
280 + return getopt(argc, argv, shortopts);
281 +}
282 +#endif /* not HAVE_GETOPT_LONG */
283 +
284 +#if !defined(HAVE_GETDELIM) && !defined(HAVE_GETLINE)
285 +/* copied from cvs 1.11.5 source */
286 +/* getline.c -- Replacement for GNU C library function getline
287 +
288 +Copyright (C) 1993 Free Software Foundation, Inc.
289 +
290 +This program is free software; you can redistribute it and/or
291 +modify it under the terms of the GNU General Public License as
292 +published by the Free Software Foundation; either version 2 of the
293 +License, or (at your option) any later version.
294 +
295 +This program is distributed in the hope that it will be useful, but
296 +WITHOUT ANY WARRANTY; without even the implied warranty of
297 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
298 +General Public License for more details. */
299 +
300 +/* Written by Jan Brittenson, bson@gnu.ai.mit.edu. */
301 +
302 +#include <sys/types.h>
303 +#include <stdio.h>
304 +#include <assert.h>
305 +#include <errno.h>
306 +
307 +#define GETLINE_NO_LIMIT -1
308 +
309 +#if STDC_HEADERS
310 +#include <stdlib.h>
311 +#else
312 +char *malloc (), *realloc ();
313 +#endif
314 +
315 +/* Always add at least this many bytes when extending the buffer. */
316 +#define MIN_CHUNK 64
317 +
318 +/* Read up to (and including) a TERMINATOR from STREAM into *LINEPTR
319 + + OFFSET (and null-terminate it). If LIMIT is non-negative, then
320 + read no more than LIMIT chars.
321 +
322 + *LINEPTR is a pointer returned from malloc (or NULL), pointing to
323 + *N characters of space. It is realloc'd as necessary.
324 +
325 + Return the number of characters read (not including the null
326 + terminator), or -1 on error or EOF. On a -1 return, the caller
327 + should check feof(), if not then errno has been set to indicate the
328 + error. */
329 +
330 +int
331 +getstr (char **lineptr, size_t *n, FILE *stream, int terminator,
332 + int offset, int limit)
333 +{
334 + int nchars_avail; /* Allocated but unused chars in *LINEPTR. */
335 + char *read_pos; /* Where we're reading into *LINEPTR. */
336 + int ret;
337 +
338 + if (!lineptr || !n || !stream)
339 + {
340 + errno = EINVAL;
341 + return -1;
342 + }
343 +
344 + if (!*lineptr)
345 + {
346 + *n = MIN_CHUNK;
347 + *lineptr = malloc (*n);
348 + if (!*lineptr)
349 + {
350 + errno = ENOMEM;
351 + return -1;
352 + }
353 + *lineptr[0] = '\0';
354 + }
355 +
356 + nchars_avail = *n - offset;
357 + read_pos = *lineptr + offset;
358 +
359 + for (;;)
360 + {
361 + int save_errno;
362 + register int c;
363 +
364 + if (limit == 0)
365 + break;
366 + else
367 + {
368 + c = getc (stream);
369 +
370 + /* If limit is negative, then we shouldn't pay attention to
371 + it, so decrement only if positive. */
372 + if (limit > 0)
373 + limit--;
374 + }
375 +
376 + save_errno = errno;
377 +
378 + /* We always want at least one char left in the buffer, since we
379 + always (unless we get an error while reading the first char)
380 + NUL-terminate the line buffer. */
381 +
382 + assert((*lineptr + *n) == (read_pos + nchars_avail));
383 + if (nchars_avail < 2)
384 + {
385 + if (*n > MIN_CHUNK)
386 + *n *= 2;
387 + else
388 + *n += MIN_CHUNK;
389 +
390 + nchars_avail = *n + *lineptr - read_pos;
391 + *lineptr = realloc (*lineptr, *n);
392 + if (!*lineptr)
393 + {
394 + errno = ENOMEM;
395 + return -1;
396 + }
397 + read_pos = *n - nchars_avail + *lineptr;
398 + assert((*lineptr + *n) == (read_pos + nchars_avail));
399 + }
400 +
401 + if (ferror (stream))
402 + {
403 + /* Might like to return partial line, but there is no
404 + place for us to store errno. And we don't want to just
405 + lose errno. */
406 + errno = save_errno;
407 + return -1;
408 + }
409 +
410 + if (c == EOF)
411 + {
412 + /* Return partial line, if any. */
413 + if (read_pos == *lineptr)
414 + return -1;
415 + else
416 + break;
417 + }
418 +
419 + *read_pos++ = c;
420 + nchars_avail--;
421 +
422 + if (c == terminator)
423 + /* Return the line. */
424 + break;
425 + }
426 +
427 + /* Done - NUL terminate and return the number of chars read. */
428 + *read_pos = '\0';
429 +
430 + ret = read_pos - (*lineptr + offset);
431 + return ret;
432 +}
433 +
434 +ssize_t
435 +getline (char **lineptr, size_t *n, FILE *stream)
436 +{
437 + return getstr (lineptr, n, stream, '\n', 0, GETLINE_NO_LIMIT);
438 +}
439 +
440 +int
441 +getline_safe (char **lineptr, size_t *n, FILE *stream, int limit)
442 +{
443 + return getstr (lineptr, n, stream, '\n', 0, limit);
444 +}
445 +
446 +#endif /* not HAVE_GETDELIM and not HAVE_GETLINE */
447 +
448 +#if !defined(HAVE_SVC_GETCALLER) && !defined(svc_getcaller)
449 +const struct sockaddr_in *
450 +svc_getcaller(const SVCXPRT *xprt)
451 +{
452 +# ifdef HAVE_SVC_GETRPCCALLER
453 + const struct netbuf *addr;
454 + addr = svc_getrpccaller(xprt);
455 + fprintf(stderr, "warning: Bogus svc_getcaller() called\n");
456 + /* XXX find out how the result from svc_getrpccaller relates to
457 + svc_getcaller */
458 + return addr;
459 +# else /* not HAVE_SVC_GETRPCCALLER */
460 +# error "Missing both svc_getcaller() and svc_getrpccaller()"
461 +# endif /* not HAVE_SVC_GETRPCCALLER */
462 +}
463 +#endif /* not HAVE_SVC_GETCALLER */
464 +
465 +
466 +#ifndef HAVE__RPC_DTABLESIZE
467 +# if HAVE_GETDTABLESIZE
468 +int _rpc_dtablesize()
469 +{
470 + static int size;
471 +
472 + if (size == 0) {
473 + size = getdtablesize();
474 + }
475 + return (size);
476 +}
477 +# else
478 +# include <sys/resource.h>
479 +int _rpc_dtablesize()
480 +{
481 + static int size = 0;
482 + struct rlimit rlb;
483 +
484 + if (size == 0)
485 + {
486 + if (getrlimit(RLIMIT_NOFILE, &rlb) >= 0)
487 + size = rlb.rlim_cur;
488 + }
489 +
490 + return size;
491 +}
492 +# endif /* not HAVE_GETDTABLESIZE */
493 +#endif /* not HAVE__RPC_DTABLESIZE */
494 +
495 +#ifndef HAVE_INET_ATON
496 +/* Source: http://mail.gnu.org/archive/html/autoconf/2002-08/msg00036.html */
497 +/* $Id: ypserv-2.8.90-20030602.diff,v 1.1 2003/06/02 13:51:25 pere Exp $
498 +**
499 +** Replacement for a missing inet_aton.
500 +**
501 +** Written by Russ Allbery <rra@bogus.example.com>
502 +** This work is hereby placed in the public domain by its author.
503 +**
504 +** Provides the same functionality as the standard library routine
505 +** inet_aton for those platforms that don't have it. inet_aton is
506 +** thread-safe.
507 +*/
508 +
509 +/* #include "config.h" */
510 +/* #include "clibrary.h" */
511 +#include <netinet/in.h>
512 +
513 +/* If we're running the test suite, rename inet_ntoa to avoid conflicts with
514 + the system version. */
515 +#if TESTING
516 +# define inet_aton test_inet_aton
517 +int test_inet_aton(const char *, struct in_addr *);
518 +#endif
519 +
520 +int
521 +inet_aton(const char *s, struct in_addr *addr)
522 +{
523 + unsigned long octet[4], address;
524 + const char *p;
525 + int base, i;
526 + int part = 0;
527 +
528 + if (s == NULL) return 0;
529 +
530 + /* Step through each period-separated part of the address. If we see
531 + more than four parts, the address is invalid. */
532 + for (p = s; *p != 0; part++) {
533 + if (part > 3) return 0;
534 +
535 + /* Determine the base of the section we're looking at. Numbers are
536 + represented the same as in C; octal starts with 0, hex starts
537 + with 0x, and anything else is decimal. */
538 + if (*p == '0') {
539 + p++;
540 + if (*p == 'x') {
541 + p++;
542 + base = 16;
543 + } else {
544 + base = 8;
545 + }
546 + } else {
547 + base = 10;
548 + }
549 +
550 + /* Make sure there's actually a number. (A section of just "0"
551 + would set base to 8 and leave us pointing at a period; allow
552 + that.) */
553 + if (*p == '.' && base != 8) return 0;
554 + octet[part] = 0;
555 +
556 + /* Now, parse this segment of the address. For each digit, multiply
557 + the result so far by the base and then add the value of the
558 + digit. Be careful of arithmetic overflow in cases where an
559 + unsigned long is 32 bits; we need to detect it *before* we
560 + multiply by the base since otherwise we could overflow and wrap
561 + and then not detect the error. */
562 + for (; *p != 0 && *p != '.'; p++) {
563 + if (octet[part] > 0xffffffffUL / base) return 0;
564 +
565 + /* Use a switch statement to parse each digit rather than
566 + assuming ASCII. Probably pointless portability.... */
567 + switch (*p) {
568 + case '0': i = 0; break;
569 + case '1': i = 1; break;
570 + case '2': i = 2; break;
571 + case '3': i = 3; break;
572 + case '4': i = 4; break;
573 + case '5': i = 5; break;
574 + case '6': i = 6; break;
575 + case '7': i = 7; break;
576 + case '8': i = 8; break;
577 + case '9': i = 9; break;
578 + case 'A': case 'a': i = 10; break;
579 + case 'B': case 'b': i = 11; break;
580 + case 'C': case 'c': i = 12; break;
581 + case 'D': case 'd': i = 13; break;
582 + case 'E': case 'e': i = 14; break;
583 + case 'F': case 'f': i = 15; break;
584 + default: return 0;
585 + }
586 + if (i >= base) return 0;
587 + octet[part] = (octet[part] * base) + i;
588 + }
589 +
590 + /* Advance over periods; the top of the loop will increment the
591 + count of parts we've seen. We need a check here to detect an
592 + illegal trailing period. */
593 + if (*p == '.') {
594 + p++;
595 + if (*p == 0) return 0;
596 + }
597 + }
598 + if (part == 0) return 0;
599 +
600 + /* IPv4 allows three types of address specification:
601 +
602 + a.b
603 + a.b.c
604 + a.b.c.d
605 +
606 + If there are fewer than four segments, the final segment accounts for
607 + all of the remaining portion of the address. For example, in the a.b
608 + form, b is the final 24 bits of the address. We also allow a simple
609 + number, which is interpreted as the 32-bit number corresponding to
610 + the full IPv4 address.
611 +
612 + The first for loop below ensures that any initial segments represent
613 + only 8 bits of the address and builds the upper portion of the IPv4
614 + address. Then, the remaining segment is checked to make sure it's no
615 + bigger than the remaining space in the address and then is added into
616 + the result. */
617 + address = 0;
618 + for (i = 0; i < part - 1; i++) {
619 + if (octet[i] > 0xff) return 0;
620 + address |= octet[i] << (8 * (3 - i));
621 + }
622 + if (octet[i] > (0xffffffffUL >> (i * 8))) return 0;
623 + address |= octet[i];
624 + if (addr != NULL) addr->s_addr = htonl(address);
625 + return 1;
626 +}
627 +#endif /* not HAVE_INET_ATON */
628 +
629 +
630 +#ifndef HAVE_INET_PTON
631 +#include <arpa/inet.h>
632 +#include <sys/socket.h>
633 +int
634 +inet_pton(int af, const char *src, void *dst)
635 +{
636 + switch (af) {
637 + case AF_INET:
638 + return inet_aton(src, (struct in_addr *)dst);
639 + break;
640 +#ifdef AF_INET6
641 + case AF_INET6:
642 +#endif /* AF_INET6 */
643 + default:
644 + fprintf(stderr, "warning: Bogus inet_pton() called\n");
645 + errno = EAFNOSUPPORT;
646 + return -1;
647 + break;
648 + }
649 +}
650 +#endif /* not HAVE_INET_PTON */
651 +
652 +#ifndef HAVE_FGETPWENT
653 +struct passwd *
654 +fgetpwent(FILE *stream)
655 +{
656 + fprintf(stderr, "warning: Bogus fgetpwent() called\n");
657 + return NULL;
658 +}
659 +#endif /* not HAVE_FGETPWENT */
660 +
661 +#ifndef HAVE_PUTPWENT
662 +int
663 +putpwent(const struct passwd *p, FILE *stream)
664 +{
665 + fprintf(stderr, "warning: Bogus putpwent() called\n");
666 + return -1;
667 +}
668 +#endif /* not HAVE_PUTPWENT */
669 +
670 +#ifndef HAVE_FGETGRENT
671 +struct group *
672 +fgetgrent(FILE *stream)
673 +{
674 + fprintf(stderr, "warning: Bogus fgetgrent() called\n");
675 + return NULL;
676 +}
677 +#endif /* not HAVE_FGETGRENT */
678 +
679 +#ifndef HAVE_XDR_YPXFRSTAT
680 +#include <rpc/rpc.h>
681 +#include "yp.h"
682 +bool_t
683 +xdr_ypxfrstat(XDR *xdrs, ypxfrstat *objp)
684 +{
685 + if (!xdr_enum(xdrs, (enum_t *)objp))
686 + return FALSE;
687 +
688 + return TRUE;
689 +}
690 +#endif /* not HAVE_XDR_YPXFRSTAT */
691 +
692 +#ifndef HAVE_XDR_DOMAINNAME
693 +#include <rpc/rpc.h>
694 +bool_t
695 +xdr_domainname(XDR *xdrs, domainname *objp)
696 +{
697 + if (!xdr_string(xdrs, objp, YPMAXDOMAIN))
698 + return FALSE;
699 +
700 + return TRUE;
701 +}
702 +#endif /* not HAVE_XDR_DOMAINNAME */
703 +
704 +#ifndef HAVE_XDR_YPRESP_XFR
705 +#include <rpc/rpc.h>
706 +bool_t
707 +xdr_ypresp_xfr(XDR *xdrs, ypresp_xfr *objp)
708 +{
709 + if (!xdr_u_int(xdrs, &objp->transid))
710 + return FALSE;
711 +
712 + if (!xdr_ypxfrstat(xdrs, &objp->xfrstat))
713 + return FALSE;
714 +
715 + return TRUE;
716 +}
717 +#endif /* not HAVE_XDR_YPRESP_XFR */
718 +
719 +#ifndef HAVE_XDR_YPMAP_PARMS
720 +bool_t
721 +xdr_ypmap_parms(XDR *xdrs, ypmap_parms *objp)
722 +{
723 + if (!xdr_domainname(xdrs, &objp->domain))
724 + return (FALSE);
725 + if (!xdr_mapname(xdrs, &objp->map))
726 + return (FALSE);
727 + if (!xdr_u_int(xdrs, &objp->ordernum))
728 + return (FALSE);
729 + if (!xdr_peername(xdrs, &objp->peer))
730 + return (FALSE);
731 + return (TRUE);
732 +}
733 +#endif /* not HAVE_XDR_YPMAP_PARMS */
734 +
735 +
736 +#ifndef HAVE_XDR_YPREQ_XFR
737 +bool_t
738 +xdr_ypreq_xfr(XDR *xdrs, ypreq_xfr *objp)
739 +{
740 + if (!xdr_ypmap_parms(xdrs, &objp->map_parms))
741 + return (FALSE);
742 + if (!xdr_u_int(xdrs, &objp->transid))
743 + return (FALSE);
744 + if (!xdr_u_int(xdrs, &objp->prog))
745 + return (FALSE);
746 + if (!xdr_u_int(xdrs, &objp->port))
747 + return (FALSE);
748 + return (TRUE);
749 +}
750 +#endif /* not HAVE_XDR_YPREQ_XFR */
751 +
752 +#ifndef HAVE_XDR_MAPNAME
753 +bool_t
754 +xdr_mapname (XDR *xdrs, mapname *objp)
755 +{
756 + if (!xdr_string (xdrs, objp, YPMAXMAP))
757 + return FALSE;
758 +
759 + return TRUE;
760 +}
761 +#endif /* not HAVE_XDR_MAPNAME */
762 +
763 +#ifndef HAVE_XDR_PEERNAME
764 +bool_t
765 +xdr_peername (XDR *xdrs, peername *objp)
766 +{
767 + if (!xdr_string (xdrs, objp, YPMAXPEER))
768 + return (FALSE);
769 + return (TRUE);
770 +}
771 +#endif /* not HAVE_XDR_PEERNAME */
772 +
773 +#ifndef HAVE_XDR_YPSTAT
774 +bool_t
775 +xdr_ypstat (XDR *xdrs, ypstat *objp)
776 +{
777 + if (!xdr_enum (xdrs, (enum_t *) objp))
778 + return FALSE;
779 +
780 + return TRUE;
781 +}
782 +#endif /* not HAVE_XDR_YPSTAT */
783 +
784 +#ifndef HAVE_XDR_YPRESP_MASTER
785 +bool_t
786 +xdr_ypresp_master (XDR *xdrs, ypresp_master *objp)
787 +{
788 + if (!xdr_ypstat (xdrs, &objp->stat))
789 + return FALSE;
790 + if (!xdr_peername (xdrs, &objp->peer))
791 + return FALSE;
792 + return TRUE;
793 +}
794 +#endif /* not HAVE_XDR_YPRESP_MASTER */
795 +
796 +#ifndef HAVE_XDR_YPBIND_BINDING
797 +bool_t
798 +xdr_ypbind_binding (XDR *xdrs, ypbind_binding *objp)
799 +{
800 + if (!xdr_opaque (xdrs, objp->ypbind_binding_addr, 4))
801 + return FALSE;
802 + if (!xdr_opaque (xdrs, objp->ypbind_binding_port, 2))
803 + return FALSE;
804 + return TRUE;
805 +}
806 +#endif /* not HAVE_XDR_YPBIND_BINDING */
807 +
808 +#ifndef HAVE_XDR_YPREQ_NOKEY
809 +bool_t
810 +xdr_ypreq_nokey (XDR *xdrs, ypreq_nokey *objp)
811 +{
812 + if (!xdr_domainname (xdrs, &objp->domain))
813 + return FALSE;
814 +
815 + if (!xdr_mapname (xdrs, &objp->map))
816 + return FALSE;
817 +
818 + return TRUE;
819 +}
820 +#endif /* not HAVE_XDR_YPREQ_NOKEY */
821 +
822 +#ifndef HAVE_XDR_YPPUSH_STATUS
823 +bool_t
824 +xdr_yppush_status(XDR *xdrs, yppush_status *objp)
825 +{
826 + if (!xdr_enum(xdrs, (enum_t *)objp))
827 + return (FALSE);
828 + return (TRUE);
829 +}
830 +#endif /* not HAVE_XDR_YPPUSH_STATUS */
831 +
832 +#ifndef HAVE_XDR_YPPUSHRESP_XFR
833 +bool_t
834 +xdr_yppushresp_xfr(XDR *xdrs, yppushresp_xfr *objp)
835 +{
836 + if (!xdr_u_int(xdrs, &objp->transid))
837 + return (FALSE);
838 + if (!xdr_yppush_status(xdrs, &objp->status))
839 + return (FALSE);
840 + return (TRUE);
841 +}
842 +#endif /* not HAVE_XDR_YPPUSHRESP_XFR */
843 diff -uNr src-2.8.90/lib/compat.h src-2.8.90-local/lib/compat.h
844 --- src-2.8.90/lib/compat.h 1970-01-01 01:00:00.000000000 +0100
845 +++ src-2.8.90-local/lib/compat.h 2003-05-29 08:33:02.000000000 +0200
846 @@ -0,0 +1,82 @@
847 +/* Copyright (c) 2000 Thorsten Kukuk
848 + Author: Thorsten Kukuk <kukuk@suse.de>
849 +
850 + The YP Server is free software; you can redistribute it and/or
851 + modify it under the terms of the GNU General Public License as
852 + published by the Free Software Foundation; either version 2 of the
853 + License, or (at your option) any later version.
854 +
855 + The YP Server is distributed in the hope that it will be useful,
856 + but WITHOUT ANY WARRANTY; without even the implied warranty of
857 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
858 + General Public License for more details.
859 +
860 + You should have received a copy of the GNU General Public
861 + License along with the YP Server; see the file COPYING. If
862 + not, write to the Free Software Foundation, Inc., 675 Mass Ave,
863 + Cambridge, MA 02139, USA. */
864 +
865 +#ifndef _YPSERV_COMPAT_H
866 +#define _YPSERV_COMPAT_H
867 +
868 +#include "config.h"
869 +
870 +/* __attribute__ is only in GCC */
871 +#ifdef __GNUC__
872 +#define UNUSED __attribute__ ((unused))
873 +#else
874 +#define UNUSED
875 +#endif
876 +
877 +#ifndef HAVE_STPCPY
878 +char *stpcpy(char *, const char *);
879 +#endif /* not HAVE_STPCPY */
880 +
881 +#ifndef HAVE_STRNDUP
882 +char *strndup (const char *, int);
883 +#endif /* not HAVE_STRNDUP */
884 +
885 +extern int svc_max_pollfd;
886 +extern struct pollfd *svc_pollfd;
887 +
888 +#ifndef HAVE_GETOPT_LONG
889 +struct option {
890 + const char *name;
891 + int has_arg;
892 + int *flag;
893 + int val;
894 +};
895 +
896 +# define no_argument 0
897 +# define required_argument 1
898 +# define optional_argument 2
899 +
900 +int getopt_long (int argc, char *const *argv, const char *shortopts,
901 + const struct option *longopts, int *longind);
902 +#endif /* not HAVE_GETOPT_LONG */
903 +
904 +#if !defined(HAVE_GETDELIM) && !defined(HAVE_GETLINE)
905 +/* Use getline() if getdelim() is missing */
906 +#include <unistd.h> /* size_t */
907 +#include <stdio.h> /* FILE */
908 +ssize_t getline (char **lineptr, size_t *n, FILE *stream);
909 +#endif /* not HAVE_GETDELIM and not HAVE_GETLINE */
910 +
911 +#ifndef HAVE_SVC_GETCALLER
912 +# include <rpc/rpc.h>
913 +# if !defined(svc_getcaller)
914 +struct sockaddr_in;
915 +const struct sockaddr_in *svc_getcaller(const SVCXPRT *xprt);
916 +# endif
917 +#endif /* not HAVE_SVC_GETCALLER */
918 +
919 +#ifndef HAVE__RPC_DTABLESIZE
920 +int _rpc_dtablesize(void);
921 +#endif
922 +
923 +#ifndef HAVE_INET_PTON
924 +int inet_pton(int af, const char *src, void *dst);
925 +#endif /* not HAVE_INET_PTON */
926 +
927 +
928 +#endif /* not _YPSERV_COMPAT_H */
929 diff -ur src-2.8.90/makedbm/Makefile.am src-2.8.90-local/makedbm/Makefile.am
930 --- src-2.8.90/makedbm/Makefile.am 2003-02-04 18:06:20.000000000 +0100
931 +++ src-2.8.90-local/makedbm/Makefile.am 2003-05-21 17:53:23.000000000 +0200
932 @@ -8,7 +8,6 @@
933
934 localedir = $(datadir)/locale
935
936 -AM_CFLAGS = @EXTRA_CFLAGS@
937 DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\" -DYPBINDIR=\"$(libexecdir)\" \
938 -DCONFDIR=\"$(sysconfdir)\" -DYPMAPDIR=\"/var/yp\" \
939 -DUSE_FQDN=@USE_FQDN@
940 diff -ur src-2.8.90/makedbm/makedbm.c src-2.8.90-local/makedbm/makedbm.c
941 --- src-2.8.90/makedbm/makedbm.c 2002-12-21 14:53:26.000000000 +0100
942 +++ src-2.8.90-local/makedbm/makedbm.c 2003-05-30 13:01:18.000000000 +0200
943 @@ -22,18 +22,23 @@
944 #include "config.h"
945 #endif
946
947 +#ifdef HAVE_ALLOCA_H
948 #include <alloca.h>
949 +#endif /* HAVE_ALLOCA_H */
950 #include <stdio.h>
951 #include <stdlib.h>
952 #include <string.h>
953 #include <unistd.h>
954 +#ifdef HAVE_GETOPT_H
955 #include <getopt.h>
956 +#endif /* HAVE_GETOPT_H */
957 #include <fcntl.h>
958 #include <ctype.h>
959 #include <netdb.h>
960 #include <rpc/rpc.h>
961
962 #include "yp.h"
963 +#include "compat.h"
964
965 #if defined (__NetBSD__) || (defined(__GLIBC__) && (__GLIBC__ == 2 && __GLIBC_MINOR__ == 0))
966 /* <rpc/rpc.h> is missing the prototype */
967 diff -ur src-2.8.90/mknetid/Makefile.am src-2.8.90-local/mknetid/Makefile.am
968 --- src-2.8.90/mknetid/Makefile.am 2003-02-04 18:06:24.000000000 +0100
969 +++ src-2.8.90-local/mknetid/Makefile.am 2003-05-21 17:53:33.000000000 +0200
970 @@ -8,7 +8,6 @@
971
972 localedir = $(datadir)/locale
973
974 -AM_CFLAGS = @EXTRA_CFLAGS@
975 DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\" -DYPBINDIR=\"$(libexecdir)\" \
976 -DCONFDIR=\"$(sysconfdir)\" -DYPMAPDIR=\"/var/yp\"
977 INCLUDES = -I$(top_srcdir)/lib -I$(top_srcdir) -I$(top_builddir) -I$(srcdir)
978 @@ -25,3 +24,4 @@
979
980 mknetid_SOURCES = mknetid.c netid_hash.c
981
982 +mknetid_LDADD = $(top_builddir)/lib/libyp.a
983 diff -ur src-2.8.90/mknetid/mknetid.c src-2.8.90-local/mknetid/mknetid.c
984 --- src-2.8.90/mknetid/mknetid.c 2002-04-26 21:58:03.000000000 +0200
985 +++ src-2.8.90-local/mknetid/mknetid.c 2003-05-21 16:07:50.000000000 +0200
986 @@ -29,9 +29,12 @@
987 #include <unistd.h>
988 #include <rpc/types.h>
989 #include <rpcsvc/ypclnt.h>
990 +#ifdef HAVE_GETOPT_H
991 #include <getopt.h>
992 +#endif
993
994 #include "mknetid.h"
995 +#include "compat.h"
996
997 static int quiet_flag = 0;
998
999 @@ -156,10 +159,10 @@
1000
1001 while (!feof (file))
1002 {
1003 -#ifdef HAVE_GETLINE
1004 - ssize_t n = getline (&line, &length, file);
1005 -#elif HAVE_GETDELIM
1006 +#if HAVE_GETDELIM
1007 ssize_t n = getdelim (&line, &length, '\n', file);
1008 +#else
1009 + ssize_t n = getline (&line, &length, file);
1010 #endif
1011 if (n < 1)
1012 break;
1013 @@ -189,10 +192,10 @@
1014
1015 while (!feof (file))
1016 {
1017 -#ifdef HAVE_GETLINE
1018 - ssize_t n = getline (&line, &length, file);
1019 -#elif HAVE_GETDELIM
1020 +#if HAVE_GETDELIM
1021 ssize_t n = getdelim (&line, &length, '\n', file);
1022 +#else
1023 + ssize_t n = getline (&line, &length, file);
1024 #endif
1025 if (n < 1)
1026 break;
1027 @@ -224,10 +227,10 @@
1028
1029 while (!feof (file))
1030 {
1031 -#ifdef HAVE_GETLINE
1032 - ssize_t n = getline (&line, &length, file);
1033 -#elif HAVE_GETDELIM
1034 +#if HAVE_GETDELIM
1035 ssize_t n = getdelim (&line, &length, '\n', file);
1036 +#else
1037 + ssize_t n = getline (&line, &length, file);
1038 #endif
1039 if (n < 1)
1040 break;
1041 @@ -260,10 +263,10 @@
1042 {
1043 while (!feof (file))
1044 {
1045 -#ifdef HAVE_GETLINE
1046 - ssize_t n = getline (&line, &length, file);
1047 -#elif HAVE_GETDELIM
1048 +#if HAVE_GETDELIM
1049 ssize_t n = getdelim (&line, &length, '\n', file);
1050 +#else
1051 + ssize_t n = getline (&line, &length, file);
1052 #endif
1053 if (n < 1)
1054 break;
1055 diff -ur src-2.8.90/revnetgroup/Makefile.am src-2.8.90-local/revnetgroup/Makefile.am
1056 --- src-2.8.90/revnetgroup/Makefile.am 2003-02-04 18:06:27.000000000 +0100
1057 +++ src-2.8.90-local/revnetgroup/Makefile.am 2003-05-21 17:53:44.000000000 +0200
1058 @@ -8,7 +8,6 @@
1059
1060 localedir = $(datadir)/locale
1061
1062 -AM_CFLAGS = @EXTRA_CFLAGS@
1063 DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\" -DYPBINDIR=\"$(libexecdir)\" \
1064 -DCONFDIR=\"$(sysconfdir)\" -DYPMAPDIR=\"/var/yp\"
1065 INCLUDES = -I$(top_srcdir)/lib -I$(top_srcdir) -I$(top_builddir) -I$(srcdir)
1066 @@ -25,3 +24,4 @@
1067
1068 revnetgroup_SOURCES = revnetgroup.c getnetgrent.c hash.c
1069
1070 +revnetgroup_LDADD = $(top_builddir)/lib/libyp.a
1071 diff -ur src-2.8.90/revnetgroup/hash.c src-2.8.90-local/revnetgroup/hash.c
1072 --- src-2.8.90/revnetgroup/hash.c 2001-03-25 15:37:45.000000000 +0200
1073 +++ src-2.8.90-local/revnetgroup/hash.c 2003-05-21 14:36:16.000000000 +0200
1074 @@ -32,13 +32,10 @@
1075 #include <string.h>
1076 #include "hash.h"
1077 #include <assert.h>
1078 +#include "compat.h"
1079
1080 #define TABLESIZE 997 /*Should be a prime */
1081
1082 -#ifndef HAVE_STRDUP
1083 -#include "compat/strdup.c"
1084 -#endif
1085 -
1086 /*
1087 * hash_malloc(void)
1088 *
1089 @@ -143,7 +140,7 @@
1090 *
1091 */
1092 int
1093 -hash_free (hash_t **table __attribute__ ((unused)))
1094 +hash_free (hash_t **table UNUSED)
1095 {
1096 /* XXX Not implementet yet! */
1097
1098 diff -ur src-2.8.90/revnetgroup/revnetgroup.c src-2.8.90-local/revnetgroup/revnetgroup.c
1099 --- src-2.8.90/revnetgroup/revnetgroup.c 2001-03-25 15:37:45.000000000 +0200
1100 +++ src-2.8.90-local/revnetgroup/revnetgroup.c 2003-05-21 15:10:48.000000000 +0200
1101 @@ -24,11 +24,12 @@
1102 #include <stdio.h>
1103 #include <stdlib.h>
1104 #include <string.h>
1105 -#if defined(HAVE_GETOPT_H) && defined(HAVE_GETOPT_LONG)
1106 +#if defined(HAVE_GETOPT_H)
1107 #include <getopt.h>
1108 #endif
1109
1110 #include "hash.h"
1111 +#include "compat.h"
1112
1113 #define PARSE_FOR_USERS 0
1114 #define PARSE_FOR_HOSTS 1
1115 diff -ur src-2.8.90/rpc.yppasswdd/Makefile.am src-2.8.90-local/rpc.yppasswdd/Makefile.am
1116 --- src-2.8.90/rpc.yppasswdd/Makefile.am 2003-02-04 18:06:41.000000000 +0100
1117 +++ src-2.8.90-local/rpc.yppasswdd/Makefile.am 2003-05-21 17:53:52.000000000 +0200
1118 @@ -8,7 +8,6 @@
1119
1120 localedir = $(datadir)/locale
1121
1122 -AM_CFLAGS = @EXTRA_CFLAGS@
1123 DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\" -DYPBINDIR=\"$(libexecdir)\" \
1124 -DCONFDIR=\"$(sysconfdir)\" -DYPMAPDIR=\"@YPMAPDIR@\" \
1125 -DUSE_FQDN=@USE_FQDN@
1126 diff -ur src-2.8.90/rpc.yppasswdd/update.c src-2.8.90-local/rpc.yppasswdd/update.c
1127 --- src-2.8.90/rpc.yppasswdd/update.c 2001-04-08 22:40:10.000000000 +0200
1128 +++ src-2.8.90-local/rpc.yppasswdd/update.c 2003-05-30 11:48:18.000000000 +0200
1129 @@ -26,6 +26,10 @@
1130 #include <errno.h>
1131 #include <unistd.h>
1132 #include <string.h>
1133 +#ifdef HAVE_ALLOCA_H
1134 +#include <alloca.h>
1135 +#endif /* HAVE_ALLOCA_H */
1136 +#include <stdlib.h>
1137 #include <sys/stat.h>
1138 #include <sys/wait.h>
1139 #include <netinet/in.h>
1140 @@ -40,6 +44,7 @@
1141 #ifdef HAVE_SHADOW_H
1142 #include <shadow.h>
1143 #endif
1144 +#include "compat.h"
1145
1146 #ifndef CHECKROOT
1147 /* Set to 0 if you don't want to check against the root password
1148 @@ -187,7 +192,7 @@
1149 int retries;
1150 static int res; /* I hate static variables */
1151 char *logbuf;
1152 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1153 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1154
1155 /* Be careful here with the debug option. You can see the old
1156 and new password in clear text !! */
1157 @@ -276,6 +281,7 @@
1158 }
1159 else
1160 {
1161 +#ifdef HAVE_LCKPWDF
1162 /* Lock the passwd file. We retry several times. */
1163 retries = 0;
1164 while (lckpwdf () && retries < MAX_RETRIES)
1165 @@ -290,11 +296,14 @@
1166 log_msg ("password file locked");
1167 return &res;
1168 }
1169 +#endif /* HAVE_LCKPWDF */
1170
1171 res = update_files (yppw, logbuf, &shadow_changed, &passwd_changed,
1172 &chfn, &chsh);
1173
1174 +#ifdef HAVE_LCKPWDF
1175 ulckpwdf ();
1176 +#endif /* HAVE_LCKPWDF */
1177 }
1178
1179 /* Fork off process to rebuild NIS passwd.* maps. */
1180 @@ -358,6 +367,7 @@
1181 {
1182 if (strcmp (pw->pw_passwd, "x") == 0)
1183 {
1184 +#ifdef HAVE_GETSPNAM /* shadow password */
1185 struct spwd *spw;
1186
1187 if ((spw = getspnam ("root")) != NULL)
1188 @@ -365,6 +375,7 @@
1189 rootpass = alloca (strlen (spw->sp_pwdp) + 1);
1190 strcpy (rootpass, spw->sp_pwdp);
1191 }
1192 +#endif /* HAVE_GETSPNAM */
1193 }
1194 else
1195 {
1196 @@ -402,6 +413,7 @@
1197 chmod (path_passwd_tmp, passwd_stat.st_mode);
1198 chown (path_passwd_tmp, passwd_stat.st_uid, passwd_stat.st_gid);
1199
1200 +#ifdef HAVE_GETSPNAM
1201 /* Open the shadow file for reading. */
1202 if ((oldsf = fopen (path_shadow, "r")) != NULL)
1203 {
1204 @@ -426,6 +438,7 @@
1205 chmod (path_shadow_tmp, shadow_stat.st_mode);
1206 chown (path_shadow_tmp, shadow_stat.st_uid, shadow_stat.st_gid);
1207 }
1208 +#endif /* HAVE_GETSPNAM */
1209
1210 /* Loop over all passwd entries */
1211 while ((pw = fgetpwent (oldpf)) != NULL)
1212 @@ -442,6 +455,7 @@
1213 if (oldsf != NULL &&
1214 pw->pw_passwd[0] == 'x' && pw->pw_passwd[1] == '\0')
1215 {
1216 +#ifdef HAVE_GETSPNAM /* shadow password */
1217 /* Search for the shadow entry of this user */
1218 while ((spw = fgetspent (oldsf)) != NULL)
1219 {
1220 @@ -463,6 +477,7 @@
1221 goto error;
1222 }
1223 }
1224 +#endif /* HAVE_GETSPNAM */
1225 }
1226
1227 /* We don't have a shadow password file or we don't find the
1228 @@ -483,6 +498,7 @@
1229 yppw->newpw.pw_passwd[1] == '\0') &&
1230 yppw->newpw.pw_passwd[0] != '\0')
1231 {
1232 +#ifdef HAVE_GETSPNAM /* shadow password */
1233 if (spw)
1234 {
1235 /* test if password is expired */
1236 @@ -525,6 +541,7 @@
1237 }
1238 }
1239 else /* No shadow entry */
1240 +#endif /* HAVE_GETSPNAM */
1241 {
1242 /* set the new passwd */
1243 pw->pw_passwd = yppw->newpw.pw_passwd;
1244 @@ -593,9 +610,12 @@
1245 if (pw || spw)
1246 {
1247 unlink (path_passwd_tmp);
1248 +#ifdef HAVE_GETSPNAM
1249 unlink (path_shadow_tmp);
1250 +#endif /* HAVE_GETSPNAM */
1251 return 1;
1252 }
1253 +#ifdef HAVE_GETSPNAM
1254 if (*shadow_changed)
1255 {
1256 unlink (path_shadow_old);
1257 @@ -604,6 +624,7 @@
1258 }
1259 else
1260 unlink (path_shadow_tmp);
1261 +#endif /* HAVE_GETSPNAM */
1262
1263 if (*passwd_changed)
1264 {
1265 @@ -634,7 +655,13 @@
1266 }
1267 else
1268 { /* Child - run external update program */
1269 -#if (defined(__sun__) || defined(sun)) && defined(__svr4__)
1270 +#if defined(HAVE_SETENV)
1271 + setenv ("YP_PASSWD_OLD", yppw->oldpass, 1);
1272 + setenv ("YP_PASSWD_NEW", yppw->newpw.pw_passwd, 1);
1273 + setenv ("YP_USER", yppw->newpw.pw_name, 1);
1274 + setenv ("YP_GECOS", yppw->newpw.pw_gecos, 1);
1275 + setenv ("YP_SHELL", yppw->newpw.pw_shell, 1);
1276 +#elif defined(HAVE_PUTENV)
1277 char aenv[5*64], *p;
1278 p = aenv;
1279 sprintf(p, "YP_PASSWD_OLD=%s", yppw->oldpass);
1280 @@ -652,11 +679,7 @@
1281 sprintf(p, "YP_SHELL=%s", yppw->newpw.pw_shell);
1282 putenv(p);
1283 #else
1284 - setenv ("YP_PASSWD_OLD", yppw->oldpass, 1);
1285 - setenv ("YP_PASSWD_NEW", yppw->newpw.pw_passwd, 1);
1286 - setenv ("YP_USER", yppw->newpw.pw_name, 1);
1287 - setenv ("YP_GECOS", yppw->newpw.pw_gecos, 1);
1288 - setenv ("YP_SHELL", yppw->newpw.pw_shell, 1);
1289 +# error "Missing both setenv() and putenv(). Need porting."
1290 #endif
1291 execlp (external_update_program, external_update_program, NULL);
1292 _exit (1); /* fall-through */
1293 diff -ur src-2.8.90/rpc.yppasswdd/yppasswdd.c src-2.8.90-local/rpc.yppasswdd/yppasswdd.c
1294 --- src-2.8.90/rpc.yppasswdd/yppasswdd.c 2001-09-02 20:23:26.000000000 +0200
1295 +++ src-2.8.90-local/rpc.yppasswdd/yppasswdd.c 2003-05-30 13:05:12.000000000 +0200
1296 @@ -23,6 +23,14 @@
1297 #include "config.h"
1298 #endif
1299
1300 +#if 0
1301 +/* get sigaction */
1302 +#define _POSIX_SOURCE
1303 +/* #define _XOPEN_SOURCE_EXTENDED */
1304 +#define __USE_POSIX199309
1305 +#define __USE_UNIX98
1306 +#endif
1307 +
1308 #include <sys/types.h>
1309 #include <sys/socket.h>
1310 #include <sys/ioctl.h>
1311 @@ -34,6 +42,7 @@
1312 #include <fcntl.h>
1313 #include <syslog.h>
1314 #include <stdio.h>
1315 +#include <stdlib.h>
1316 #include <string.h>
1317 #include <errno.h>
1318 #include <rpc/rpc.h>
1319 @@ -42,21 +51,12 @@
1320 #include <rpc/svc_soc.h>
1321 #endif
1322 #include "yppasswd.h"
1323 -#if defined(HAVE_GETOPT_H) && defined(HAVE_GETOPT_LONG)
1324 +#if defined(HAVE_GETOPT_H)
1325 #include <getopt.h>
1326 -#else
1327 -#include <compat/getopt.h>
1328 -#endif
1329 -#ifndef HAVE_GETOPT_LONG
1330 -#include <compat/getopt.c>
1331 -#include <compat/getopt1.c>
1332 -#endif
1333 -
1334 -#ifndef HAVE_STRERROR
1335 -#include <compat/strerror.c>
1336 #endif
1337
1338 #include "log_msg.h"
1339 +#include "compat.h"
1340
1341 #ifdef HAVE_PATHS_H
1342 #include <paths.h>
1343 @@ -197,14 +197,14 @@
1344 }
1345
1346 static void
1347 -sig_child (int sig __attribute__ ((unused)))
1348 +sig_child (int sig UNUSED)
1349 {
1350 wait (NULL);
1351 }
1352
1353 /* Clean up if we quit the program. */
1354 static void
1355 -sig_quit (int sig __attribute__ ((unused)))
1356 +sig_quit (int sig UNUSED)
1357 {
1358 pmap_unset (YPPASSWDPROG, YPPASSWDVERS);
1359 unlink (_YPPASSWDD_PIDFILE);
1360 diff -ur src-2.8.90/rpc.ypxfrd/Makefile.am src-2.8.90-local/rpc.ypxfrd/Makefile.am
1361 --- src-2.8.90/rpc.ypxfrd/Makefile.am 2003-02-04 18:06:56.000000000 +0100
1362 +++ src-2.8.90-local/rpc.ypxfrd/Makefile.am 2003-05-21 17:54:15.000000000 +0200
1363 @@ -8,7 +8,6 @@
1364
1365 localedir = $(datadir)/locale
1366
1367 -AM_CFLAGS = @EXTRA_CFLAGS@
1368 DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\" -DYPBINDIR=\"$(libexecdir)\" \
1369 -DCONFDIR=\"$(sysconfdir)\" -DYPMAPDIR=\"@YPMAPDIR@\" \
1370 -DUSE_FQDN=@USE_FQDN@ -DXFRBLOCKSIZE=65535
1371 diff -ur src-2.8.90/rpc.ypxfrd/ypxfrd.c src-2.8.90-local/rpc.ypxfrd/ypxfrd.c
1372 --- src-2.8.90/rpc.ypxfrd/ypxfrd.c 2002-12-21 14:53:26.000000000 +0100
1373 +++ src-2.8.90-local/rpc.ypxfrd/ypxfrd.c 2003-05-29 08:08:37.000000000 +0200
1374 @@ -45,7 +45,9 @@
1375 #include <rpc/svc_soc.h>
1376 #endif
1377 #include <rpc/pmap_clnt.h>
1378 +#ifdef HAVE_GETOPT_H
1379 #include <getopt.h>
1380 +#endif /* HAVE_GETOPT_H */
1381 #include "ypxfrd.h"
1382 #include "access.h"
1383 #include "ypserv_conf.h"
1384 @@ -55,6 +57,7 @@
1385 #endif
1386
1387 #include "log_msg.h"
1388 +#include "compat.h"
1389
1390 extern void ypxfrd_freebsd_prog_1(struct svc_req *, SVCXPRT *);
1391
1392 @@ -73,40 +76,6 @@
1393
1394 char *progname;
1395
1396 -#if HAVE__RPC_DTABLESIZE
1397 -extern int _rpc_dtablesize(void);
1398 -#elif HAVE_GETDTABLESIZE
1399 -static int
1400 -_rpc_dtablesize()
1401 -{
1402 - static int size;
1403 -
1404 - if (size == 0)
1405 - {
1406 - size = getdtablesize();
1407 - }
1408 - return (size);
1409 -}
1410 -#else
1411 -
1412 -#include <sys/resource.h>
1413 -
1414 -static int
1415 -_rpc_dtablesize()
1416 -{
1417 - static int size = 0;
1418 - struct rlimit rlb;
1419 -
1420 - if (size == 0)
1421 - {
1422 - if (getrlimit(RLIMIT_NOFILE, &rlb) >= 0)
1423 - size = rlb.rlim_cur;
1424 - }
1425 -
1426 - return size;
1427 -}
1428 -#endif
1429 -
1430 /*
1431 ** Needed, if we start rpc.ypxfrd from inetd
1432 */
1433 @@ -135,7 +104,7 @@
1434
1435 /* Clean up after child processes signal their termination. */
1436 static void
1437 -sig_child (int sig __attribute__ ((unused)))
1438 +sig_child (int sig UNUSED)
1439 {
1440 int st;
1441
1442 @@ -146,7 +115,7 @@
1443
1444 /* Clean up if we quit the program. */
1445 static void
1446 -sig_quit (int sig __attribute__ ((unused)))
1447 +sig_quit (int sig UNUSED)
1448 {
1449 pmap_unset (YPXFRD_FREEBSD_PROG, YPXFRD_FREEBSD_VERS);
1450 exit (0);
1451 @@ -156,7 +125,7 @@
1452 ** Reload securenets and config file
1453 */
1454 static void
1455 -sig_hup (int sig __attribute__ ((unused)))
1456 +sig_hup (int sig UNUSED)
1457 {
1458 load_securenets();
1459 load_config();
1460 diff -ur src-2.8.90/rpc.ypxfrd/ypxfrd_server.c src-2.8.90-local/rpc.ypxfrd/ypxfrd_server.c
1461 --- src-2.8.90/rpc.ypxfrd/ypxfrd_server.c 2002-12-21 14:53:26.000000000 +0100
1462 +++ src-2.8.90-local/rpc.ypxfrd/ypxfrd_server.c 2003-05-29 08:39:02.000000000 +0200
1463 @@ -40,6 +40,7 @@
1464 #include "ypxfrd.h"
1465 #include "access.h"
1466 #include "yp_db.h"
1467 +#include "compat.h"
1468
1469 static int file = 0;
1470
1471 @@ -97,7 +98,7 @@
1472 {
1473 static struct xfr result;
1474 char buf[MAXPATHLEN];
1475 - struct sockaddr_in *rqhost;
1476 + const struct sockaddr_in *rqhost;
1477 int valid;
1478
1479 if (debug_flag)
1480 diff -ur src-2.8.90/rpc.ypxfrd/ypxfrd_svc.c src-2.8.90-local/rpc.ypxfrd/ypxfrd_svc.c
1481 --- src-2.8.90/rpc.ypxfrd/ypxfrd_svc.c 2001-04-08 17:21:53.000000000 +0200
1482 +++ src-2.8.90-local/rpc.ypxfrd/ypxfrd_svc.c 2003-05-28 10:01:44.000000000 +0200
1483 @@ -23,6 +23,7 @@
1484
1485 #include <stdio.h>
1486 #include <stdlib.h>
1487 +#include <rpc/rpc.h>
1488 #include <rpc/pmap_clnt.h>
1489 #include <string.h>
1490 #include <signal.h>
1491 diff -ur src-2.8.90/yphelper/Makefile.am src-2.8.90-local/yphelper/Makefile.am
1492 --- src-2.8.90/yphelper/Makefile.am 2003-02-04 18:07:30.000000000 +0100
1493 +++ src-2.8.90-local/yphelper/Makefile.am 2003-05-21 17:53:58.000000000 +0200
1494 @@ -8,7 +8,6 @@
1495
1496 localedir = $(datadir)/locale
1497
1498 -AM_CFLAGS = @EXTRA_CFLAGS@
1499 INCLUDES = -I$(top_srcdir)/lib -I$(top_srcdir) -I$(top_builddir) -I$(srcdir)
1500
1501 DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\" -DYPBINDIR=\"$(libexecdir)\" \
1502 @@ -25,4 +24,4 @@
1503
1504 yphelper_SOURCES = yphelper.c
1505
1506 -yphelper_LDADD = @LIBDBM@
1507 +yphelper_LDADD = $(top_builddir)/lib/libyp.a @LIBDBM@
1508 diff -ur src-2.8.90/yphelper/yphelper.c src-2.8.90-local/yphelper/yphelper.c
1509 --- src-2.8.90/yphelper/yphelper.c 2003-02-05 15:37:15.000000000 +0100
1510 +++ src-2.8.90-local/yphelper/yphelper.c 2003-05-30 13:17:16.000000000 +0200
1511 @@ -21,17 +21,23 @@
1512 #include "config.h"
1513 #endif
1514
1515 +#include <sys/types.h>
1516 #include <grp.h>
1517 #include <pwd.h>
1518 #include <netdb.h>
1519 #include <rpc/types.h>
1520 #include <strings.h>
1521 #include <sys/socket.h>
1522 +#include <sys/param.h>
1523 #include <netinet/in.h>
1524 #include <arpa/inet.h>
1525 #include <unistd.h>
1526 #include <ctype.h>
1527 -#if defined(HAVE_GETOPT_H) && defined(HAVE_GETOPT_LONG)
1528 +#ifdef HAVE_ALLOCA_H
1529 +#include <alloca.h>
1530 +#endif /* HAVE_ALLOCA_H */
1531 +#include <stdlib.h>
1532 +#if defined(HAVE_GETOPT_H)
1533 #include <getopt.h>
1534 #endif
1535 #if defined(HAVE_LIBGDBM)
1536 @@ -40,6 +46,7 @@
1537 #include <ndbm.h>
1538 #endif
1539 #include "yp.h"
1540 +#include "compat.h"
1541 #include <rpcsvc/ypclnt.h>
1542 #include <arpa/nameser.h>
1543 #ifdef HAVE_SHADOW_H
1544 @@ -178,7 +185,7 @@
1545 hp = gethostbyaddr (addr, sizeof (addr), AF_INET);
1546 }
1547 else
1548 - hp = gethostbyname2 (hostname, AF_INET);
1549 + hp = gethostbyname (hostname);
1550
1551 if (hp == NULL)
1552 fputs (hostname, stdout);
1553 @@ -219,7 +226,7 @@
1554 hp = gethostbyaddr (addr, sizeof (addr), AF_INET);
1555 }
1556 else
1557 - hp = gethostbyname2 (server, AF_INET);
1558 + hp = gethostbyname (server);
1559 if (hp != NULL)
1560 {
1561 server = alloca (strlen (hp->h_name) + 1);
1562 @@ -312,6 +319,7 @@
1563 (pwd->pw_passwd[0] == 'x' || pwd->pw_passwd[0] == '*'))
1564 {
1565 pass = NULL;
1566 +#ifdef HAVE_GETSPNAM /* shadow password */
1567 spd = fgetspent (s_input);
1568 if (spd != NULL)
1569 {
1570 @@ -330,6 +338,7 @@
1571 }
1572 }
1573 }
1574 +#endif /* HAVE_GETSPNAM */
1575 if (pass == NULL)
1576 pass = pwd->pw_passwd;
1577 }
1578 @@ -347,6 +356,7 @@
1579 exit (0);
1580 }
1581
1582 +#ifdef HAVE_GETSPNAM /* shadow password */
1583 static struct __sgrp *
1584 fgetsgent (FILE *fp)
1585 {
1586 @@ -377,6 +387,7 @@
1587 }
1588 return 0;
1589 }
1590 +#endif /* HAVE_GETSPNAM */
1591
1592 static void
1593 merge_group (char *group, char *gshadow)
1594 @@ -421,6 +432,7 @@
1595 (grp->gr_passwd[0] == 'x' || grp->gr_passwd[0] == '*'))
1596 {
1597 pass = NULL;
1598 +#ifdef HAVE_GETSPNAM /* shadow password */
1599 spd = fgetsgent (s_input);
1600 if (spd != NULL)
1601 {
1602 @@ -439,6 +451,7 @@
1603 }
1604 }
1605 }
1606 +#endif /* HAVE_GETSPNAM */
1607 if (pass == NULL)
1608 pass = grp->gr_passwd;
1609 }
1610 @@ -557,17 +570,20 @@
1611 hp = gethostbyaddr (addr, sizeof (addr), AF_INET);
1612 }
1613 else
1614 - hp = gethostbyname2 (hostname, AF_INET);
1615 + hp = gethostbyname (hostname);
1616
1617 if (hp != NULL)
1618 - hostname = strdupa (hp->h_name);
1619 + hostname = strdup (hp->h_name);
1620 #endif
1621
1622 if (strcasecmp (hostname,
1623 get_dbm_entry ("YP_MASTER_NAME", map, domainname)) == 0)
1624 - exit (0);
1625 + ret = 0;
1626 else
1627 - exit (1);
1628 + ret = 1;
1629 +
1630 + free(hostname);
1631 + exit (ret);
1632 }
1633
1634 static void
1635 diff -ur src-2.8.90/yppush/Makefile.am src-2.8.90-local/yppush/Makefile.am
1636 --- src-2.8.90/yppush/Makefile.am 2003-02-04 18:07:43.000000000 +0100
1637 +++ src-2.8.90-local/yppush/Makefile.am 2003-05-21 17:54:05.000000000 +0200
1638 @@ -8,7 +8,6 @@
1639
1640 localedir = $(datadir)/locale
1641
1642 -AM_CFLAGS = @EXTRA_CFLAGS@
1643 DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\" -DYPBINDIR=\"$(libexecdir)\" \
1644 -DCONFDIR=\"$(sysconfdir)\" -DYPMAPDIR=\"/var/yp\" \
1645 -DUSE_FQDN=@USE_FQDN@
1646 diff -ur src-2.8.90/yppush/yppush.c src-2.8.90-local/yppush/yppush.c
1647 --- src-2.8.90/yppush/yppush.c 2003-05-19 15:12:49.000000000 +0200
1648 +++ src-2.8.90-local/yppush/yppush.c 2003-05-29 08:43:07.000000000 +0200
1649 @@ -29,6 +29,7 @@
1650 #include <time.h>
1651 #include "yp.h"
1652 #include <rpcsvc/ypclnt.h>
1653 +#include <rpc/svc.h>
1654 #include <arpa/inet.h>
1655 #include <sys/param.h>
1656 #include <sys/socket.h>
1657 @@ -48,22 +49,10 @@
1658 #if defined(HAVE_GETOPT_H)
1659 #include <getopt.h>
1660 #endif /* HAVE_GETOPT_H */
1661 +#include "compat.h"
1662
1663 #include "log_msg.h"
1664
1665 -#ifndef HAVE_STRDUP
1666 -#include <compat/strdup.c>
1667 -#endif
1668 -
1669 -#ifndef HAVE_GETOPT_LONG
1670 -#include <compat/getopt.c>
1671 -#include <compat/getopt1.c>
1672 -#endif
1673 -
1674 -#ifndef HAVE_STRERROR
1675 -#include <compat/strerror.c>
1676 -#endif
1677 -
1678 #ifndef YPMAPDIR
1679 #define YPMAPDIR "/var/yp"
1680 #endif
1681 @@ -85,39 +74,6 @@
1682 static u_int maxchildren = 1;
1683 static u_int children = 0;
1684
1685 -#if HAVE__RPC_DTABLESIZE
1686 -extern int _rpc_dtablesize (void);
1687 -#elif HAVE_GETDTABLESIZE
1688 -
1689 -int
1690 -_rpc_dtablesize ()
1691 -{
1692 - static int size;
1693 -
1694 - if (size == 0)
1695 - size = getdtablesize ();
1696 -
1697 - return size;
1698 -}
1699 -#else
1700 -
1701 -#include <sys/resource.h>
1702 -
1703 -int
1704 -_rpc_dtablesize ()
1705 -{
1706 - static int size = 0;
1707 - struct rlimit rlb;
1708 -
1709 -
1710 - if (size == 0)
1711 - if (getrlimit (RLIMIT_NOFILE, &rlb) >= 0)
1712 - size = rlb.rlim_cur;
1713 -
1714 - return size;
1715 -}
1716 -#endif
1717 -
1718 static char *
1719 yppush_err_string (enum yppush_status status)
1720 {
1721 @@ -160,9 +116,9 @@
1722 }
1723
1724 bool_t
1725 -yppushproc_null_1_svc (void *req __attribute__ ((unused)),
1726 - void *resp __attribute__ ((unused)),
1727 - struct svc_req *rqstp __attribute__ ((unused)))
1728 +yppushproc_null_1_svc (void *req UNUSED,
1729 + void *resp UNUSED,
1730 + struct svc_req *rqstp UNUSED)
1731 {
1732 resp = NULL;
1733
1734 @@ -176,7 +132,7 @@
1735 bool_t
1736 yppushproc_xfrresp_1_svc (yppushresp_xfr *req, void *resp, struct svc_req *rqstp)
1737 {
1738 - struct sockaddr_in *sin;
1739 + const struct sockaddr_in *sin;
1740 char *h;
1741 struct hostent *hp;
1742
1743 @@ -209,6 +165,7 @@
1744 yppushresp_xfr yppushproc_xfrresp_1_arg;
1745 } argument;
1746 union {
1747 + char *dummy; /* What was going on here? Empty union? */
1748 } result;
1749 bool_t retval;
1750 xdrproc_t _xdr_argument, _xdr_result;
1751 @@ -388,11 +345,11 @@
1752 #if defined(__NetBSD__)
1753 static int
1754 add_slave_server (u_long status, char *key, int keylen,
1755 - char *val, int vallen, void *data __attribute__ ((unused)))
1756 + char *val, int vallen, void *data UNUSED)
1757 #else
1758 static int
1759 add_slave_server (int status, char *key, int keylen,
1760 - char *val, int vallen, char *data __attribute__ ((unused)))
1761 + char *val, int vallen, char *data UNUSED)
1762 #endif
1763 {
1764 char host[YPMAXPEER + 2];
1765 @@ -438,7 +395,7 @@
1766 }
1767
1768 static void
1769 -child_sig_int (int sig __attribute__ ((unused)))
1770 +child_sig_int (int sig UNUSED)
1771 {
1772 if (CallbackProg != 0)
1773 svc_unregister (CallbackProg, 1);
1774 @@ -557,7 +514,7 @@
1775 }
1776
1777 static void
1778 -sig_child (int sig __attribute__ ((unused)))
1779 +sig_child (int sig UNUSED)
1780 {
1781 int status;
1782
1783 diff -ur src-2.8.90/ypserv/Makefile.am src-2.8.90-local/ypserv/Makefile.am
1784 --- src-2.8.90/ypserv/Makefile.am 2003-02-04 18:42:33.000000000 +0100
1785 +++ src-2.8.90-local/ypserv/Makefile.am 2003-05-21 17:54:22.000000000 +0200
1786 @@ -10,7 +10,6 @@
1787
1788 MAXCHILDREN = 40
1789
1790 -AM_CFLAGS = @EXTRA_CFLAGS@
1791 DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\" -DYPBINDIR=\"$(libexecdir)\" \
1792 -DYPMAPDIR=\"@YPMAPDIR@\" -DMAX_CHILDREN=$(MAXCHILDREN)
1793 INCLUDES = -I$(top_srcdir)/lib -I$(top_srcdir) -I$(top_builddir) -I$(srcdir)
1794 diff -ur src-2.8.90/ypserv/server.c src-2.8.90-local/ypserv/server.c
1795 --- src-2.8.90/ypserv/server.c 2003-05-15 16:47:34.000000000 +0200
1796 +++ src-2.8.90-local/ypserv/server.c 2003-05-29 08:42:30.000000000 +0200
1797 @@ -23,32 +23,37 @@
1798 #define _GNU_SOURCE
1799
1800 #include <string.h>
1801 +#include <sys/types.h>
1802 #include <sys/socket.h>
1803 #include <netinet/in.h>
1804 #include <arpa/inet.h>
1805 -#include <sys/types.h>
1806 #include <sys/stat.h>
1807 #include <unistd.h>
1808 +#include <stdlib.h>
1809 #include <dirent.h>
1810 #include <errno.h>
1811 #include <fcntl.h>
1812 +#ifdef HAVE_ALLOCA_H
1813 +#include <alloca.h>
1814 +#endif /* HAVE_ALLOCA_H */
1815 #include "yp.h"
1816 #include "yp_db.h"
1817 #include "access.h"
1818 #include "ypserv_conf.h"
1819 #include "log_msg.h"
1820 +#include "compat.h"
1821
1822 extern volatile int children; /* ypserv.c */
1823 extern int forked; /* ypserv.c */
1824
1825 bool_t
1826 -ypproc_null_2_svc (void *argp __attribute__ ((unused)),
1827 - void *result __attribute__ ((unused)),
1828 +ypproc_null_2_svc (void *argp UNUSED,
1829 + void *result UNUSED,
1830 struct svc_req *rqstp)
1831 {
1832 if (debug_flag)
1833 {
1834 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1835 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1836 log_msg ("ypproc_null() [From: %s:%d]",
1837 inet_ntoa (rqhost->sin_addr),
1838 ntohs (rqhost->sin_port));
1839 @@ -67,7 +72,7 @@
1840 {
1841 if (debug_flag)
1842 {
1843 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1844 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1845 log_msg ("ypproc_domain(\"%s\") [From: %s:%d]",
1846 *argp, inet_ntoa (rqhost->sin_addr),
1847 ntohs (rqhost->sin_port));
1848 @@ -102,7 +107,7 @@
1849 {
1850 if (debug_flag)
1851 {
1852 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1853 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1854 log_msg ("ypproc_domain_nonack(\"%s\") [From: %s:%d]",
1855 *argp, inet_ntoa (rqhost->sin_addr),
1856 ntohs (rqhost->sin_port));
1857 @@ -142,7 +147,7 @@
1858
1859 if (debug_flag)
1860 {
1861 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1862 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1863
1864 log_msg ("ypproc_match(): [From: %s:%d]",
1865 inet_ntoa (rqhost->sin_addr), ntohs (rqhost->sin_port));
1866 @@ -230,7 +235,7 @@
1867
1868 if (debug_flag)
1869 {
1870 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1871 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1872 log_msg ("ypproc_first(): [From: %s:%d]",
1873 inet_ntoa (rqhost->sin_addr), ntohs (rqhost->sin_port));
1874
1875 @@ -325,7 +330,7 @@
1876
1877 if (debug_flag)
1878 {
1879 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1880 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1881
1882 log_msg ("ypproc_next(): [From: %s:%d]",
1883 inet_ntoa (rqhost->sin_addr), ntohs (rqhost->sin_port));
1884 @@ -422,7 +427,7 @@
1885 struct svc_req *rqstp)
1886 {
1887 DB_FILE dbp;
1888 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1889 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1890 int valid;
1891
1892 if (debug_flag)
1893 @@ -507,7 +512,7 @@
1894 if ((size_t)val.dsize != strlen (argp->map_parms.peer) ||
1895 strncmp (val.dptr, argp->map_parms.peer, val.dsize) != 0)
1896 {
1897 - char buf[val.dsize + 1];
1898 + char *buf = alloca(val.dsize + 1);
1899
1900 strncpy (buf, val.dptr, val.dsize);
1901 buf[val.dsize] = '\0';
1902 @@ -617,13 +622,13 @@
1903 return TRUE;
1904 }
1905
1906 -bool_t ypproc_clear_2_svc (void *argp __attribute__ ((unused)),
1907 - void *result __attribute__ ((unused)),
1908 +bool_t ypproc_clear_2_svc (void *argp UNUSED,
1909 + void *result UNUSED,
1910 struct svc_req *rqstp)
1911 {
1912 if (debug_flag)
1913 {
1914 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1915 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1916 log_msg ("ypproc_clear_2_svc() [From: %s:%d]",
1917 inet_ntoa (rqhost->sin_addr), ntohs (rqhost->sin_port));
1918 }
1919 @@ -725,7 +730,7 @@
1920
1921 if (debug_flag)
1922 {
1923 - struct sockaddr_in *rqhost;
1924 + const struct sockaddr_in *rqhost;
1925
1926 rqhost = svc_getcaller (rqstp->rq_xprt);
1927 log_msg ("ypproc_all_2_svc(): [From: %s:%d]",
1928 @@ -889,7 +894,7 @@
1929
1930 if (debug_flag)
1931 {
1932 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1933 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1934 log_msg ("ypproc_master_2_svc(): [From: %s:%d]",
1935 inet_ntoa (rqhost->sin_addr), ntohs (rqhost->sin_port));
1936
1937 @@ -996,7 +1001,7 @@
1938
1939 if (debug_flag)
1940 {
1941 - struct sockaddr_in *rqhost;
1942 + const struct sockaddr_in *rqhost;
1943
1944 rqhost = svc_getcaller (rqstp->rq_xprt);
1945
1946 @@ -1120,7 +1125,7 @@
1947
1948 if (debug_flag)
1949 {
1950 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1951 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1952
1953 log_msg ("ypproc_maplist_2_svc(): [From: %s:%d]",
1954 inet_ntoa (rqhost->sin_addr), ntohs (rqhost->sin_port));
1955 @@ -1203,7 +1208,7 @@
1956 }
1957
1958 int
1959 -ypprog_2_freeresult (SVCXPRT *transp __attribute__ ((unused)),
1960 +ypprog_2_freeresult (SVCXPRT *transp UNUSED,
1961 xdrproc_t xdr_result, caddr_t result)
1962 {
1963 xdr_free (xdr_result, result);
1964 diff -ur src-2.8.90/ypserv/ypserv.c src-2.8.90-local/ypserv/ypserv.c
1965 --- src-2.8.90/ypserv/ypserv.c 2003-05-20 09:08:47.000000000 +0200
1966 +++ src-2.8.90-local/ypserv/ypserv.c 2003-05-28 18:16:09.000000000 +0200
1967 @@ -32,11 +32,14 @@
1968 #if defined(HAVE_GETOPT_H)
1969 #include <getopt.h>
1970 #endif
1971 +#ifdef HAVE_POLL_H
1972 #include <poll.h>
1973 +#endif /* HAVE_POLL_H */
1974 #include <sys/file.h>
1975 #include <sys/stat.h>
1976 #include <sys/wait.h>
1977 #include <sys/socket.h>
1978 +#define _AIX_TIRPC /* make svc_getreq_poll() available on AIX */
1979 #include <rpc/rpc.h>
1980 #include <rpc/pmap_clnt.h>
1981
1982 @@ -44,6 +47,7 @@
1983 #include "access.h"
1984 #include "log_msg.h"
1985 #include "ypserv_conf.h"
1986 +#include "compat.h"
1987
1988 #ifdef HAVE_PATHS_H
1989 #include <paths.h>
1990 @@ -369,7 +373,7 @@
1991 extern FILE *debug_output;
1992 /* SIGUSR1: enable/disable debug output. */
1993 static void
1994 -sig_usr1 (int sig __attribute__ ((unused)))
1995 +sig_usr1 (int sig UNUSED)
1996 {
1997 if (debug_flag)
1998 {
1999 @@ -388,7 +392,7 @@
2000
2001 /* Clean up if we quit the program. */
2002 static void
2003 -sig_quit (int sig __attribute__ ((unused)))
2004 +sig_quit (int sig UNUSED)
2005 {
2006 pmap_unset (YPPROG, YPVERS);
2007 pmap_unset (YPPROG, YPOLDVERS);
2008 @@ -399,7 +403,7 @@
2009
2010 /* Reload securenets and config file */
2011 static void
2012 -sig_hup (int sig __attribute__ ((unused)))
2013 +sig_hup (int sig UNUSED)
2014 {
2015 int old_cached_filehandles = cached_filehandles;
2016
2017 @@ -468,7 +472,6 @@
2018 {"help", no_argument, NULL, 'h'},
2019 {NULL, 0, NULL, '\0'}
2020 };
2021 -
2022 c = getopt_long (argc, argv, "vdp:buh", long_options, &option_index);
2023 if (c == -1)
2024 break;
2025 diff -ur src-2.8.90/ypxfr/Makefile.am src-2.8.90-local/ypxfr/Makefile.am
2026 --- src-2.8.90/ypxfr/Makefile.am 2003-02-04 18:08:25.000000000 +0100
2027 +++ src-2.8.90-local/ypxfr/Makefile.am 2003-05-21 17:54:30.000000000 +0200
2028 @@ -8,7 +8,6 @@
2029
2030 localedir = $(datadir)/locale
2031
2032 -AM_CFLAGS = @EXTRA_CFLAGS@
2033 DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\"
2034 INCLUDES = -I$(top_srcdir)/lib -I$(top_srcdir) -I$(top_builddir) -I$(srcdir)
2035
2036 diff -ur src-2.8.90/ypxfr/ypxfr.c src-2.8.90-local/ypxfr/ypxfr.c
2037 --- src-2.8.90/ypxfr/ypxfr.c 2003-05-19 15:31:56.000000000 +0200
2038 +++ src-2.8.90-local/ypxfr/ypxfr.c 2003-05-30 12:41:23.000000000 +0200
2039 @@ -34,13 +34,18 @@
2040 #include <netinet/in.h>
2041 #include <arpa/inet.h>
2042 #include <ctype.h>
2043 +#ifdef HAVE_ALLOCA_H
2044 #include <alloca.h>
2045 +#endif /* HAVE_ALLOCA_H */
2046 +#include <stdlib.h>
2047 #include <sys/stat.h>
2048 +#include <sys/param.h>
2049 #include "log_msg.h"
2050 #include "yp.h"
2051 #include "ypxfr.h"
2052 #include "ypxfrd.h"
2053 #include <rpcsvc/ypclnt.h>
2054 +#include "compat.h"
2055
2056 #if defined(HAVE_LIBGDBM)
2057 #include <gdbm.h>
2058 @@ -280,11 +285,11 @@
2059 #if defined(__NetBSD__)
2060 static int
2061 ypxfr_foreach (u_long status, char *key, int keylen,
2062 - char *val, int vallen, void *data __attribute__ ((unused)))
2063 + char *val, int vallen, void *data UNUSED)
2064 #else
2065 static int
2066 ypxfr_foreach (int status, char *key, int keylen,
2067 - char *val, int vallen, char *data __attribute__ ((unused)))
2068 + char *val, int vallen, char *data UNUSED)
2069 #endif
2070 {
2071 datum outKey, outData;
2072 @@ -350,7 +355,7 @@
2073 struct sockaddr_in sockaddr, sockaddr_udp;
2074 struct ypresp_order resp_order;
2075 struct ypreq_nokey req_nokey;
2076 - uint32_t masterOrderNum;
2077 + time_t masterOrderNum;
2078 struct hostent *h;
2079 int sock, result;
2080
2081 @@ -450,7 +455,7 @@
2082 /* If we doesn't force the map, look, if the new map is really newer */
2083 if (!force)
2084 {
2085 - uint32_t localOrderNum = 0;
2086 + time_t localOrderNum = 0;
2087 datum inKey, inVal;
2088
2089 #if defined(HAVE_LIBGDBM)
2090 @@ -688,7 +693,7 @@
2091 struct in_addr remote_addr;
2092 unsigned int transid = 0;
2093 unsigned short int remote_port = 0;
2094 - uint32_t program_number = 0;
2095 + unsigned long program_number = 0;
2096 int force = 0;
2097 int noclear = 0;
2098
2099 diff -ur src-2.8.90/ypxfr/ypxfr_xdr.c src-2.8.90-local/ypxfr/ypxfr_xdr.c
2100 --- src-2.8.90/ypxfr/ypxfr_xdr.c 2003-02-05 15:37:15.000000000 +0100
2101 +++ src-2.8.90-local/ypxfr/ypxfr_xdr.c 2003-05-30 14:59:02.000000000 +0200
2102 @@ -30,7 +30,7 @@
2103
2104 struct {
2105 union {
2106 - ypstat (*encoder) (char *, int, char **, int *, char **, int *);
2107 + ypstat (*encoder) (char *, int, char **, u_int *, char **, u_int *);
2108 int (*decoder) (int, char *, int, char *, int, char *);
2109 }
2110 foreach;
2111 @@ -39,32 +39,6 @@
2112
2113
2114 bool_t
2115 -xdr_domainname (XDR *xdrs, domainname *objp)
2116 -{
2117 - if (!xdr_string (xdrs, objp, YPMAXDOMAIN))
2118 - return (FALSE);
2119 -
2120 - return (TRUE);
2121 -}
2122 -
2123 -bool_t
2124 -xdr_mapname (XDR *xdrs, mapname *objp)
2125 -{
2126 - if (!xdr_string (xdrs, objp, YPMAXMAP))
2127 - return FALSE;
2128 -
2129 - return TRUE;
2130 -}
2131 -
2132 -bool_t
2133 -xdr_peername (XDR *xdrs, peername *objp)
2134 -{
2135 - if (!xdr_string (xdrs, objp, YPMAXPEER))
2136 - return (FALSE);
2137 - return (TRUE);
2138 -}
2139 -
2140 -bool_t
2141 xdr_keydat (XDR *xdrs, keydat *objp)
2142 {
2143 if (!xdr_bytes (xdrs, (char **) &objp->keydat_val,
2144 @@ -108,16 +82,6 @@
2145 }
2146
2147 bool_t
2148 -xdr_ypresp_master (XDR *xdrs, ypresp_master *objp)
2149 -{
2150 - if (!xdr_ypstat (xdrs, &objp->stat))
2151 - return FALSE;
2152 - if (!xdr_peername (xdrs, &objp->peer))
2153 - return FALSE;
2154 - return TRUE;
2155 -}
2156 -
2157 -bool_t
2158 xdr_ypresp_order (XDR *xdrs, ypresp_order *objp)
2159 {
2160 if (!xdr_ypstat (xdrs, &objp->stat))
2161 @@ -128,16 +92,6 @@
2162 }
2163
2164 bool_t
2165 -xdr_ypbind_binding (XDR *xdrs, ypbind_binding *objp)
2166 -{
2167 - if (!xdr_opaque (xdrs, objp->ypbind_binding_addr, 4))
2168 - return FALSE;
2169 - if (!xdr_opaque (xdrs, objp->ypbind_binding_port, 2))
2170 - return FALSE;
2171 - return TRUE;
2172 -}
2173 -
2174 -bool_t
2175 xdr_ypbind_setdom (XDR *xdrs, ypbind_setdom *objp)
2176 {
2177 if (!xdr_domainname (xdrs, &objp->ypsetdom_domain))
2178 @@ -168,46 +122,6 @@
2179 }
2180
2181 bool_t
2182 -xdr_ypreq_nokey (XDR *xdrs, ypreq_nokey *objp)
2183 -{
2184 - if (!xdr_domainname (xdrs, &objp->domain))
2185 - return FALSE;
2186 -
2187 - if (!xdr_mapname (xdrs, &objp->map))
2188 - return FALSE;
2189 -
2190 - return TRUE;
2191 -}
2192 -
2193 -bool_t
2194 -xdr_ypstat (XDR *xdrs, ypstat *objp)
2195 -{
2196 - if (!xdr_enum (xdrs, (enum_t *) objp))
2197 - return FALSE;
2198 -
2199 - return TRUE;
2200 -}
2201 -
2202 -bool_t
2203 -xdr_ypxfrstat (XDR *xdrs, ypxfrstat *objp)
2204 -{
2205 - if (!xdr_enum (xdrs, (enum_t *) objp))
2206 - return FALSE;
2207 -
2208 - return TRUE;
2209 -}
2210 -
2211 -bool_t
2212 -xdr_ypresp_xfr (XDR * xdrs, ypresp_xfr * objp)
2213 -{
2214 - if (!xdr_u_int (xdrs, &objp->transid))
2215 - return FALSE;
2216 - if (!xdr_ypxfrstat (xdrs, &objp->xfrstat))
2217 - return FALSE;
2218 - return TRUE;
2219 -}
2220 -
2221 -bool_t
2222 ypxfr_xdr_ypresp_all (XDR *xdrs, ypresp_all *objp)
2223 {
2224 int CallAgain = 0;