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
6 fi], [AC_MSG_RESULT(no)])
10 +dnl JAPHAR_GREP_CFLAGS(flag, cmd_if_missing, cmd_if_present)
12 +dnl From Japhar. Report changes to japhar@hungry.com
14 +AC_DEFUN(JAPHAR_GREP_CFLAGS,
16 +"$1" | "$1 "* | *" $1" | *" $1 "* )
17 + ifelse($#, 3, [$3], [:])
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
28 YPBINDIR=${libexecdir}
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)
39 if test ${sbindir} = '${exec_prefix}/sbin'
41 if test "${exec_prefix}" = "NONE"
45 dnl Checks for programs.
46 -EXTRA_CFLAGS="-W -Wall -Wbad-function-cast -Wcast-align -Wcast-qual"
47 -AC_SUBST(EXTRA_CFLAGS)
55 +if eval "test x$GCC = xyes"; then
56 + # Can not use -ansi as this make alloca() unavailable on Mac OS X 10.2
61 + -Wbad-function-cast \
64 + -Wmissing-declarations \
65 + -Wmissing-prototypes \
70 + JAPHAR_GREP_CFLAGS($flag, [ CFLAGS="$CFLAGS $flag" ])
78 AC_CHECK_HEADERS(xcrypt.h crypt.h)
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="")
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>])
93 dnl Checks for typedefs, structures, and compiler characteristics.
95 dnl Checks for library functions.
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)
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)
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>])
114 Libraries: ${LIBS} ${LIBDBM} ${LIBCRYPT}
117 + NIS map dir: ${YPMAPDIR}
118 Install path prefix: ${prefix}"
119 if test ${sysconfdir} != '${prefix}/etc'
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
126 rpcsvc_HEADERS = ypxfrd.x
128 -AM_CFLAGS = @EXTRA_CFLAGS@
129 DEFS = @DEFS@ -D_REENTRANT=1 -DCONFDIR=\"$(sysconfdir)\"
130 INCLUDES = -I$(top_srcdir) -I$(top_builddir) -I$(srcdir)
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
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
146 static conffile_t *conf = NULL;
150 is_valid (struct svc_req *rqstp, const char *map, const char *domain)
152 - struct sockaddr_in *sin;
153 + const struct sockaddr_in *sin;
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
179 typedef enum ypstat ypstat;
185 - YPXFR_REFUSED = -14,
186 + YPXFR_REFUSED = -14
188 typedef enum ypxfrstat ypxfrstat;
194 - YPPUSH_REFUSED = -14,
195 + YPPUSH_REFUSED = -14
197 typedef enum yppush_status yppush_status;
201 enum ypbind_resptype {
203 - YPBIND_FAIL_VAL = 2,
204 + YPBIND_FAIL_VAL = 2
206 typedef enum ypbind_resptype ypbind_resptype;
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
212 #include <sys/types.h>
213 #include <netinet/in.h>
214 #include <arpa/inet.h>
215 +#ifdef HAVE_ALLOCA_H
217 +#endif /* HAVE_ALLOCA_H */
221 #include "ypserv_conf.h"
225 int xfr_check_port = 0;
226 @@ -396,14 +400,11 @@
227 log_msg ("ypserv.conf: xfr_check_port: %d", xfr_check_port);
231 /* GCC syntax shows our intent much more clearly */
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':
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
251 +char *stpcpy(char *s1, const char *s2)
253 + /* This is a naive implementation for platforms missing the
254 + function. It should be rewritten. */
256 + return s1 + strlen(s2);
258 +#endif /* not HAVE_STPCPY */
260 +#ifndef HAVE_STRNDUP
261 +char *strndup (const char * s, int size)
263 + int len = strlen(s) + 1;
266 + len = len > size ? size : len;
267 + retval = malloc(len);
269 + retval[len-1] = '\0';
273 +#endif /* not HAVE_STRNDUP */
275 +#ifndef HAVE_GETOPT_LONG
277 +getopt_long (int argc, char *const *argv, const char *shortopts,
278 + const struct option *longopts, int *longind)
280 + return getopt(argc, argv, shortopts);
282 +#endif /* not HAVE_GETOPT_LONG */
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
288 +Copyright (C) 1993 Free Software Foundation, Inc.
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.
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. */
300 +/* Written by Jan Brittenson, bson@gnu.ai.mit.edu. */
302 +#include <sys/types.h>
307 +#define GETLINE_NO_LIMIT -1
312 +char *malloc (), *realloc ();
315 +/* Always add at least this many bytes when extending the buffer. */
316 +#define MIN_CHUNK 64
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.
322 + *LINEPTR is a pointer returned from malloc (or NULL), pointing to
323 + *N characters of space. It is realloc'd as necessary.
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
331 +getstr (char **lineptr, size_t *n, FILE *stream, int terminator,
332 + int offset, int limit)
334 + int nchars_avail; /* Allocated but unused chars in *LINEPTR. */
335 + char *read_pos; /* Where we're reading into *LINEPTR. */
338 + if (!lineptr || !n || !stream)
347 + *lineptr = malloc (*n);
353 + *lineptr[0] = '\0';
356 + nchars_avail = *n - offset;
357 + read_pos = *lineptr + offset;
370 + /* If limit is negative, then we shouldn't pay attention to
371 + it, so decrement only if positive. */
376 + save_errno = errno;
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. */
382 + assert((*lineptr + *n) == (read_pos + nchars_avail));
383 + if (nchars_avail < 2)
385 + if (*n > MIN_CHUNK)
390 + nchars_avail = *n + *lineptr - read_pos;
391 + *lineptr = realloc (*lineptr, *n);
397 + read_pos = *n - nchars_avail + *lineptr;
398 + assert((*lineptr + *n) == (read_pos + nchars_avail));
401 + if (ferror (stream))
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
406 + errno = save_errno;
412 + /* Return partial line, if any. */
413 + if (read_pos == *lineptr)
422 + if (c == terminator)
423 + /* Return the line. */
427 + /* Done - NUL terminate and return the number of chars read. */
430 + ret = read_pos - (*lineptr + offset);
435 +getline (char **lineptr, size_t *n, FILE *stream)
437 + return getstr (lineptr, n, stream, '\n', 0, GETLINE_NO_LIMIT);
441 +getline_safe (char **lineptr, size_t *n, FILE *stream, int limit)
443 + return getstr (lineptr, n, stream, '\n', 0, limit);
446 +#endif /* not HAVE_GETDELIM and not HAVE_GETLINE */
448 +#if !defined(HAVE_SVC_GETCALLER) && !defined(svc_getcaller)
449 +const struct sockaddr_in *
450 +svc_getcaller(const SVCXPRT *xprt)
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
459 +# else /* not HAVE_SVC_GETRPCCALLER */
460 +# error "Missing both svc_getcaller() and svc_getrpccaller()"
461 +# endif /* not HAVE_SVC_GETRPCCALLER */
463 +#endif /* not HAVE_SVC_GETCALLER */
466 +#ifndef HAVE__RPC_DTABLESIZE
467 +# if HAVE_GETDTABLESIZE
468 +int _rpc_dtablesize()
473 + size = getdtablesize();
478 +# include <sys/resource.h>
479 +int _rpc_dtablesize()
481 + static int size = 0;
486 + if (getrlimit(RLIMIT_NOFILE, &rlb) >= 0)
487 + size = rlb.rlim_cur;
492 +# endif /* not HAVE_GETDTABLESIZE */
493 +#endif /* not HAVE__RPC_DTABLESIZE */
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 $
499 +** Replacement for a missing inet_aton.
501 +** Written by Russ Allbery <rra@bogus.example.com>
502 +** This work is hereby placed in the public domain by its author.
504 +** Provides the same functionality as the standard library routine
505 +** inet_aton for those platforms that don't have it. inet_aton is
509 +/* #include "config.h" */
510 +/* #include "clibrary.h" */
511 +#include <netinet/in.h>
513 +/* If we're running the test suite, rename inet_ntoa to avoid conflicts with
514 + the system version. */
516 +# define inet_aton test_inet_aton
517 +int test_inet_aton(const char *, struct in_addr *);
521 +inet_aton(const char *s, struct in_addr *addr)
523 + unsigned long octet[4], address;
528 + if (s == NULL) return 0;
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;
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. */
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
553 + if (*p == '.' && base != 8) return 0;
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;
565 + /* Use a switch statement to parse each digit rather than
566 + assuming ASCII. Probably pointless portability.... */
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;
586 + if (i >= base) return 0;
587 + octet[part] = (octet[part] * base) + i;
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. */
595 + if (*p == 0) return 0;
598 + if (part == 0) return 0;
600 + /* IPv4 allows three types of address specification:
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.
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
618 + for (i = 0; i < part - 1; i++) {
619 + if (octet[i] > 0xff) return 0;
620 + address |= octet[i] << (8 * (3 - i));
622 + if (octet[i] > (0xffffffffUL >> (i * 8))) return 0;
623 + address |= octet[i];
624 + if (addr != NULL) addr->s_addr = htonl(address);
627 +#endif /* not HAVE_INET_ATON */
630 +#ifndef HAVE_INET_PTON
631 +#include <arpa/inet.h>
632 +#include <sys/socket.h>
634 +inet_pton(int af, const char *src, void *dst)
638 + return inet_aton(src, (struct in_addr *)dst);
642 +#endif /* AF_INET6 */
644 + fprintf(stderr, "warning: Bogus inet_pton() called\n");
645 + errno = EAFNOSUPPORT;
650 +#endif /* not HAVE_INET_PTON */
652 +#ifndef HAVE_FGETPWENT
654 +fgetpwent(FILE *stream)
656 + fprintf(stderr, "warning: Bogus fgetpwent() called\n");
659 +#endif /* not HAVE_FGETPWENT */
661 +#ifndef HAVE_PUTPWENT
663 +putpwent(const struct passwd *p, FILE *stream)
665 + fprintf(stderr, "warning: Bogus putpwent() called\n");
668 +#endif /* not HAVE_PUTPWENT */
670 +#ifndef HAVE_FGETGRENT
672 +fgetgrent(FILE *stream)
674 + fprintf(stderr, "warning: Bogus fgetgrent() called\n");
677 +#endif /* not HAVE_FGETGRENT */
679 +#ifndef HAVE_XDR_YPXFRSTAT
680 +#include <rpc/rpc.h>
683 +xdr_ypxfrstat(XDR *xdrs, ypxfrstat *objp)
685 + if (!xdr_enum(xdrs, (enum_t *)objp))
690 +#endif /* not HAVE_XDR_YPXFRSTAT */
692 +#ifndef HAVE_XDR_DOMAINNAME
693 +#include <rpc/rpc.h>
695 +xdr_domainname(XDR *xdrs, domainname *objp)
697 + if (!xdr_string(xdrs, objp, YPMAXDOMAIN))
702 +#endif /* not HAVE_XDR_DOMAINNAME */
704 +#ifndef HAVE_XDR_YPRESP_XFR
705 +#include <rpc/rpc.h>
707 +xdr_ypresp_xfr(XDR *xdrs, ypresp_xfr *objp)
709 + if (!xdr_u_int(xdrs, &objp->transid))
712 + if (!xdr_ypxfrstat(xdrs, &objp->xfrstat))
717 +#endif /* not HAVE_XDR_YPRESP_XFR */
719 +#ifndef HAVE_XDR_YPMAP_PARMS
721 +xdr_ypmap_parms(XDR *xdrs, ypmap_parms *objp)
723 + if (!xdr_domainname(xdrs, &objp->domain))
725 + if (!xdr_mapname(xdrs, &objp->map))
727 + if (!xdr_u_int(xdrs, &objp->ordernum))
729 + if (!xdr_peername(xdrs, &objp->peer))
733 +#endif /* not HAVE_XDR_YPMAP_PARMS */
736 +#ifndef HAVE_XDR_YPREQ_XFR
738 +xdr_ypreq_xfr(XDR *xdrs, ypreq_xfr *objp)
740 + if (!xdr_ypmap_parms(xdrs, &objp->map_parms))
742 + if (!xdr_u_int(xdrs, &objp->transid))
744 + if (!xdr_u_int(xdrs, &objp->prog))
746 + if (!xdr_u_int(xdrs, &objp->port))
750 +#endif /* not HAVE_XDR_YPREQ_XFR */
752 +#ifndef HAVE_XDR_MAPNAME
754 +xdr_mapname (XDR *xdrs, mapname *objp)
756 + if (!xdr_string (xdrs, objp, YPMAXMAP))
761 +#endif /* not HAVE_XDR_MAPNAME */
763 +#ifndef HAVE_XDR_PEERNAME
765 +xdr_peername (XDR *xdrs, peername *objp)
767 + if (!xdr_string (xdrs, objp, YPMAXPEER))
771 +#endif /* not HAVE_XDR_PEERNAME */
773 +#ifndef HAVE_XDR_YPSTAT
775 +xdr_ypstat (XDR *xdrs, ypstat *objp)
777 + if (!xdr_enum (xdrs, (enum_t *) objp))
782 +#endif /* not HAVE_XDR_YPSTAT */
784 +#ifndef HAVE_XDR_YPRESP_MASTER
786 +xdr_ypresp_master (XDR *xdrs, ypresp_master *objp)
788 + if (!xdr_ypstat (xdrs, &objp->stat))
790 + if (!xdr_peername (xdrs, &objp->peer))
794 +#endif /* not HAVE_XDR_YPRESP_MASTER */
796 +#ifndef HAVE_XDR_YPBIND_BINDING
798 +xdr_ypbind_binding (XDR *xdrs, ypbind_binding *objp)
800 + if (!xdr_opaque (xdrs, objp->ypbind_binding_addr, 4))
802 + if (!xdr_opaque (xdrs, objp->ypbind_binding_port, 2))
806 +#endif /* not HAVE_XDR_YPBIND_BINDING */
808 +#ifndef HAVE_XDR_YPREQ_NOKEY
810 +xdr_ypreq_nokey (XDR *xdrs, ypreq_nokey *objp)
812 + if (!xdr_domainname (xdrs, &objp->domain))
815 + if (!xdr_mapname (xdrs, &objp->map))
820 +#endif /* not HAVE_XDR_YPREQ_NOKEY */
822 +#ifndef HAVE_XDR_YPPUSH_STATUS
824 +xdr_yppush_status(XDR *xdrs, yppush_status *objp)
826 + if (!xdr_enum(xdrs, (enum_t *)objp))
830 +#endif /* not HAVE_XDR_YPPUSH_STATUS */
832 +#ifndef HAVE_XDR_YPPUSHRESP_XFR
834 +xdr_yppushresp_xfr(XDR *xdrs, yppushresp_xfr *objp)
836 + if (!xdr_u_int(xdrs, &objp->transid))
838 + if (!xdr_yppush_status(xdrs, &objp->status))
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
847 +/* Copyright (c) 2000 Thorsten Kukuk
848 + Author: Thorsten Kukuk <kukuk@suse.de>
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.
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.
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. */
865 +#ifndef _YPSERV_COMPAT_H
866 +#define _YPSERV_COMPAT_H
870 +/* __attribute__ is only in GCC */
872 +#define UNUSED __attribute__ ((unused))
878 +char *stpcpy(char *, const char *);
879 +#endif /* not HAVE_STPCPY */
881 +#ifndef HAVE_STRNDUP
882 +char *strndup (const char *, int);
883 +#endif /* not HAVE_STRNDUP */
885 +extern int svc_max_pollfd;
886 +extern struct pollfd *svc_pollfd;
888 +#ifndef HAVE_GETOPT_LONG
896 +# define no_argument 0
897 +# define required_argument 1
898 +# define optional_argument 2
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 */
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 */
911 +#ifndef HAVE_SVC_GETCALLER
912 +# include <rpc/rpc.h>
913 +# if !defined(svc_getcaller)
915 +const struct sockaddr_in *svc_getcaller(const SVCXPRT *xprt);
917 +#endif /* not HAVE_SVC_GETCALLER */
919 +#ifndef HAVE__RPC_DTABLESIZE
920 +int _rpc_dtablesize(void);
923 +#ifndef HAVE_INET_PTON
924 +int inet_pton(int af, const char *src, void *dst);
925 +#endif /* not HAVE_INET_PTON */
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
934 localedir = $(datadir)/locale
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
947 +#ifdef HAVE_ALLOCA_H
949 +#endif /* HAVE_ALLOCA_H */
954 +#ifdef HAVE_GETOPT_H
956 +#endif /* HAVE_GETOPT_H */
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
972 localedir = $(datadir)/locale
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)
980 mknetid_SOURCES = mknetid.c netid_hash.c
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
988 #include <rpc/types.h>
989 #include <rpcsvc/ypclnt.h>
990 +#ifdef HAVE_GETOPT_H
997 static int quiet_flag = 0;
999 @@ -156,10 +159,10 @@
1001 while (!feof (file))
1003 -#ifdef HAVE_GETLINE
1004 - ssize_t n = getline (&line, &length, file);
1005 -#elif HAVE_GETDELIM
1007 ssize_t n = getdelim (&line, &length, '\n', file);
1009 + ssize_t n = getline (&line, &length, file);
1013 @@ -189,10 +192,10 @@
1015 while (!feof (file))
1017 -#ifdef HAVE_GETLINE
1018 - ssize_t n = getline (&line, &length, file);
1019 -#elif HAVE_GETDELIM
1021 ssize_t n = getdelim (&line, &length, '\n', file);
1023 + ssize_t n = getline (&line, &length, file);
1027 @@ -224,10 +227,10 @@
1029 while (!feof (file))
1031 -#ifdef HAVE_GETLINE
1032 - ssize_t n = getline (&line, &length, file);
1033 -#elif HAVE_GETDELIM
1035 ssize_t n = getdelim (&line, &length, '\n', file);
1037 + ssize_t n = getline (&line, &length, file);
1041 @@ -260,10 +263,10 @@
1043 while (!feof (file))
1045 -#ifdef HAVE_GETLINE
1046 - ssize_t n = getline (&line, &length, file);
1047 -#elif HAVE_GETDELIM
1049 ssize_t n = getdelim (&line, &length, '\n', file);
1051 + ssize_t n = getline (&line, &length, file);
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
1060 localedir = $(datadir)/locale
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)
1068 revnetgroup_SOURCES = revnetgroup.c getnetgrent.c hash.c
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
1078 +#include "compat.h"
1080 #define TABLESIZE 997 /*Should be a prime */
1082 -#ifndef HAVE_STRDUP
1083 -#include "compat/strdup.c"
1093 -hash_free (hash_t **table __attribute__ ((unused)))
1094 +hash_free (hash_t **table UNUSED)
1096 /* XXX Not implementet yet! */
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
1105 -#if defined(HAVE_GETOPT_H) && defined(HAVE_GETOPT_LONG)
1106 +#if defined(HAVE_GETOPT_H)
1111 +#include "compat.h"
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
1120 localedir = $(datadir)/locale
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
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>
1141 #ifdef HAVE_SHADOW_H
1144 +#include "compat.h"
1147 /* Set to 0 if you don't want to check against the root password
1150 static int res; /* I hate static variables */
1152 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1153 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1155 /* Be careful here with the debug option. You can see the old
1156 and new password in clear text !! */
1161 +#ifdef HAVE_LCKPWDF
1162 /* Lock the passwd file. We retry several times. */
1164 while (lckpwdf () && retries < MAX_RETRIES)
1165 @@ -290,11 +296,14 @@
1166 log_msg ("password file locked");
1169 +#endif /* HAVE_LCKPWDF */
1171 res = update_files (yppw, logbuf, &shadow_changed, &passwd_changed,
1174 +#ifdef HAVE_LCKPWDF
1176 +#endif /* HAVE_LCKPWDF */
1179 /* Fork off process to rebuild NIS passwd.* maps. */
1182 if (strcmp (pw->pw_passwd, "x") == 0)
1184 +#ifdef HAVE_GETSPNAM /* shadow password */
1187 if ((spw = getspnam ("root")) != NULL)
1189 rootpass = alloca (strlen (spw->sp_pwdp) + 1);
1190 strcpy (rootpass, spw->sp_pwdp);
1192 +#endif /* HAVE_GETSPNAM */
1197 chmod (path_passwd_tmp, passwd_stat.st_mode);
1198 chown (path_passwd_tmp, passwd_stat.st_uid, passwd_stat.st_gid);
1200 +#ifdef HAVE_GETSPNAM
1201 /* Open the shadow file for reading. */
1202 if ((oldsf = fopen (path_shadow, "r")) != NULL)
1205 chmod (path_shadow_tmp, shadow_stat.st_mode);
1206 chown (path_shadow_tmp, shadow_stat.st_uid, shadow_stat.st_gid);
1208 +#endif /* HAVE_GETSPNAM */
1210 /* Loop over all passwd entries */
1211 while ((pw = fgetpwent (oldpf)) != NULL)
1213 if (oldsf != NULL &&
1214 pw->pw_passwd[0] == 'x' && pw->pw_passwd[1] == '\0')
1216 +#ifdef HAVE_GETSPNAM /* shadow password */
1217 /* Search for the shadow entry of this user */
1218 while ((spw = fgetspent (oldsf)) != NULL)
1224 +#endif /* HAVE_GETSPNAM */
1227 /* We don't have a shadow password file or we don't find the
1229 yppw->newpw.pw_passwd[1] == '\0') &&
1230 yppw->newpw.pw_passwd[0] != '\0')
1232 +#ifdef HAVE_GETSPNAM /* shadow password */
1235 /* test if password is expired */
1239 else /* No shadow entry */
1240 +#endif /* HAVE_GETSPNAM */
1242 /* set the new passwd */
1243 pw->pw_passwd = yppw->newpw.pw_passwd;
1244 @@ -593,9 +610,12 @@
1247 unlink (path_passwd_tmp);
1248 +#ifdef HAVE_GETSPNAM
1249 unlink (path_shadow_tmp);
1250 +#endif /* HAVE_GETSPNAM */
1253 +#ifdef HAVE_GETSPNAM
1254 if (*shadow_changed)
1256 unlink (path_shadow_old);
1260 unlink (path_shadow_tmp);
1261 +#endif /* HAVE_GETSPNAM */
1263 if (*passwd_changed)
1265 @@ -634,7 +655,13 @@
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;
1279 sprintf(p, "YP_PASSWD_OLD=%s", yppw->oldpass);
1280 @@ -652,11 +679,7 @@
1281 sprintf(p, "YP_SHELL=%s", yppw->newpw.pw_shell);
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."
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
1301 +/* get sigaction */
1302 +#define _POSIX_SOURCE
1303 +/* #define _XOPEN_SOURCE_EXTENDED */
1304 +#define __USE_POSIX199309
1305 +#define __USE_UNIX98
1308 #include <sys/types.h>
1309 #include <sys/socket.h>
1310 #include <sys/ioctl.h>
1315 +#include <stdlib.h>
1318 #include <rpc/rpc.h>
1320 #include <rpc/svc_soc.h>
1322 #include "yppasswd.h"
1323 -#if defined(HAVE_GETOPT_H) && defined(HAVE_GETOPT_LONG)
1324 +#if defined(HAVE_GETOPT_H)
1327 -#include <compat/getopt.h>
1329 -#ifndef HAVE_GETOPT_LONG
1330 -#include <compat/getopt.c>
1331 -#include <compat/getopt1.c>
1334 -#ifndef HAVE_STRERROR
1335 -#include <compat/strerror.c>
1338 #include "log_msg.h"
1339 +#include "compat.h"
1343 @@ -197,14 +197,14 @@
1347 -sig_child (int sig __attribute__ ((unused)))
1348 +sig_child (int sig UNUSED)
1353 /* Clean up if we quit the program. */
1355 -sig_quit (int sig __attribute__ ((unused)))
1356 +sig_quit (int sig UNUSED)
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
1365 localedir = $(datadir)/locale
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
1375 #include <rpc/svc_soc.h>
1377 #include <rpc/pmap_clnt.h>
1378 +#ifdef HAVE_GETOPT_H
1380 +#endif /* HAVE_GETOPT_H */
1383 #include "ypserv_conf.h"
1387 #include "log_msg.h"
1388 +#include "compat.h"
1390 extern void ypxfrd_freebsd_prog_1(struct svc_req *, SVCXPRT *);
1396 -#if HAVE__RPC_DTABLESIZE
1397 -extern int _rpc_dtablesize(void);
1398 -#elif HAVE_GETDTABLESIZE
1406 - size = getdtablesize();
1412 -#include <sys/resource.h>
1417 - static int size = 0;
1418 - struct rlimit rlb;
1422 - if (getrlimit(RLIMIT_NOFILE, &rlb) >= 0)
1423 - size = rlb.rlim_cur;
1431 ** Needed, if we start rpc.ypxfrd from inetd
1435 /* Clean up after child processes signal their termination. */
1437 -sig_child (int sig __attribute__ ((unused)))
1438 +sig_child (int sig UNUSED)
1444 /* Clean up if we quit the program. */
1446 -sig_quit (int sig __attribute__ ((unused)))
1447 +sig_quit (int sig UNUSED)
1449 pmap_unset (YPXFRD_FREEBSD_PROG, YPXFRD_FREEBSD_VERS);
1452 ** Reload securenets and config file
1455 -sig_hup (int sig __attribute__ ((unused)))
1456 +sig_hup (int sig UNUSED)
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
1467 +#include "compat.h"
1469 static int file = 0;
1473 static struct xfr result;
1474 char buf[MAXPATHLEN];
1475 - struct sockaddr_in *rqhost;
1476 + const struct sockaddr_in *rqhost;
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
1487 +#include <rpc/rpc.h>
1488 #include <rpc/pmap_clnt.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
1496 localedir = $(datadir)/locale
1498 -AM_CFLAGS = @EXTRA_CFLAGS@
1499 INCLUDES = -I$(top_srcdir)/lib -I$(top_srcdir) -I$(top_builddir) -I$(srcdir)
1501 DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\" -DYPBINDIR=\"$(libexecdir)\" \
1504 yphelper_SOURCES = yphelper.c
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
1515 +#include <sys/types.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>
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)
1535 #if defined(HAVE_LIBGDBM)
1540 +#include "compat.h"
1541 #include <rpcsvc/ypclnt.h>
1542 #include <arpa/nameser.h>
1543 #ifdef HAVE_SHADOW_H
1545 hp = gethostbyaddr (addr, sizeof (addr), AF_INET);
1548 - hp = gethostbyname2 (hostname, AF_INET);
1549 + hp = gethostbyname (hostname);
1552 fputs (hostname, stdout);
1554 hp = gethostbyaddr (addr, sizeof (addr), AF_INET);
1557 - hp = gethostbyname2 (server, AF_INET);
1558 + hp = gethostbyname (server);
1561 server = alloca (strlen (hp->h_name) + 1);
1563 (pwd->pw_passwd[0] == 'x' || pwd->pw_passwd[0] == '*'))
1566 +#ifdef HAVE_GETSPNAM /* shadow password */
1567 spd = fgetspent (s_input);
1574 +#endif /* HAVE_GETSPNAM */
1576 pass = pwd->pw_passwd;
1582 +#ifdef HAVE_GETSPNAM /* shadow password */
1583 static struct __sgrp *
1584 fgetsgent (FILE *fp)
1590 +#endif /* HAVE_GETSPNAM */
1593 merge_group (char *group, char *gshadow)
1595 (grp->gr_passwd[0] == 'x' || grp->gr_passwd[0] == '*'))
1598 +#ifdef HAVE_GETSPNAM /* shadow password */
1599 spd = fgetsgent (s_input);
1606 +#endif /* HAVE_GETSPNAM */
1608 pass = grp->gr_passwd;
1610 @@ -557,17 +570,20 @@
1611 hp = gethostbyaddr (addr, sizeof (addr), AF_INET);
1614 - hp = gethostbyname2 (hostname, AF_INET);
1615 + hp = gethostbyname (hostname);
1618 - hostname = strdupa (hp->h_name);
1619 + hostname = strdup (hp->h_name);
1622 if (strcasecmp (hostname,
1623 get_dbm_entry ("YP_MASTER_NAME", map, domainname)) == 0)
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
1640 localedir = $(datadir)/locale
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
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>
1658 #if defined(HAVE_GETOPT_H)
1660 #endif /* HAVE_GETOPT_H */
1661 +#include "compat.h"
1663 #include "log_msg.h"
1665 -#ifndef HAVE_STRDUP
1666 -#include <compat/strdup.c>
1669 -#ifndef HAVE_GETOPT_LONG
1670 -#include <compat/getopt.c>
1671 -#include <compat/getopt1.c>
1674 -#ifndef HAVE_STRERROR
1675 -#include <compat/strerror.c>
1679 #define YPMAPDIR "/var/yp"
1682 static u_int maxchildren = 1;
1683 static u_int children = 0;
1685 -#if HAVE__RPC_DTABLESIZE
1686 -extern int _rpc_dtablesize (void);
1687 -#elif HAVE_GETDTABLESIZE
1695 - size = getdtablesize ();
1701 -#include <sys/resource.h>
1706 - static int size = 0;
1707 - struct rlimit rlb;
1711 - if (getrlimit (RLIMIT_NOFILE, &rlb) >= 0)
1712 - size = rlb.rlim_cur;
1719 yppush_err_string (enum yppush_status status)
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)
1736 yppushproc_xfrresp_1_svc (yppushresp_xfr *req, void *resp, struct svc_req *rqstp)
1738 - struct sockaddr_in *sin;
1739 + const struct sockaddr_in *sin;
1744 yppushresp_xfr yppushproc_xfrresp_1_arg;
1747 + char *dummy; /* What was going on here? Empty union? */
1750 xdrproc_t _xdr_argument, _xdr_result;
1751 @@ -388,11 +345,11 @@
1752 #if defined(__NetBSD__)
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)
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)
1764 char host[YPMAXPEER + 2];
1769 -child_sig_int (int sig __attribute__ ((unused)))
1770 +child_sig_int (int sig UNUSED)
1772 if (CallbackProg != 0)
1773 svc_unregister (CallbackProg, 1);
1778 -sig_child (int sig __attribute__ ((unused)))
1779 +sig_child (int sig UNUSED)
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
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
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>
1808 +#include <stdlib.h>
1812 +#ifdef HAVE_ALLOCA_H
1813 +#include <alloca.h>
1814 +#endif /* HAVE_ALLOCA_H */
1818 #include "ypserv_conf.h"
1819 #include "log_msg.h"
1820 +#include "compat.h"
1822 extern volatile int children; /* ypserv.c */
1823 extern int forked; /* ypserv.c */
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)
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));
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));
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));
1861 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1862 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1864 log_msg ("ypproc_match(): [From: %s:%d]",
1865 inet_ntoa (rqhost->sin_addr), ntohs (rqhost->sin_port));
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));
1879 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1880 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1882 log_msg ("ypproc_next(): [From: %s:%d]",
1883 inet_ntoa (rqhost->sin_addr), ntohs (rqhost->sin_port));
1885 struct svc_req *rqstp)
1888 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1889 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1894 if ((size_t)val.dsize != strlen (argp->map_parms.peer) ||
1895 strncmp (val.dptr, argp->map_parms.peer, val.dsize) != 0)
1897 - char buf[val.dsize + 1];
1898 + char *buf = alloca(val.dsize + 1);
1900 strncpy (buf, val.dptr, val.dsize);
1901 buf[val.dsize] = '\0';
1902 @@ -617,13 +622,13 @@
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)
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));
1923 - struct sockaddr_in *rqhost;
1924 + const struct sockaddr_in *rqhost;
1926 rqhost = svc_getcaller (rqstp->rq_xprt);
1927 log_msg ("ypproc_all_2_svc(): [From: %s:%d]",
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));
1937 @@ -996,7 +1001,7 @@
1941 - struct sockaddr_in *rqhost;
1942 + const struct sockaddr_in *rqhost;
1944 rqhost = svc_getcaller (rqstp->rq_xprt);
1946 @@ -1120,7 +1125,7 @@
1950 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1951 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
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 @@
1959 -ypprog_2_freeresult (SVCXPRT *transp __attribute__ ((unused)),
1960 +ypprog_2_freeresult (SVCXPRT *transp UNUSED,
1961 xdrproc_t xdr_result, caddr_t result)
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
1968 #if defined(HAVE_GETOPT_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>
1984 #include "log_msg.h"
1985 #include "ypserv_conf.h"
1986 +#include "compat.h"
1991 extern FILE *debug_output;
1992 /* SIGUSR1: enable/disable debug output. */
1994 -sig_usr1 (int sig __attribute__ ((unused)))
1995 +sig_usr1 (int sig UNUSED)
2001 /* Clean up if we quit the program. */
2003 -sig_quit (int sig __attribute__ ((unused)))
2004 +sig_quit (int sig UNUSED)
2006 pmap_unset (YPPROG, YPVERS);
2007 pmap_unset (YPPROG, YPOLDVERS);
2010 /* Reload securenets and config file */
2012 -sig_hup (int sig __attribute__ ((unused)))
2013 +sig_hup (int sig UNUSED)
2015 int old_cached_filehandles = cached_filehandles;
2018 {"help", no_argument, NULL, 'h'},
2019 {NULL, 0, NULL, '\0'}
2022 c = getopt_long (argc, argv, "vdp:buh", long_options, &option_index);
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
2030 localedir = $(datadir)/locale
2032 -AM_CFLAGS = @EXTRA_CFLAGS@
2033 DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\"
2034 INCLUDES = -I$(top_srcdir)/lib -I$(top_srcdir) -I$(top_builddir) -I$(srcdir)
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
2040 #include <netinet/in.h>
2041 #include <arpa/inet.h>
2043 +#ifdef HAVE_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"
2053 #include <rpcsvc/ypclnt.h>
2054 +#include "compat.h"
2056 #if defined(HAVE_LIBGDBM)
2058 @@ -280,11 +285,11 @@
2059 #if defined(__NetBSD__)
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)
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)
2071 datum outKey, outData;
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;
2082 /* If we doesn't force the map, look, if the new map is really newer */
2085 - uint32_t localOrderNum = 0;
2086 + time_t localOrderNum = 0;
2089 #if defined(HAVE_LIBGDBM)
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;
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
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 *);
2115 -xdr_domainname (XDR *xdrs, domainname *objp)
2117 - if (!xdr_string (xdrs, objp, YPMAXDOMAIN))
2124 -xdr_mapname (XDR *xdrs, mapname *objp)
2126 - if (!xdr_string (xdrs, objp, YPMAXMAP))
2133 -xdr_peername (XDR *xdrs, peername *objp)
2135 - if (!xdr_string (xdrs, objp, YPMAXPEER))
2141 xdr_keydat (XDR *xdrs, keydat *objp)
2143 if (!xdr_bytes (xdrs, (char **) &objp->keydat_val,
2148 -xdr_ypresp_master (XDR *xdrs, ypresp_master *objp)
2150 - if (!xdr_ypstat (xdrs, &objp->stat))
2152 - if (!xdr_peername (xdrs, &objp->peer))
2158 xdr_ypresp_order (XDR *xdrs, ypresp_order *objp)
2160 if (!xdr_ypstat (xdrs, &objp->stat))
2165 -xdr_ypbind_binding (XDR *xdrs, ypbind_binding *objp)
2167 - if (!xdr_opaque (xdrs, objp->ypbind_binding_addr, 4))
2169 - if (!xdr_opaque (xdrs, objp->ypbind_binding_port, 2))
2175 xdr_ypbind_setdom (XDR *xdrs, ypbind_setdom *objp)
2177 if (!xdr_domainname (xdrs, &objp->ypsetdom_domain))
2178 @@ -168,46 +122,6 @@
2182 -xdr_ypreq_nokey (XDR *xdrs, ypreq_nokey *objp)
2184 - if (!xdr_domainname (xdrs, &objp->domain))
2187 - if (!xdr_mapname (xdrs, &objp->map))
2194 -xdr_ypstat (XDR *xdrs, ypstat *objp)
2196 - if (!xdr_enum (xdrs, (enum_t *) objp))
2203 -xdr_ypxfrstat (XDR *xdrs, ypxfrstat *objp)
2205 - if (!xdr_enum (xdrs, (enum_t *) objp))
2212 -xdr_ypresp_xfr (XDR * xdrs, ypresp_xfr * objp)
2214 - if (!xdr_u_int (xdrs, &objp->transid))
2216 - if (!xdr_ypxfrstat (xdrs, &objp->xfrstat))
2222 ypxfr_xdr_ypresp_all (XDR *xdrs, ypresp_all *objp)