3 - Add test for __attribute((unused)) and socklen_t to configure
4 - only look for getrpcport in rpcsvc if it is missing in the existing
6 - no need to check for or include <poll.h>, as it isn't used any
8 - Make some compatibility functions:
9 - A svc_getcaller() returning 'const struct sockaddr_in *', and adapt
10 the code to accept the 'const'.
12 - _rpc_dtablesize() copied from other parts of the code.
13 - Some xdr_* functions copied from other parts of the code.
14 - An inet_pton() with support for IPv4 and inet_aton().
15 - Dummy replacement functions for fgetpwent(), putpwent() and
17 - Drop unused <pthread.h> from yp.h, because this break on Tru64 UNIX.
18 - Make sure <alloca.h> is properly protected, and make sure
19 <stdlib.h> is included in the files using alloca() as it is
21 - Move some compatibility code into lib/compat.c
22 - Add some required header files.
23 - Remove the use of uint32_t, as it is unknown on some platforms, and
24 use the return type of the function supplying the value instead.
25 - Try to protect the code handling shadow password files with the
26 proper #ifdefs. This part is untested.
28 diff -ur src-2.8.92/acinclude.m4 src-2.8.92-local/acinclude.m4
29 --- src-2.8.92/acinclude.m4 2003-06-05 13:41:45.000000000 +0200
30 +++ src-2.8.92-local/acinclude.m4 2003-06-11 11:58:01.000000000 +0200
38 +dnl Test for __attribute__ ((unused))
39 +dnl Based on code from the tcpdump version 3.7.2 source.
42 +AC_DEFUN(AC_C___ATTRIBUTE__, [
43 +AC_MSG_CHECKING(for __attribute__)
44 +AC_CACHE_VAL(ac_cv___attribute__, [
49 +static void foo(void) __attribute__ ((unused));
57 +ac_cv___attribute__=yes,
58 +ac_cv___attribute__=no)])
59 +if test "$ac_cv___attribute__" = "yes"; then
60 + AC_DEFINE(UNUSED, __attribute__ ((unused)), [define if your compiler has __attribute__ ((unused))])
64 +AC_MSG_RESULT($ac_cv___attribute__)
68 +dnl Check whether sys/socket.h defines type socklen_t. Please note
69 +dnl that some systems require sys/types.h to be included before
70 +dnl sys/socket.h can be compiled.
72 +dnl Source: http://www.gnu.org/software/ac-archive/htmldoc/type_socklen_t.html
73 +dnl Version: 1.2 (last modified: 2000-07-19)
74 +dnl Author: Lars Brinkhoff <lars@nocrew.org>
75 +dnl Changed by Petter Reinholdtsen to use the new AC_DEFINE() arguments
77 +AC_DEFUN([TYPE_SOCKLEN_T],
78 +[AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
81 + [#include <sys/types.h>
82 + #include <sys/socket.h>],
83 + [socklen_t len = 42; return 0;],
84 + ac_cv_type_socklen_t=yes,
85 + ac_cv_type_socklen_t=no)
87 + if test $ac_cv_type_socklen_t != yes; then
88 + AC_DEFINE([socklen_t], [int], [Define if socklen_t is missing])
91 diff -ur src-2.8.92/configure.in src-2.8.92-local/configure.in
92 --- src-2.8.92/configure.in 2003-06-05 17:59:52.000000000 +0200
93 +++ src-2.8.92-local/configure.in 2003-06-11 11:57:46.000000000 +0200
95 AC_CHECK_HEADERS(xcrypt.h crypt.h)
98 -dnl XXX We need to check at first if it is not in libc or libnsl,
99 -dnl else we could get problems with ypserv on Linux.
100 -dnl AC_CHECK_LIB(rpcsvc, getrpcport)
102 +AC_CHECK_FUNCS(getrpcport)
103 +if test "$ac_cv_func_getrpcport" = no; then
104 + AC_CHECK_LIB([rpcsvc], [getrpcport],
105 + [ac_cv_func_$1=yes; LIBS="-lrpcsvc $LIBS"])
108 AC_CHECK_LIB(nsl,gethostbyname)
109 AC_CHECK_LIB(socket,socket)
110 AC_CHECK_LIB(resolv, res_gethostbyname, RESOLV="-lresolv", RESOLV="")
111 @@ -199,12 +203,14 @@
113 AC_CHECK_HEADERS(fcntl.h paths.h sys/file.h sys/time.h syslog.h unistd.h)
114 AC_CHECK_HEADERS(getopt.h shadow.h rpc/clnt_soc.h rpc/svc_soc.h)
115 -AC_CHECK_HEADERS(netinet/in.h alloca.h poll.h)
116 +AC_CHECK_HEADERS(netinet/in.h alloca.h)
117 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>])
119 dnl Checks for typedefs, structures, and compiler characteristics.
127 diff -ur src-2.8.92/lib/access.c src-2.8.92-local/lib/access.c
128 --- src-2.8.92/lib/access.c 2003-03-03 11:43:39.000000000 +0100
129 +++ src-2.8.92-local/lib/access.c 2003-06-10 15:51:32.000000000 +0200
136 static conffile_t *conf = NULL;
140 is_valid (struct svc_req *rqstp, const char *map, const char *domain)
142 - struct sockaddr_in *sin;
143 + const struct sockaddr_in *sin;
145 static unsigned long int oldaddr = 0; /* so we dont log multiple times */
146 static int oldstatus = -1;
147 diff -ur src-2.8.92/lib/compat.c src-2.8.92-local/lib/compat.c
148 --- src-2.8.92/lib/compat.c 2003-06-05 14:14:04.000000000 +0200
149 +++ src-2.8.92-local/lib/compat.c 2003-06-11 13:58:13.000000000 +0200
151 #endif /* not HAVE_GETOPT_LONG */
153 #if !defined(HAVE_GETDELIM) && !defined(HAVE_GETLINE)
154 +/* copied from cvs 1.11.5 source */
155 +/* getline.c -- Replacement for GNU C library function getline
157 +Copyright (C) 1993 Free Software Foundation, Inc.
159 +This program is free software; you can redistribute it and/or
160 +modify it under the terms of the GNU General Public License as
161 +published by the Free Software Foundation; either version 2 of the
162 +License, or (at your option) any later version.
164 +This program is distributed in the hope that it will be useful, but
165 +WITHOUT ANY WARRANTY; without even the implied warranty of
166 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
167 +General Public License for more details. */
169 +/* Written by Jan Brittenson, bson@gnu.ai.mit.edu. */
171 +#include <sys/types.h>
176 +#define GETLINE_NO_LIMIT -1
181 +char *malloc (), *realloc ();
184 +/* Always add at least this many bytes when extending the buffer. */
185 +#define MIN_CHUNK 64
187 +/* Read up to (and including) a TERMINATOR from STREAM into *LINEPTR
188 + + OFFSET (and null-terminate it). If LIMIT is non-negative, then
189 + read no more than LIMIT chars.
191 + *LINEPTR is a pointer returned from malloc (or NULL), pointing to
192 + *N characters of space. It is realloc'd as necessary.
194 + Return the number of characters read (not including the null
195 + terminator), or -1 on error or EOF. On a -1 return, the caller
196 + should check feof(), if not then errno has been set to indicate the
200 +getstr (char **lineptr, size_t *n, FILE *stream, int terminator,
201 + int offset, int limit)
203 + int nchars_avail; /* Allocated but unused chars in *LINEPTR. */
204 + char *read_pos; /* Where we're reading into *LINEPTR. */
207 + if (!lineptr || !n || !stream)
216 + *lineptr = malloc (*n);
222 + *lineptr[0] = '\0';
225 + nchars_avail = *n - offset;
226 + read_pos = *lineptr + offset;
239 + /* If limit is negative, then we shouldn't pay attention to
240 + it, so decrement only if positive. */
245 + save_errno = errno;
247 + /* We always want at least one char left in the buffer, since we
248 + always (unless we get an error while reading the first char)
249 + NUL-terminate the line buffer. */
251 + assert((*lineptr + *n) == (read_pos + nchars_avail));
252 + if (nchars_avail < 2)
254 + if (*n > MIN_CHUNK)
259 + nchars_avail = *n + *lineptr - read_pos;
260 + *lineptr = realloc (*lineptr, *n);
266 + read_pos = *n - nchars_avail + *lineptr;
267 + assert((*lineptr + *n) == (read_pos + nchars_avail));
270 + if (ferror (stream))
272 + /* Might like to return partial line, but there is no
273 + place for us to store errno. And we don't want to just
275 + errno = save_errno;
281 + /* Return partial line, if any. */
282 + if (read_pos == *lineptr)
291 + if (c == terminator)
292 + /* Return the line. */
296 + /* Done - NUL terminate and return the number of chars read. */
299 + ret = read_pos - (*lineptr + offset);
304 getline (char **lineptr, size_t * n, FILE * stream)
307 + return getstr (lineptr, n, stream, '\n', 0, GETLINE_NO_LIMIT);
311 +getline_safe (char **lineptr, size_t *n, FILE *stream, int limit)
313 + return getstr (lineptr, n, stream, '\n', 0, limit);
316 +#endif /* not HAVE_GETDELIM and not HAVE_GETLINE */
318 +#if !defined(HAVE_SVC_GETCALLER) && !defined(svc_getcaller)
319 +const struct sockaddr_in *
320 +svc_getcaller(const SVCXPRT *xprt)
322 +# ifdef HAVE_SVC_GETRPCCALLER
323 + const struct netbuf *addr;
324 + addr = svc_getrpccaller(xprt);
325 + fprintf(stderr, "warning: Bogus svc_getcaller() called\n");
326 + /* XXX find out how the result from svc_getrpccaller relates to
329 +# else /* not HAVE_SVC_GETRPCCALLER */
330 +# error "Missing both svc_getcaller() and svc_getrpccaller()"
331 +# endif /* not HAVE_SVC_GETRPCCALLER */
333 +#endif /* not HAVE_SVC_GETCALLER */
336 +#ifndef HAVE__RPC_DTABLESIZE
337 +# if HAVE_GETDTABLESIZE
338 +int _rpc_dtablesize()
343 + size = getdtablesize();
348 +# include <sys/resource.h>
349 +int _rpc_dtablesize()
351 + static int size = 0;
356 + if (getrlimit(RLIMIT_NOFILE, &rlb) >= 0)
357 + size = rlb.rlim_cur;
362 +# endif /* not HAVE_GETDTABLESIZE */
363 +#endif /* not HAVE__RPC_DTABLESIZE */
365 +#ifndef HAVE_INET_ATON
366 +/* Source: http://mail.gnu.org/archive/html/autoconf/2002-08/msg00036.html */
367 +/* $Id: ypserv-2.8.92-20030611.diff,v 1.1 2003/06/11 12:30:47 pere Exp $
369 +** Replacement for a missing inet_aton.
371 +** Written by Russ Allbery <rra@bogus.example.com>
372 +** This work is hereby placed in the public domain by its author.
374 +** Provides the same functionality as the standard library routine
375 +** inet_aton for those platforms that don't have it. inet_aton is
379 +/* #include "config.h" */
380 +/* #include "clibrary.h" */
381 +#include <netinet/in.h>
383 +/* If we're running the test suite, rename inet_ntoa to avoid conflicts with
384 + the system version. */
386 +# define inet_aton test_inet_aton
387 +int test_inet_aton(const char *, struct in_addr *);
391 +inet_aton(const char *s, struct in_addr *addr)
393 + unsigned long octet[4], address;
398 + if (s == NULL) return 0;
400 + /* Step through each period-separated part of the address. If we see
401 + more than four parts, the address is invalid. */
402 + for (p = s; *p != 0; part++) {
403 + if (part > 3) return 0;
405 + /* Determine the base of the section we're looking at. Numbers are
406 + represented the same as in C; octal starts with 0, hex starts
407 + with 0x, and anything else is decimal. */
420 + /* Make sure there's actually a number. (A section of just "0"
421 + would set base to 8 and leave us pointing at a period; allow
423 + if (*p == '.' && base != 8) return 0;
426 + /* Now, parse this segment of the address. For each digit, multiply
427 + the result so far by the base and then add the value of the
428 + digit. Be careful of arithmetic overflow in cases where an
429 + unsigned long is 32 bits; we need to detect it *before* we
430 + multiply by the base since otherwise we could overflow and wrap
431 + and then not detect the error. */
432 + for (; *p != 0 && *p != '.'; p++) {
433 + if (octet[part] > 0xffffffffUL / base) return 0;
435 + /* Use a switch statement to parse each digit rather than
436 + assuming ASCII. Probably pointless portability.... */
438 + case '0': i = 0; break;
439 + case '1': i = 1; break;
440 + case '2': i = 2; break;
441 + case '3': i = 3; break;
442 + case '4': i = 4; break;
443 + case '5': i = 5; break;
444 + case '6': i = 6; break;
445 + case '7': i = 7; break;
446 + case '8': i = 8; break;
447 + case '9': i = 9; break;
448 + case 'A': case 'a': i = 10; break;
449 + case 'B': case 'b': i = 11; break;
450 + case 'C': case 'c': i = 12; break;
451 + case 'D': case 'd': i = 13; break;
452 + case 'E': case 'e': i = 14; break;
453 + case 'F': case 'f': i = 15; break;
456 + if (i >= base) return 0;
457 + octet[part] = (octet[part] * base) + i;
460 + /* Advance over periods; the top of the loop will increment the
461 + count of parts we've seen. We need a check here to detect an
462 + illegal trailing period. */
465 + if (*p == 0) return 0;
468 + if (part == 0) return 0;
470 + /* IPv4 allows three types of address specification:
476 + If there are fewer than four segments, the final segment accounts for
477 + all of the remaining portion of the address. For example, in the a.b
478 + form, b is the final 24 bits of the address. We also allow a simple
479 + number, which is interpreted as the 32-bit number corresponding to
480 + the full IPv4 address.
482 + The first for loop below ensures that any initial segments represent
483 + only 8 bits of the address and builds the upper portion of the IPv4
484 + address. Then, the remaining segment is checked to make sure it's no
485 + bigger than the remaining space in the address and then is added into
488 + for (i = 0; i < part - 1; i++) {
489 + if (octet[i] > 0xff) return 0;
490 + address |= octet[i] << (8 * (3 - i));
492 + if (octet[i] > (0xffffffffUL >> (i * 8))) return 0;
493 + address |= octet[i];
494 + if (addr != NULL) addr->s_addr = htonl(address);
497 +#endif /* not HAVE_INET_ATON */
500 +#ifndef HAVE_INET_PTON
501 +#include <arpa/inet.h>
502 +#include <sys/socket.h>
504 +inet_pton(int af, const char *src, void *dst)
508 + return inet_aton(src, (struct in_addr *)dst);
512 +#endif /* AF_INET6 */
514 + fprintf(stderr, "warning: Bogus inet_pton() called\n");
515 + errno = EAFNOSUPPORT;
520 +#endif /* not HAVE_INET_PTON */
522 +#ifndef HAVE_FGETPWENT
524 +fgetpwent(FILE *stream)
526 + fprintf(stderr, "warning: Bogus fgetpwent() called\n");
529 +#endif /* not HAVE_FGETPWENT */
531 +#ifndef HAVE_PUTPWENT
533 +putpwent(const struct passwd *p, FILE *stream)
535 + fprintf(stderr, "warning: Bogus putpwent() called\n");
538 +#endif /* not HAVE_PUTPWENT */
540 +#ifndef HAVE_FGETGRENT
542 +fgetgrent(FILE *stream)
544 + fprintf(stderr, "warning: Bogus fgetgrent() called\n");
547 +#endif /* not HAVE_FGETGRENT */
549 +#ifndef HAVE_XDR_YPXFRSTAT
550 +#include <rpc/rpc.h>
553 +xdr_ypxfrstat(XDR *xdrs, ypxfrstat *objp)
555 + if (!xdr_enum(xdrs, (enum_t *)objp))
560 +#endif /* not HAVE_XDR_YPXFRSTAT */
562 +#ifndef HAVE_XDR_DOMAINNAME
563 +#include <rpc/rpc.h>
565 +xdr_domainname(XDR *xdrs, domainname *objp)
567 + if (!xdr_string(xdrs, objp, YPMAXDOMAIN))
572 +#endif /* not HAVE_XDR_DOMAINNAME */
574 +#ifndef HAVE_XDR_YPRESP_XFR
575 +#include <rpc/rpc.h>
577 +xdr_ypresp_xfr(XDR *xdrs, ypresp_xfr *objp)
579 + if (!xdr_u_int(xdrs, &objp->transid))
582 + if (!xdr_ypxfrstat(xdrs, &objp->xfrstat))
587 +#endif /* not HAVE_XDR_YPRESP_XFR */
589 +#ifndef HAVE_XDR_YPMAP_PARMS
591 +xdr_ypmap_parms(XDR *xdrs, ypmap_parms *objp)
593 + if (!xdr_domainname(xdrs, &objp->domain))
595 + if (!xdr_mapname(xdrs, &objp->map))
597 + if (!xdr_u_int(xdrs, &objp->ordernum))
599 + if (!xdr_peername(xdrs, &objp->peer))
603 +#endif /* not HAVE_XDR_YPMAP_PARMS */
606 +#ifndef HAVE_XDR_YPREQ_XFR
608 +xdr_ypreq_xfr(XDR *xdrs, ypreq_xfr *objp)
610 + if (!xdr_ypmap_parms(xdrs, &objp->map_parms))
612 + if (!xdr_u_int(xdrs, &objp->transid))
614 + if (!xdr_u_int(xdrs, &objp->prog))
616 + if (!xdr_u_int(xdrs, &objp->port))
620 +#endif /* not HAVE_XDR_YPREQ_XFR */
622 +#ifndef HAVE_XDR_MAPNAME
624 +xdr_mapname (XDR *xdrs, mapname *objp)
626 + if (!xdr_string (xdrs, objp, YPMAXMAP))
631 +#endif /* not HAVE_XDR_MAPNAME */
633 +#ifndef HAVE_XDR_PEERNAME
635 +xdr_peername (XDR *xdrs, peername *objp)
637 + if (!xdr_string (xdrs, objp, YPMAXPEER))
641 +#endif /* not HAVE_XDR_PEERNAME */
643 +#ifndef HAVE_XDR_YPSTAT
645 +xdr_ypstat (XDR *xdrs, ypstat *objp)
647 + if (!xdr_enum (xdrs, (enum_t *) objp))
652 +#endif /* not HAVE_XDR_YPSTAT */
654 +#ifndef HAVE_XDR_YPRESP_MASTER
656 +xdr_ypresp_master (XDR *xdrs, ypresp_master *objp)
658 + if (!xdr_ypstat (xdrs, &objp->stat))
660 + if (!xdr_peername (xdrs, &objp->peer))
664 +#endif /* not HAVE_XDR_YPRESP_MASTER */
666 +#ifndef HAVE_XDR_YPBIND_BINDING
668 +xdr_ypbind_binding (XDR *xdrs, ypbind_binding *objp)
670 + if (!xdr_opaque (xdrs, objp->ypbind_binding_addr, 4))
672 + if (!xdr_opaque (xdrs, objp->ypbind_binding_port, 2))
676 +#endif /* not HAVE_XDR_YPBIND_BINDING */
678 +#ifndef HAVE_XDR_YPREQ_NOKEY
680 +xdr_ypreq_nokey (XDR *xdrs, ypreq_nokey *objp)
682 + if (!xdr_domainname (xdrs, &objp->domain))
685 + if (!xdr_mapname (xdrs, &objp->map))
690 +#endif /* not HAVE_XDR_YPREQ_NOKEY */
692 +#ifndef HAVE_XDR_YPPUSH_STATUS
694 +xdr_yppush_status(XDR *xdrs, yppush_status *objp)
696 + if (!xdr_enum(xdrs, (enum_t *)objp))
700 +#endif /* not HAVE_XDR_YPPUSH_STATUS */
702 +#ifndef HAVE_XDR_YPPUSHRESP_XFR
704 +xdr_yppushresp_xfr(XDR *xdrs, yppushresp_xfr *objp)
706 + if (!xdr_u_int(xdrs, &objp->transid))
708 + if (!xdr_yppush_status(xdrs, &objp->status))
712 -#endif /* not HAVE_GETDELIM and not HAVE_GETLINE */
713 +#endif /* not HAVE_XDR_YPPUSHRESP_XFR */
714 diff -ur src-2.8.92/lib/compat.h src-2.8.92-local/lib/compat.h
715 --- src-2.8.92/lib/compat.h 2003-06-05 14:01:07.000000000 +0200
716 +++ src-2.8.92-local/lib/compat.h 2003-06-10 18:52:06.000000000 +0200
718 #ifndef _YPSERV_COMPAT_H
719 #define _YPSERV_COMPAT_H
721 -/* __attribute__ is only in GCC */
723 -#define UNUSED __attribute__ ((unused))
730 char *stpcpy(char *, const char *);
733 #if !defined(HAVE_GETDELIM) && !defined(HAVE_GETLINE)
734 /* Use getline() if getdelim() is missing */
735 +#include <unistd.h> /* size_t */
736 +#include <stdio.h> /* FILE */
737 ssize_t getline (char **lineptr, size_t *n, FILE *stream);
738 #endif /* not HAVE_GETDELIM and not HAVE_GETLINE */
740 +#ifndef HAVE_SVC_GETCALLER
741 +# include <rpc/rpc.h>
742 +# if !defined(svc_getcaller)
744 +const struct sockaddr_in *svc_getcaller(const SVCXPRT *xprt);
746 +#endif /* not HAVE_SVC_GETCALLER */
748 +#ifndef HAVE__RPC_DTABLESIZE
749 +int _rpc_dtablesize(void);
752 +#ifndef HAVE_INET_PTON
753 +int inet_pton(int af, const char *src, void *dst);
754 +#endif /* not HAVE_INET_PTON */
757 #endif /* not _YPSERV_COMPAT_H */
758 diff -ur src-2.8.92/lib/yp.h src-2.8.92-local/lib/yp.h
759 --- src-2.8.92/lib/yp.h 2003-06-05 16:48:11.000000000 +0200
760 +++ src-2.8.92-local/lib/yp.h 2003-06-10 18:54:02.000000000 +0200
765 -#include <pthread.h>
770 diff -ur src-2.8.92/lib/ypserv_conf.c src-2.8.92-local/lib/ypserv_conf.c
771 --- src-2.8.92/lib/ypserv_conf.c 2003-06-05 14:02:02.000000000 +0200
772 +++ src-2.8.92-local/lib/ypserv_conf.c 2003-06-10 16:04:07.000000000 +0200
774 #include <sys/types.h>
775 #include <netinet/in.h>
776 #include <arpa/inet.h>
777 +#ifdef HAVE_ALLOCA_H
779 +#endif /* HAVE_ALLOCA_H */
783 #include "ypserv_conf.h"
784 diff -ur src-2.8.92/makedbm/makedbm.c src-2.8.92-local/makedbm/makedbm.c
785 --- src-2.8.92/makedbm/makedbm.c 2003-06-05 13:41:57.000000000 +0200
786 +++ src-2.8.92-local/makedbm/makedbm.c 2003-06-10 16:06:46.000000000 +0200
791 +#ifdef HAVE_ALLOCA_H
793 +#endif /* HAVE_ALLOCA_H */
797 diff -ur src-2.8.92/rpc.yppasswdd/update.c src-2.8.92-local/rpc.yppasswdd/update.c
798 --- src-2.8.92/rpc.yppasswdd/update.c 2003-06-05 13:42:08.000000000 +0200
799 +++ src-2.8.92-local/rpc.yppasswdd/update.c 2003-06-10 18:38:03.000000000 +0200
804 +#ifdef HAVE_ALLOCA_H
806 +#endif /* HAVE_ALLOCA_H */
808 #include <sys/stat.h>
809 #include <sys/wait.h>
810 #include <netinet/in.h>
818 /* Set to 0 if you don't want to check against the root password
821 static int res; /* I hate static variables */
823 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
824 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
826 /* Be careful here with the debug option. You can see the old
827 and new password in clear text !! */
833 /* Lock the passwd file. We retry several times. */
835 while (lckpwdf () && retries < MAX_RETRIES)
836 @@ -291,11 +296,14 @@
837 log_msg ("password file locked");
840 +#endif /* HAVE_LCKPWDF */
842 res = update_files (yppw, logbuf, &shadow_changed, &passwd_changed,
847 +#endif /* HAVE_LCKPWDF */
850 /* Fork off process to rebuild NIS passwd.* maps. */
853 if (strcmp (pw->pw_passwd, "x") == 0)
855 +#ifdef HAVE_GETSPNAM /* shadow password */
858 if ((spw = getspnam ("root")) != NULL)
860 rootpass = alloca (strlen (spw->sp_pwdp) + 1);
861 strcpy (rootpass, spw->sp_pwdp);
863 +#endif /* HAVE_GETSPNAM */
868 chmod (path_passwd_tmp, passwd_stat.st_mode);
869 chown (path_passwd_tmp, passwd_stat.st_uid, passwd_stat.st_gid);
871 +#ifdef HAVE_GETSPNAM
872 /* Open the shadow file for reading. */
873 if ((oldsf = fopen (path_shadow, "r")) != NULL)
876 chmod (path_shadow_tmp, shadow_stat.st_mode);
877 chown (path_shadow_tmp, shadow_stat.st_uid, shadow_stat.st_gid);
879 +#endif /* HAVE_GETSPNAM */
881 /* Loop over all passwd entries */
882 while ((pw = fgetpwent (oldpf)) != NULL)
885 pw->pw_passwd[0] == 'x' && pw->pw_passwd[1] == '\0')
887 +#ifdef HAVE_GETSPNAM /* shadow password */
888 /* Search for the shadow entry of this user */
889 while ((spw = fgetspent (oldsf)) != NULL)
895 +#endif /* HAVE_GETSPNAM */
898 /* We don't have a shadow password file or we don't find the
900 yppw->newpw.pw_passwd[1] == '\0') &&
901 yppw->newpw.pw_passwd[0] != '\0')
903 +#ifdef HAVE_GETSPNAM /* shadow password */
906 /* test if password is expired */
910 else /* No shadow entry */
911 +#endif /* HAVE_GETSPNAM */
913 /* set the new passwd */
914 pw->pw_passwd = yppw->newpw.pw_passwd;
918 unlink (path_passwd_tmp);
919 +#ifdef HAVE_GETSPNAM
920 unlink (path_shadow_tmp);
921 +#endif /* HAVE_GETSPNAM */
924 +#ifdef HAVE_GETSPNAM
927 unlink (path_shadow_old);
931 unlink (path_shadow_tmp);
932 +#endif /* HAVE_GETSPNAM */
936 diff -ur src-2.8.92/rpc.yppasswdd/yppasswdd.c src-2.8.92-local/rpc.yppasswdd/yppasswdd.c
937 --- src-2.8.92/rpc.yppasswdd/yppasswdd.c 2003-06-05 13:42:08.000000000 +0200
938 +++ src-2.8.92-local/rpc.yppasswdd/yppasswdd.c 2003-06-10 20:03:52.000000000 +0200
947 diff -ur src-2.8.92/rpc.ypxfrd/ypxfrd.c src-2.8.92-local/rpc.ypxfrd/ypxfrd.c
948 --- src-2.8.92/rpc.ypxfrd/ypxfrd.c 2003-06-05 14:17:26.000000000 +0200
949 +++ src-2.8.92-local/rpc.ypxfrd/ypxfrd.c 2003-06-10 20:06:32.000000000 +0200
954 -#if HAVE__RPC_DTABLESIZE
955 -extern int _rpc_dtablesize(void);
956 -#elif HAVE_GETDTABLESIZE
964 - size = getdtablesize();
970 -#include <sys/resource.h>
975 - static int size = 0;
980 - if (getrlimit(RLIMIT_NOFILE, &rlb) >= 0)
981 - size = rlb.rlim_cur;
989 ** Needed, if we start rpc.ypxfrd from inetd
991 diff -ur src-2.8.92/rpc.ypxfrd/ypxfrd_server.c src-2.8.92-local/rpc.ypxfrd/ypxfrd_server.c
992 --- src-2.8.92/rpc.ypxfrd/ypxfrd_server.c 2002-12-21 14:53:26.000000000 +0100
993 +++ src-2.8.92-local/rpc.ypxfrd/ypxfrd_server.c 2003-06-10 16:15:56.000000000 +0200
1000 static int file = 0;
1004 static struct xfr result;
1005 char buf[MAXPATHLEN];
1006 - struct sockaddr_in *rqhost;
1007 + const struct sockaddr_in *rqhost;
1011 diff -ur src-2.8.92/rpc.ypxfrd/ypxfrd_svc.c src-2.8.92-local/rpc.ypxfrd/ypxfrd_svc.c
1012 --- src-2.8.92/rpc.ypxfrd/ypxfrd_svc.c 2003-06-05 17:51:39.000000000 +0200
1013 +++ src-2.8.92-local/rpc.ypxfrd/ypxfrd_svc.c 2003-06-10 16:16:29.000000000 +0200
1018 +#include <rpc/rpc.h>
1019 #include <rpc/pmap_clnt.h>
1022 diff -ur src-2.8.92/yphelper/yphelper.c src-2.8.92-local/yphelper/yphelper.c
1023 --- src-2.8.92/yphelper/yphelper.c 2003-06-05 13:42:08.000000000 +0200
1024 +++ src-2.8.92-local/yphelper/yphelper.c 2003-06-10 18:38:32.000000000 +0200
1029 +#include <sys/types.h>
1033 #include <rpc/types.h>
1034 #include <strings.h>
1035 #include <sys/socket.h>
1036 +#include <sys/param.h>
1037 #include <netinet/in.h>
1038 #include <arpa/inet.h>
1041 +#ifdef HAVE_ALLOCA_H
1043 +#endif /* HAVE_ALLOCA_H */
1044 +#include <stdlib.h>
1045 #if defined(HAVE_GETOPT_H)
1049 (pwd->pw_passwd[0] == 'x' || pwd->pw_passwd[0] == '*'))
1052 +#ifdef HAVE_GETSPNAM /* shadow password */
1053 spd = fgetspent (s_input);
1060 +#endif /* HAVE_GETSPNAM */
1062 pass = pwd->pw_passwd;
1068 +#ifdef HAVE_GETSPNAM /* shadow password */
1069 static struct __sgrp *
1070 fgetsgent (FILE *fp)
1076 +#endif /* HAVE_GETSPNAM */
1079 merge_group (char *group, char *gshadow)
1081 (grp->gr_passwd[0] == 'x' || grp->gr_passwd[0] == '*'))
1084 +#ifdef HAVE_GETSPNAM /* shadow password */
1085 spd = fgetsgent (s_input);
1092 +#endif /* HAVE_GETSPNAM */
1094 pass = grp->gr_passwd;
1096 diff -ur src-2.8.92/yppush/yppush.c src-2.8.92-local/yppush/yppush.c
1097 --- src-2.8.92/yppush/yppush.c 2003-06-05 13:42:08.000000000 +0200
1098 +++ src-2.8.92-local/yppush/yppush.c 2003-06-10 20:04:41.000000000 +0200
1102 #include <rpcsvc/ypclnt.h>
1103 +#include <rpc/svc.h>
1104 #include <arpa/inet.h>
1105 #include <sys/param.h>
1106 #include <sys/socket.h>
1108 static u_int maxchildren = 1;
1109 static u_int children = 0;
1111 -#if HAVE__RPC_DTABLESIZE
1112 -extern int _rpc_dtablesize (void);
1113 -#elif HAVE_GETDTABLESIZE
1121 - size = getdtablesize ();
1127 -#include <sys/resource.h>
1132 - static int size = 0;
1133 - struct rlimit rlb;
1137 - if (getrlimit (RLIMIT_NOFILE, &rlb) >= 0)
1138 - size = rlb.rlim_cur;
1145 yppush_err_string (enum yppush_status status)
1148 yppushproc_xfrresp_1_svc (yppushresp_xfr *req, void *resp, struct svc_req *rqstp)
1150 - struct sockaddr_in *sin;
1151 + const struct sockaddr_in *sin;
1155 diff -ur src-2.8.92/ypserv/server.c src-2.8.92-local/ypserv/server.c
1156 --- src-2.8.92/ypserv/server.c 2003-06-05 14:21:12.000000000 +0200
1157 +++ src-2.8.92-local/ypserv/server.c 2003-06-10 20:05:02.000000000 +0200
1162 +#include <sys/types.h>
1163 #include <sys/socket.h>
1164 #include <netinet/in.h>
1165 #include <arpa/inet.h>
1166 -#include <sys/types.h>
1167 #include <sys/stat.h>
1168 +#ifdef HAVE_ALLOCA_H
1170 +#endif /* HAVE_ALLOCA_H */
1172 +#include <stdlib.h>
1180 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1181 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1182 log_msg ("ypproc_null() [From: %s:%d]",
1183 inet_ntoa (rqhost->sin_addr),
1184 ntohs (rqhost->sin_port));
1189 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1190 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1191 log_msg ("ypproc_domain(\"%s\") [From: %s:%d]",
1192 *argp, inet_ntoa (rqhost->sin_addr),
1193 ntohs (rqhost->sin_port));
1198 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1199 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1200 log_msg ("ypproc_domain_nonack(\"%s\") [From: %s:%d]",
1201 *argp, inet_ntoa (rqhost->sin_addr),
1202 ntohs (rqhost->sin_port));
1207 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1208 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1210 log_msg ("ypproc_match(): [From: %s:%d]",
1211 inet_ntoa (rqhost->sin_addr), ntohs (rqhost->sin_port));
1216 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1217 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1218 log_msg ("ypproc_first(): [From: %s:%d]",
1219 inet_ntoa (rqhost->sin_addr), ntohs (rqhost->sin_port));
1225 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1226 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1228 log_msg ("ypproc_next(): [From: %s:%d]",
1229 inet_ntoa (rqhost->sin_addr), ntohs (rqhost->sin_port));
1231 struct svc_req *rqstp)
1234 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1235 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1243 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1244 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1245 log_msg ("ypproc_clear_2_svc() [From: %s:%d]",
1246 inet_ntoa (rqhost->sin_addr), ntohs (rqhost->sin_port));
1252 - struct sockaddr_in *rqhost;
1253 + const struct sockaddr_in *rqhost;
1255 rqhost = svc_getcaller (rqstp->rq_xprt);
1256 log_msg ("ypproc_all_2_svc(): [From: %s:%d]",
1261 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1262 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1263 log_msg ("ypproc_master_2_svc(): [From: %s:%d]",
1264 inet_ntoa (rqhost->sin_addr), ntohs (rqhost->sin_port));
1266 @@ -1008,7 +1011,7 @@
1270 - struct sockaddr_in *rqhost;
1271 + const struct sockaddr_in *rqhost;
1273 rqhost = svc_getcaller (rqstp->rq_xprt);
1275 @@ -1132,7 +1135,7 @@
1279 - struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1280 + const struct sockaddr_in *rqhost = svc_getcaller (rqstp->rq_xprt);
1282 log_msg ("ypproc_maplist_2_svc(): [From: %s:%d]",
1283 inet_ntoa (rqhost->sin_addr), ntohs (rqhost->sin_port));
1284 diff -ur src-2.8.92/ypserv/ypserv.c src-2.8.92-local/ypserv/ypserv.c
1285 --- src-2.8.92/ypserv/ypserv.c 2003-06-05 13:42:13.000000000 +0200
1286 +++ src-2.8.92-local/ypserv/ypserv.c 2003-06-10 20:05:16.000000000 +0200
1288 #if defined(HAVE_GETOPT_H)
1292 #include <sys/file.h>
1293 #include <sys/stat.h>
1294 #include <sys/wait.h>
1295 diff -ur src-2.8.92/ypxfr/ypxfr.c src-2.8.92-local/ypxfr/ypxfr.c
1296 --- src-2.8.92/ypxfr/ypxfr.c 2003-06-05 15:37:26.000000000 +0200
1297 +++ src-2.8.92-local/ypxfr/ypxfr.c 2003-06-10 20:05:31.000000000 +0200
1299 #include <netinet/in.h>
1300 #include <arpa/inet.h>
1302 +#ifdef HAVE_ALLOCA_H
1304 +#endif /* HAVE_ALLOCA_H */
1305 +#include <stdlib.h>
1306 #include <sys/stat.h>
1307 +#include <sys/param.h>
1308 #include "log_msg.h"
1312 struct sockaddr_in sockaddr, sockaddr_udp;
1313 struct ypresp_order resp_order;
1314 struct ypreq_nokey req_nokey;
1315 - uint32_t masterOrderNum;
1316 + time_t masterOrderNum;
1321 /* If we doesn't force the map, look, if the new map is really newer */
1324 - uint32_t localOrderNum = 0;
1325 + time_t localOrderNum = 0;
1328 #if defined(HAVE_LIBGDBM)
1330 struct in_addr remote_addr;
1331 unsigned int transid = 0;
1332 unsigned short int remote_port = 0;
1333 - uint32_t program_number = 0;
1334 + unsigned long program_number = 0;
1338 diff -ur src-2.8.92/ypxfr/ypxfr_xdr.c src-2.8.92-local/ypxfr/ypxfr_xdr.c
1339 --- src-2.8.92/ypxfr/ypxfr_xdr.c 2003-06-05 16:23:02.000000000 +0200
1340 +++ src-2.8.92-local/ypxfr/ypxfr_xdr.c 2003-06-10 18:33:16.000000000 +0200
1345 -xdr_domainname (XDR *xdrs, domainname *objp)
1347 - if (!xdr_string (xdrs, objp, YPMAXDOMAIN))
1354 -xdr_mapname (XDR *xdrs, mapname *objp)
1356 - if (!xdr_string (xdrs, objp, YPMAXMAP))
1363 -xdr_peername (XDR *xdrs, peername *objp)
1365 - if (!xdr_string (xdrs, objp, YPMAXPEER))
1371 xdr_keydat (XDR *xdrs, keydat *objp)
1373 if (!xdr_bytes (xdrs, (char **) &objp->keydat_val,
1378 -xdr_ypresp_master (XDR *xdrs, ypresp_master *objp)
1380 - if (!xdr_ypstat (xdrs, &objp->stat))
1382 - if (!xdr_peername (xdrs, &objp->peer))
1388 xdr_ypresp_order (XDR *xdrs, ypresp_order *objp)
1390 if (!xdr_ypstat (xdrs, &objp->stat))
1395 -xdr_ypbind_binding (XDR *xdrs, ypbind_binding *objp)
1397 - if (!xdr_opaque (xdrs, objp->ypbind_binding_addr, 4))
1399 - if (!xdr_opaque (xdrs, objp->ypbind_binding_port, 2))
1405 xdr_ypbind_setdom (XDR *xdrs, ypbind_setdom *objp)
1407 if (!xdr_domainname (xdrs, &objp->ypsetdom_domain))
1408 @@ -168,46 +122,6 @@
1412 -xdr_ypreq_nokey (XDR *xdrs, ypreq_nokey *objp)
1414 - if (!xdr_domainname (xdrs, &objp->domain))
1417 - if (!xdr_mapname (xdrs, &objp->map))
1424 -xdr_ypstat (XDR *xdrs, ypstat *objp)
1426 - if (!xdr_enum (xdrs, (enum_t *) objp))
1433 -xdr_ypxfrstat (XDR *xdrs, ypxfrstat *objp)
1435 - if (!xdr_enum (xdrs, (enum_t *) objp))
1442 -xdr_ypresp_xfr (XDR * xdrs, ypresp_xfr * objp)
1444 - if (!xdr_u_int (xdrs, &objp->transid))
1446 - if (!xdr_ypxfrstat (xdrs, &objp->xfrstat))
1452 ypxfr_xdr_ypresp_all (XDR *xdrs, ypresp_all *objp)