diff -u -r --new-file ypserv-1.2.8/ChangeLog ypserv-1.3.0/ChangeLog --- ypserv-1.2.8/ChangeLog Thu Jan 29 08:49:45 1998 +++ ypserv-1.3.0/ChangeLog Fri Mar 6 21:04:15 1998 @@ -1,3 +1,53 @@ +1998-03-06 Thorsten Kukuk + + * release version 1.3.0 + + * Much more changes for NDBM support + +1998-02-27 Thorsten Kukuk + + * configure.in: Check for libndbm if ndbm support is requested + + * yp_db.c: Include + + * makedbm.c (create_file): Make sure that we doesn't read the + last line twice. + + * ypserv.c (create_pidfile): Make sure pidfile gets correctly + closed when process finished. + +1998-02-19 Thorsten Kukuk + + * system.h: Use snprintf prototype only for libc 4/5 under Linux + +1998-02-05 Thorsten Kukuk + + * configure.in: Check for ndbm support in libc (SunOS/Solaris) + + * config.h.in: Define HAVE_NDBM + + * makedbm.c: Add ndbm support + * yp_db.h: Likewise. + * yp_db.c: Likewise. + +1998-02-04 Thorsten Kukuk + + * Makefile.in: Add ypserv_v1. + * yp.h: Add YP V1 prototypes. + + * ypserv.c: Remove sunos_kludge, not longer necessary. + * ypxfrd.c: Likewise. + * ypserv_conf.c: Likewise. + * ypserv.conf.5.in: Likewise. + + * yppasswd.c (ypgetpw): Use memset to clear response struct. + + * configure.in: Add --enable-fqdn switch. + * Makefile.in: Add supprt for USE_FQDN. + * makedbm.c (main): Likewise. + * yppush.c (main): Likewise. + * server.c (ypproc_master_2_svc): Likewise. + 1998-01-29 Thorsten Kukuk * release version 1.2.8 diff -u -r --new-file ypserv-1.2.8/Makefile.in ypserv-1.3.0/Makefile.in --- ypserv-1.2.8/Makefile.in Sat Jan 10 15:51:29 1998 +++ ypserv-1.3.0/Makefile.in Wed Feb 4 22:20:30 1998 @@ -25,7 +25,7 @@ ## ## Changed for configure: Thorsten Kukuk ## -## $Id: Makefile.in,v 1.29 1998/01/10 14:51:29 kukuk Exp $ +## $Id: Makefile.in,v 1.31 1998/02/04 21:20:30 kukuk Exp $ ## #### Start of system configuration section. #### @@ -64,6 +64,9 @@ ## Should we allow root to change NIS passwords ? ("yes" OR "no") checkroot = @CHECKROOT@ +## Should we always use FQDN ? ("yes" OR "no") +use_fqdn = @USE_FQDN@ + ## Where the ypmake sources are: YPMAKESRC = @srcdir@/ypmake @@ -104,6 +107,12 @@ CPPFLAGS += -DCHECKROOT=0 endif +ifneq ($(use_fqdn),no) +CPPFLAGS += -DUSE_FQDN=1 +else +CPPFLAGS += -DUSE_FQDN=0 +endif + LDFLAGS = @LDFLAGS@ WARNFLAGS = @WARNFLAGS@ @@ -117,10 +126,10 @@ SRCS= server.c ypserv.c ypserv_xdr.c yppush.c yppush_xdr.c\ ypxfr.c ypxfr_xdr.c ypxfr_clnt.c makedbm.c hash.c\ dns_hosts.c access.c yp_msg.c revnetgroup.c getnetgrent.c\ - ypserv_conf.c mknetid.c netid_hash.c ypxfrd_svc.c\ + ypserv_conf.c mknetid.c netid_hash.c ypxfrd_svc.c ypserv_v1.c\ ypxfrd_server.c ypxfrd.c ypxfrd_getmap.c yp_db.c ypxfrd_xdr.c YPSERVOBJ= server.o ypserv.o ypserv_xdr.o dns_hosts.o access.o yp_msg.o\ - ypserv_conf.o yp_db.o + ypserv_conf.o yp_db.o ypserv_v1.o YPPUSHOBJ= yppush.o yppush_xdr.o yp_msg.o YPXFRDOBJ= ypxfrd_svc.o ypxfrd_server.o access.o ypxfrd.o ypxfrd_xdr.o \ ypserv_conf.o yp_msg.o dns_hosts.o yp_db.o diff -u -r --new-file ypserv-1.2.8/NEWS ypserv-1.3.0/NEWS --- ypserv-1.2.8/NEWS Thu Jan 1 01:00:00 1970 +++ ypserv-1.3.0/NEWS Fri Mar 6 21:10:18 1998 @@ -0,0 +1,66 @@ +NYS ypserv NEWS -- history of user-visible changes. + +Copyright (C) 1998 Thorsten Kukuk + +Please send bug reports, questions and suggestions to +. + + +Version 1.3.0 + +* Support for ndbm (SunOS 4.x/5.x) (Not complete) + +* Add FQDN support (configure --enable-fqdn). All hostnames will + go through gethostbyname to determine the offical hostname. + +* Add YP V1 protocol + + +Version 1.2.8 + +* Bugfixes + + +Version 1.2.7 + +* Bugfixes + + +Version 1.2.6 + +* pwupdate and makedbm man pages + +* Remove tryresolve, hacker could stop ypserv with it + + +Version 1.2.5 + +* Add patches from SuSE distribution + + +Version 1.2.4 + +* yppasswd and rpc.yppasswdd bugfixes + +Version 1.2.3 + +* Fix _dns_gethostbyname problem with Linux/libc5 + + +Version 1.2.2 + +* rpc.yppasswdd bugfixes + +* ypMakefile improvements + + +Version 1.2.1 + +* Fix ypserv DB file caching + +* A lot of rpc.yppasswdd bugfixes + + +Version 1.2.0 + +* Cache the DB file handles diff -u -r --new-file ypserv-1.2.8/README ypserv-1.3.0/README --- ypserv-1.2.8/README Thu Jan 29 08:57:45 1998 +++ ypserv-1.3.0/README Fri Mar 6 21:18:58 1998 @@ -1,5 +1,5 @@ -This is version 1.2.8 of an YP (NIS version 2) Server for Linux, but it +This is version 1.3.0 of an YP (NIS version 2) Server for Linux, but it also runs under other OS like SunOS 4.1.x, Solaris 2.x, AIX, HP-UX, IRIS, Ultrix and OSF1 (alpha). @@ -18,12 +18,18 @@ ftp://ftp.kernel.org/pub/linux/utils/net/NIS The old site's will not be updated any longer from me. +This version has support for the ndbm database from Sun and the +db ndbm emulation. It isn't completly tested, and there are still +a lot of known bugs. Be careful with it. + I have the rpc.yppasswdd daemon included. This version based on the yppasswd 0.9 from Olaf Kirch. I have rewritten the update routine for better shadow support and fix some buffer overflow problems. -A yppasswd client is in the contrib directory or get the yp-tools 1.4. -Since I have take over the maintaince of yppasswd, there will be no new -separate version. The last public version is yppasswd 0.10. +A yppasswd client is in the contrib directory, which should work on all +platforms. For Linux with glibc 2.x or libc >= 5.4.36, get the +yp-tools 1.4.1. Since I have take over the maintaince of yppasswd, there +will be no new separate version. I have removed the last public version +0.10 from the ftp servers, because it was to buggy. The NIS server can optionally do DNS lookups for hosts not found in the regular YP hosts map. But beware that for this to work you @@ -36,6 +42,8 @@ under other OS then Linux. Under SunOS and Solaris you could use the resolv+ library, I don't know if they work on other Systems. DNS lookup is enabled by using the "-b" or "--dns" flag. +You should have a very good and fast DNS server for it, or you could +get a lot of trouble. If you don't need this feature, don't use it ! There are two ways to check if the client is allowed to ask the ypserv daemon: "securenets" and "tcp wrapper". See the file @@ -50,4 +58,4 @@ Thanks to Terje Malmedal , who had send patches for AIX, HP-UX, IRIX, Ultrix and OSF1(alpha). -Thorsten Kukuk , 26. January 1998 +Thorsten Kukuk , 6. March 1998 diff -u -r --new-file ypserv-1.2.8/TODO ypserv-1.3.0/TODO --- ypserv-1.2.8/TODO Sat Jan 10 16:03:12 1998 +++ ypserv-1.3.0/TODO Fri Mar 6 21:05:03 1998 @@ -4,12 +4,13 @@ o Change ypinit -s, so that ypwhich isn't needed - o remove NOPUSH from the Makefile. It should look at ypservers - to see if there are other servers who should be notified. - o Make yppasswd and rpc.yppasswdd PAM aware (for choosing better passwords) o Make sure there are no memory leaks + + o ypcat doesn't work with NDBM + + o test yp_first, yp_next o Remove all remaining bugs :-) diff -u -r --new-file ypserv-1.2.8/config.h.in ypserv-1.3.0/config.h.in --- ypserv-1.2.8/config.h.in Fri Jan 9 21:41:41 1998 +++ ypserv-1.3.0/config.h.in Thu Feb 5 21:23:07 1998 @@ -3,7 +3,7 @@ #ifndef CONFIG_H #define CONFIG_H -/* $Id: config.h.in,v 1.11 1998/01/09 20:41:41 kukuk Exp $ */ +/* $Id: config.h.in,v 1.13 1998/02/05 20:23:07 kukuk Exp $ */ /* Define to empty if the keyword does not work. */ #undef const @@ -176,5 +176,8 @@ /* Define if you have the gdbm library (-lgdbm). */ #undef HAVE_LIBGDBM + +/* Define if you have ndbm support. */ +#undef HAVE_NDBM #endif diff -u -r --new-file ypserv-1.2.8/configure ypserv-1.3.0/configure --- ypserv-1.2.8/configure Sat Jan 10 15:47:16 1998 +++ ypserv-1.3.0/configure Fri Feb 27 19:57:20 1998 @@ -13,6 +13,8 @@ # Any additions from configure.in: ac_default_prefix=/usr ac_help="$ac_help + --enable-fqdn Always use FQDN [default=no]" +ac_help="$ac_help --enable-yppasswd Install yppasswd [default=no]" ac_help="$ac_help --enable-checkroot Allow root to change passwords [default=no]" @@ -22,6 +24,8 @@ --enable-tcp-wrapper[=BASE-DIR] Specifies the use of tcp wrapper [default=no]" ac_help="$ac_help --with-gdbm-dir=BASE-DIR Specifies the base gdbm directory" +ac_help="$ac_help + --with-ndbm=[yes|no] Use ndbm instead of gdbm" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -547,7 +551,7 @@ test "$CFLAGS" = "" && CFLAGS="-O2 -Wall" echo $ac_n "checking for ULTRIX""... $ac_c" 1>&6 -echo "configure:551: checking for ULTRIX" >&5 +echo "configure:555: checking for ULTRIX" >&5 if test `uname` = ULTRIX then echo "$ac_t""yes" 1>&6 @@ -559,7 +563,7 @@ echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for OSF1""... $ac_c" 1>&6 -echo "configure:563: checking for OSF1" >&5 +echo "configure:567: checking for OSF1" >&5 if test `uname` = OSF1 then echo "$ac_t""yes" 1>&6 @@ -574,7 +578,7 @@ # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:578: checking for $ac_word" >&5 +echo "configure:582: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -603,7 +607,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:607: checking for $ac_word" >&5 +echo "configure:611: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -651,7 +655,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:655: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:659: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -661,11 +665,11 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:673: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -685,12 +689,12 @@ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:689: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:693: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:694: checking whether we are using GNU C" >&5 +echo "configure:698: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -699,7 +703,7 @@ yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:703: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:707: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -714,7 +718,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:718: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:722: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -746,7 +750,7 @@ WARNFLAGS="-Wall" echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:750: checking for POSIXized ISC" >&5 +echo "configure:754: checking for POSIXized ISC" >&5 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then @@ -767,7 +771,7 @@ fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:771: checking how to run the C preprocessor" >&5 +echo "configure:775: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -782,13 +786,13 @@ # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:792: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:796: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -799,13 +803,13 @@ rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:809: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:813: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -857,7 +861,7 @@ # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:861: checking for a BSD compatible install" >&5 +echo "configure:865: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -909,14 +913,14 @@ #AC_PROG_MAKE_SET echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:913: checking whether byte ordering is bigendian" >&5 +echo "configure:917: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext < #include @@ -927,11 +931,11 @@ #endif ; return 0; } EOF -if { (eval echo configure:931: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:935: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext < #include @@ -942,7 +946,7 @@ #endif ; return 0; } EOF -if { (eval echo configure:946: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:950: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -962,7 +966,7 @@ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:983: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -1004,7 +1008,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1008: checking for $ac_word" >&5 +echo "configure:1012: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_AWK'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1050,7 +1054,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1054: checking for $ac_word" >&5 +echo "configure:1058: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_BASH'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1088,7 +1092,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1092: checking for $ac_word" >&5 +echo "configure:1096: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MAKE'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1134,7 +1138,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1138: checking for $ac_word" >&5 +echo "configure:1142: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MAKEDBM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1168,6 +1172,16 @@ +# Check whether --enable-fqdn or --disable-fqdn was given. +if test "${enable_fqdn+set}" = set; then + enableval="$enable_fqdn" + USE_FQDN=$enableval +else + USE_FQDN=no +fi + + + # Check whether --enable-yppasswd or --disable-yppasswd was given. if test "${enable_yppasswd+set}" = set; then enableval="$enable_yppasswd" @@ -1206,7 +1220,7 @@ if test x$enableval = xyes then echo $ac_n "checking for main in -lwrap""... $ac_c" 1>&6 -echo "configure:1210: checking for main in -lwrap" >&5 +echo "configure:1224: checking for main in -lwrap" >&5 ac_lib_var=`echo wrap'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1214,14 +1228,14 @@ ac_save_LIBS="$LIBS" LIBS="-lwrap $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1239: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1260,13 +1274,18 @@ -libgdbm_parameter=no +libdb_parameter=no # Check whether --with-gdbm-dir or --without-gdbm-dir was given. if test "${with_gdbm_dir+set}" = set; then withval="$with_gdbm_dir" if test x$withval = xyes then - echo "configure: warning: Usage is: --with-gdbm-dir=base-dir" 1>&2 + LIBDBM="-lgdbm" + cat >> confdefs.h <<\EOF +#define HAVE_LIBGDBM 1 +EOF + + libdb_parameter=yes else LIBDBM="-L$withval/lib -lgdbm" cat >> confdefs.h <<\EOF @@ -1274,17 +1293,77 @@ EOF CPPFLAGS="$CPPFLAGS -I$withval/include" - libgdbm_parameter=yes + libdb_parameter=yes + fi + +fi + + +# Check whether --with-ndbm or --without-ndbm was given. +if test "${with_ndbm+set}" = set; then + withval="$with_ndbm" + if test x$libdb_parameter != xno + then + echo "configure: warning: You could specify only one database!" 1>&2 + fi + if test x$withval = xyes + then + echo $ac_n "checking for dbm_open in -lndbm""... $ac_c" 1>&6 +echo "configure:1313: checking for dbm_open in -lndbm" >&5 +ac_lib_var=`echo ndbm'_'dbm_open | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lndbm $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBDBM="-lndbm" +else + echo "$ac_t""no" 1>&6 +LIBDBM="" +fi + + cat >> confdefs.h <<\EOF +#define HAVE_NDBM 1 +EOF + + libdb_parameter=yes fi fi -if test x$libgdbm_parameter != xyes +if test x$libdb_parameter != xyes then -echo $ac_n "checking for gdbm_open in -lgdbm""... $ac_c" 1>&6 -echo "configure:1288: checking for gdbm_open in -lgdbm" >&5 + echo $ac_n "checking for gdbm_open in -lgdbm""... $ac_c" 1>&6 +echo "configure:1367: checking for gdbm_open in -lgdbm" >&5 ac_lib_var=`echo gdbm'_'gdbm_open | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1292,7 +1371,7 @@ ac_save_LIBS="$LIBS" LIBS="-lgdbm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1386: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1324,24 +1403,91 @@ LIBDBM="" fi -cat >> confdefs.h <<\EOF + if test x"" != x"${LIBDBM}" + then + cat >> confdefs.h <<\EOF #define HAVE_LIBGDBM 1 EOF + libdb_parameter=yes + else + for ac_func in dbm_open +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1418: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:1446: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + if eval "test \"`echo '$ac_cv_func_dbm_open'`\" = yes"; then + cat >> confdefs.h <<\EOF +#define HAVE_NDBM 1 +EOF + + libdb_parameter=yes + fi + fi fi -if test x"" = x"${LIBDBM}" +if test x$libdb_parameter != xyes then echo " - You need the GNU GDBM library for this package !" + You need the GNU GDBM library or NDBM support for this package !" echo "" echo "" exit fi echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6 -echo "configure:1345: checking for crypt in -lcrypt" >&5 +echo "configure:1491: checking for crypt in -lcrypt" >&5 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1349,7 +1495,7 @@ ac_save_LIBS="$LIBS" LIBS="-lcrypt $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1510: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1383,7 +1529,7 @@ echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:1387: checking for gethostbyname in -lnsl" >&5 +echo "configure:1533: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1391,7 +1537,7 @@ ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1432,12 +1578,12 @@ for ac_func in getrpcport do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1436: checking for $ac_func" >&5 +echo "configure:1582: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1488,7 +1634,7 @@ LIBRPC="" else echo $ac_n "checking for getrpcport in -lrpcsvc""... $ac_c" 1>&6 -echo "configure:1492: checking for getrpcport in -lrpcsvc" >&5 +echo "configure:1638: checking for getrpcport in -lrpcsvc" >&5 ac_lib_var=`echo rpcsvc'_'getrpcport | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1496,7 +1642,7 @@ ac_save_LIBS="$LIBS" LIBS="-lrpcsvc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1657: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1533,7 +1679,7 @@ echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:1537: checking for socket in -lsocket" >&5 +echo "configure:1683: checking for socket in -lsocket" >&5 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1541,7 +1687,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1580,7 +1726,7 @@ fi echo $ac_n "checking for res_gethostbyname in -lresolv""... $ac_c" 1>&6 -echo "configure:1584: checking for res_gethostbyname in -lresolv" >&5 +echo "configure:1730: checking for res_gethostbyname in -lresolv" >&5 ac_lib_var=`echo resolv'_'res_gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1588,7 +1734,7 @@ ac_save_LIBS="$LIBS" LIBS="-lresolv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1628,7 +1774,7 @@ else echo $ac_n "checking for gethostbyname in -lresolv+""... $ac_c" 1>&6 -echo "configure:1632: checking for gethostbyname in -lresolv+" >&5 +echo "configure:1778: checking for gethostbyname in -lresolv+" >&5 ac_lib_var=`echo resolv+'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1636,7 +1782,7 @@ ac_save_LIBS="$LIBS" LIBS="-lresolv+ $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1797: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1676,12 +1822,12 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:1680: checking for $ac_hdr that defines DIR" >&5 +echo "configure:1826: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -1689,7 +1835,7 @@ DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:1693: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1839: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -1714,7 +1860,7 @@ # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:1718: checking for opendir in -ldir" >&5 +echo "configure:1864: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1722,7 +1868,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1755,7 +1901,7 @@ else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:1759: checking for opendir in -lx" >&5 +echo "configure:1905: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1763,7 +1909,7 @@ ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1924: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1797,12 +1943,12 @@ fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1801: checking for ANSI C header files" >&5 +echo "configure:1947: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1810,7 +1956,7 @@ #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1814: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1960: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1827,7 +1973,7 @@ if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1845,7 +1991,7 @@ if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1866,7 +2012,7 @@ : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1877,7 +2023,7 @@ exit (0); } EOF -if { (eval echo configure:1881: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -1901,12 +2047,12 @@ fi echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:1905: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:2051: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1922,7 +2068,7 @@ s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:1926: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2072: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -1946,17 +2092,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1950: checking for $ac_hdr" >&5 +echo "configure:2096: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1960: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2106: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1986,17 +2132,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1990: checking for $ac_hdr" >&5 +echo "configure:2136: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2000: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2146: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2024,12 +2170,12 @@ echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2028: checking for working const" >&5 +echo "configure:2174: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2228: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -2099,21 +2245,21 @@ fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:2103: checking for inline" >&5 +echo "configure:2249: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2263: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -2139,12 +2285,12 @@ esac echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:2143: checking for pid_t" >&5 +echo "configure:2289: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2172,12 +2318,12 @@ fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:2176: checking for size_t" >&5 +echo "configure:2322: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2205,12 +2351,12 @@ fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:2209: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:2355: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2219,7 +2365,7 @@ struct tm *tp; ; return 0; } EOF -if { (eval echo configure:2223: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2369: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -2241,9 +2387,9 @@ echo $ac_n "checking for resultproc_t in rpc/clnt.h""... $ac_c" 1>&6 -echo "configure:2245: checking for resultproc_t in rpc/clnt.h" >&5 +echo "configure:2391: checking for resultproc_t in rpc/clnt.h" >&5 cat > conftest.$ac_ext < EOF @@ -2263,9 +2409,9 @@ rm -f conftest* echo $ac_n "checking for resultproc_t in rpc/pmap_clnt.h""... $ac_c" 1>&6 -echo "configure:2267: checking for resultproc_t in rpc/pmap_clnt.h" >&5 +echo "configure:2413: checking for resultproc_t in rpc/pmap_clnt.h" >&5 cat > conftest.$ac_ext < EOF @@ -2286,7 +2432,7 @@ echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 -echo "configure:2290: checking for 8-bit clean memcmp" >&5 +echo "configure:2436: checking for 8-bit clean memcmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2294,7 +2440,7 @@ ac_cv_func_memcmp_clean=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2454: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_memcmp_clean=yes else @@ -2322,12 +2468,12 @@ test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.o" echo $ac_n "checking for vprintf""... $ac_c" 1>&6 -echo "configure:2326: checking for vprintf" >&5 +echo "configure:2472: checking for vprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2500: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_vprintf=yes" else @@ -2374,12 +2520,12 @@ if test "$ac_cv_func_vprintf" != yes; then echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 -echo "configure:2378: checking for _doprnt" >&5 +echo "configure:2524: checking for _doprnt" >&5 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func__doprnt=yes" else @@ -2427,7 +2573,7 @@ fi echo $ac_n "checking for wait3 that fills in rusage""... $ac_c" 1>&6 -echo "configure:2431: checking for wait3 that fills in rusage" >&5 +echo "configure:2577: checking for wait3 that fills in rusage" >&5 if eval "test \"`echo '$''{'ac_cv_func_wait3_rusage'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2435,7 +2581,7 @@ ac_cv_func_wait3_rusage=no else cat > conftest.$ac_ext < #include @@ -2466,7 +2612,7 @@ } } EOF -if { (eval echo configure:2470: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2616: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_wait3_rusage=yes else @@ -2491,12 +2637,12 @@ for ac_func in wait4 inet_aton vsyslog lckpwdf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2495: checking for $ac_func" >&5 +echo "configure:2641: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2669: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2546,12 +2692,12 @@ for ac_func in strdup strerror strstr strsep snprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2550: checking for $ac_func" >&5 +echo "configure:2696: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2724: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2601,12 +2747,12 @@ for ac_func in _dns_gethostbyname do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2605: checking for $ac_func" >&5 +echo "configure:2751: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2779: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2656,12 +2802,12 @@ for ac_func in gethostname gettimeofday select socket uname getopt_long do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2660: checking for $ac_func" >&5 +echo "configure:2806: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2834: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2711,12 +2857,12 @@ for ac_func in _rpc_dtablesize getdtablesize getspnam getline getdelim do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2715: checking for $ac_func" >&5 +echo "configure:2861: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2889: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2904,6 +3050,7 @@ s%@BASH@%$BASH%g s%@MAKE@%$MAKE%g s%@MAKEDBM@%$MAKEDBM%g +s%@USE_FQDN@%$USE_FQDN%g s%@YPWDCLIENT@%$YPWDCLIENT%g s%@CHECKROOT@%$CHECKROOT%g s%@YPMAKE@%$YPMAKE%g @@ -3149,12 +3296,13 @@ Install path prefix: ${prefix}" if test ${sysconfdir} != '${prefix}/etc' then - echo " Install ypserv.conf in: ${sysconfdir}" + echo " Install ypserv.conf in: ${sysconfdir}" else - echo " Install ypserv.conf in: ${prefix}/etc" + echo " Install ypserv.conf in: ${prefix}/etc" fi - echo " Install makedbm in: ${MAKEDBM}" - echo " Install ypmake: ${YPMAKE}" - echo " Install yppasswd: ${YPWDCLIENT}" - echo " Allow root password: ${CHECKROOT}" + echo " Install makedbm in: ${MAKEDBM}" + echo " Install ypmake: ${YPMAKE}" + echo " Install yppasswd: ${YPWDCLIENT}" + echo " Allow root password: ${CHECKROOT}" + echo " Use FQDN as master name: ${USE_FQDN}" echo "" diff -u -r --new-file ypserv-1.2.8/configure.in ypserv-1.3.0/configure.in --- ypserv-1.2.8/configure.in Sat Jan 10 15:51:29 1998 +++ ypserv-1.3.0/configure.in Fri Mar 6 21:01:11 1998 @@ -1,7 +1,7 @@ # # Copyright (C) 1997, 1998 Thorsten Kukuk # -# $Id: configure.in,v 1.20 1998/01/10 14:51:29 kukuk Exp $ +# $Id: configure.in,v 1.23 1998/03/06 20:01:11 kukuk Exp $ # dnl Process this file with autoconf to produce a configure script. AC_INIT(server.c) @@ -88,6 +88,12 @@ AC_PATH_PROGS(MAKEDBM, makedbm, $libexecdir/makedbm) AC_SUBST(MAKEDBM) +dnl Should we use a gethostbyname after gethostname to use FQDN ? default no +AC_ARG_ENABLE(fqdn, + [ --enable-fqdn Always use FQDN [default=no]], + USE_FQDN=$enableval, USE_FQDN=no) +AC_SUBST(USE_FQDN) + dnl Should we compile and install yppasswd ? default: no AC_ARG_ENABLE(yppasswd, [ --enable-yppasswd Install yppasswd [default=no]], @@ -124,32 +130,58 @@ ) AC_SUBST(TCP_WRAP) -libgdbm_parameter=no +libdb_parameter=no AC_ARG_WITH(gdbm-dir, [ --with-gdbm-dir=BASE-DIR Specifies the base gdbm directory], if test x$withval = xyes then - AC_MSG_WARN(Usage is: --with-gdbm-dir=base-dir) + LIBDBM="-lgdbm" + AC_DEFINE(HAVE_LIBGDBM) + libdb_parameter=yes else LIBDBM="-L$withval/lib -lgdbm" AC_DEFINE(HAVE_LIBGDBM) CPPFLAGS="$CPPFLAGS -I$withval/include" - libgdbm_parameter=yes + libdb_parameter=yes + fi +) + +AC_ARG_WITH(ndbm, + [ --with-ndbm=[yes|no] Use ndbm instead of gdbm], + if test x$libdb_parameter != xno + then + AC_MSG_WARN(You could specify only one database!) + fi + if test x$withval = xyes + then + AC_CHECK_LIB(ndbm, dbm_open, LIBDBM="-lndbm", LIBDBM="") + AC_DEFINE(HAVE_NDBM) + libdb_parameter=yes fi ) AC_SUBST(LIBDBM) -if test x$libgdbm_parameter != xyes +if test x$libdb_parameter != xyes then -AC_CHECK_LIB(gdbm,gdbm_open,LIBDBM="-lgdbm",LIBDBM="") -AC_DEFINE(HAVE_LIBGDBM) + AC_CHECK_LIB(gdbm,gdbm_open,LIBDBM="-lgdbm",LIBDBM="") + if test x"" != x"${LIBDBM}" + then + AC_DEFINE(HAVE_LIBGDBM) + libdb_parameter=yes + else + AC_CHECK_FUNCS(dbm_open) + if eval "test \"`echo '$ac_cv_func_dbm_open'`\" = yes"; then + AC_DEFINE(HAVE_NDBM) + libdb_parameter=yes + fi + fi fi -if test x"" = x"${LIBDBM}" +if test x$libdb_parameter != xyes then echo " - You need the GNU GDBM library for this package !" + You need the GNU GDBM library or NDBM support for this package !" echo "" echo "" exit @@ -229,12 +261,13 @@ Install path prefix: ${prefix}" if test ${sysconfdir} != '${prefix}/etc' then - echo " Install ypserv.conf in: ${sysconfdir}" + echo " Install ypserv.conf in: ${sysconfdir}" else - echo " Install ypserv.conf in: ${prefix}/etc" + echo " Install ypserv.conf in: ${prefix}/etc" fi - echo " Install makedbm in: ${MAKEDBM}" - echo " Install ypmake: ${YPMAKE}" - echo " Install yppasswd: ${YPWDCLIENT}" - echo " Allow root password: ${CHECKROOT}" + echo " Install makedbm in: ${MAKEDBM}" + echo " Install ypmake: ${YPMAKE}" + echo " Install yppasswd: ${YPWDCLIENT}" + echo " Allow root password: ${CHECKROOT}" + echo " Use FQDN as master name: ${USE_FQDN}" echo "" diff -u -r --new-file ypserv-1.2.8/makedbm.c ypserv-1.3.0/makedbm.c --- ypserv-1.2.8/makedbm.c Thu Jan 29 08:39:41 1998 +++ ypserv-1.3.0/makedbm.c Fri Mar 6 21:01:11 1998 @@ -22,7 +22,7 @@ */ #ifndef LINT -static const char rcsid[] = "$Id: makedbm.c,v 1.10 1998/01/25 07:31:47 kukuk Exp $"; +static const char rcsid[] = "$Id: makedbm.c,v 1.13 1998/03/06 20:01:11 kukuk Exp $"; #endif #define _GNU_SOURCE @@ -56,9 +56,27 @@ #else #include #endif + +#if defined(HAVE_LIBGDBM) + #include +#define ypdb_store gdbm_store +#define YPDB_REPLACE GDBM_REPLACE +#define ypdb_close gdbm_close static GDBM_FILE dbm; + +#elif defined (HAVE_NDBM) + +#include + +#define ypdb_store dbm_store +#define YPDB_REPLACE DBM_REPLACE +#define ypdb_close dbm_close +static DBM *dbm; + +#endif + static int lower = 0; #ifndef HAVE_GETOPT_LONG @@ -69,14 +87,26 @@ static inline void write_data (datum key, datum data) { - if (gdbm_store (dbm, key, data, GDBM_REPLACE) < 0) + if (ypdb_store (dbm, key, data, YPDB_REPLACE) != 0) { perror ("makedbm: dbm_store"); - gdbm_close (dbm); + ypdb_close (dbm); exit (1); } } +#ifdef HAVE_NDBM +static char * +strapp (const char *str1, const char *str2) +{ + char buffer[strlen (str1) + strlen (str2) + 1]; + + strcpy (buffer, str1); + strcat (buffer, str2); + + return strdup (buffer); +} +#endif static void create_file (char *fileName, char *dbmName, char *masterName, @@ -102,7 +132,11 @@ filename = calloc (1, strlen (dbmName) + 3); sprintf (filename, "%s~", dbmName); +#if defined(HAVE_LIBGDBM) dbm = gdbm_open (filename, 0, GDBM_NEWDB | GDBM_FAST, 0600, NULL); +#elif defined(HAVE_NDBM) + dbm = dbm_open (filename, O_CREAT|O_RDWR, 0600); +#endif if (dbm == NULL) { fprintf (stderr, "makedbm: Cannot open %s\n", filename); @@ -196,6 +230,7 @@ keylen = 8096; key = malloc (keylen); } + key[0] = '\0'; fgets (key, keylen - 1, input); if (key != NULL) n = strlen (key); @@ -319,9 +354,33 @@ } } - gdbm_close (dbm); + ypdb_close (dbm); +#if defined(HAVE_NDBM) +#if defined(__GLIBC__) && __GLIBC__ >= 2 + { + char *dbm_db = strapp (dbmName, ".db"); + char *filedb = strapp (filename, ".db"); + + unlink (dbm_db); + rename (filedb, dbm_db); + } +#else + { + char *dbm_pag = strapp (dbmName, ".pag"); + char *dbm_dir = strapp (dbmName, ".dir"); + char *filepag = strapp (filename, ".pag"); + char *filedir = strapp (filename, ".dir"); + + unlink (dbm_pag); + unlink (dbm_dir); + rename (filepag, dbm_pag); + rename (filedir, dbm_dir); + } +#endif +#else unlink (dbmName); rename (filename, dbmName); +#endif free (filename); } @@ -329,11 +388,17 @@ dump_file (char *dbmName) { datum key, data; - if ((dbm = gdbm_open (dbmName, 0, GDBM_READER, 0600, NULL)) == NULL) +#if defined(HAVE_LIBGDBM) + dbm = gdbm_open (dbmName, 0, GDBM_READER, 0600, NULL); +#elif defined(HAVE_NDBM) + dbm = dbm_open (dbmName, O_RDONLY, 0600); +#endif + if (dbm == NULL) { fprintf (stderr, "makedbm: Cannot open %s\n", dbmName); exit (1); } +#if defined(HAVE_LIBGDBM) for (key = gdbm_firstkey (dbm); key.dptr; key = gdbm_nextkey (dbm, key)) { data = gdbm_fetch (dbm, key); @@ -348,7 +413,24 @@ data.dsize, data.dptr); free (data.dptr); } - gdbm_close (dbm); +#elif defined(HAVE_NDBM) + key = dbm_firstkey (dbm); + while (key.dptr) + { + data = dbm_fetch (dbm, key); + if (!data.dptr) + { + fprintf (stderr, "Error:\n"); + perror (dbmName); + exit (1); + } + printf ("%.*s %.*s\n", + key.dsize, key.dptr, + data.dsize, data.dptr); + key = dbm_nextkey (dbm); + } +#endif + ypdb_close (dbm); } static void @@ -492,6 +574,20 @@ if (strlen (masterName) == 0) if (gethostname (masterName, sizeof (masterName)) < 0) perror ("gethostname"); +#if USE_FQDN + else + { + struct hostent *hp; + + if (!(hp = gethostbyname (masterName))) + perror ("gethostbyname()"); + else + { + strncpy (masterName, hp->h_name, MAXHOSTNAMELEN); + masterName[MAXHOSTNAMELEN] = '\0'; + } + } +#endif create_file (argv[0], argv[1], masterName, domainName, inputName, outputName, aliases, shortline, diff -u -r --new-file ypserv-1.2.8/server.c ypserv-1.3.0/server.c --- ypserv-1.2.8/server.c Thu Jan 1 12:20:08 1998 +++ ypserv-1.3.0/server.c Fri Mar 6 21:01:11 1998 @@ -26,7 +26,7 @@ */ #ifndef LINT -static const char rcsid[] = "$Id: server.c,v 1.19 1998/01/01 11:20:08 kukuk Exp $"; +static const char rcsid[] = "$Id: server.c,v 1.21 1998/03/06 20:01:11 kukuk Exp $"; #endif #if defined(HAVE_CONFIG_H) @@ -251,7 +251,7 @@ result.val.valdat_len = 0; if (result.val.valdat_val) { - free (result.val.valdat_val); + ypdb_free (result.val.valdat_val); result.val.valdat_val = NULL; } @@ -445,14 +445,14 @@ result.key.keydat_len = 0; if (result.key.keydat_val) { - free (result.key.keydat_val); + ypdb_free (result.key.keydat_val); result.key.keydat_val = NULL; } result.val.valdat_len = 0; if (result.val.valdat_val) { - free (result.val.valdat_val); + ypdb_free (result.val.valdat_val); result.val.valdat_val = NULL; } @@ -545,14 +545,14 @@ result.key.keydat_len = 0; if (result.key.keydat_val) { - free (result.key.keydat_val); + ypdb_free (result.key.keydat_val); result.key.keydat_val = NULL; } result.val.valdat_len = 0; if (result.val.valdat_val) { - free (result.val.valdat_val); + ypdb_free (result.val.valdat_val); result.val.valdat_val = NULL; } @@ -823,7 +823,7 @@ } ypdb_close (((ypall_data_t) data)->dbm); - free (data); + ypdb_free (data); return 0; } @@ -1032,7 +1032,26 @@ if (val.dptr == NULL) { /* No YP_MASTER_NAME record in map? Assume we are Master */ - gethostname (hostbuf, sizeof (hostbuf) - 1); + if(gethostname (hostbuf, sizeof (hostbuf) - 1) != 0) + { + perror ("gethostname"); + exit (1); + } +#if USE_FQDN + else + { + struct hostent *hp; + + if (!(hp = gethostbyname (hostbuf))) + perror ("gethostbyname()"); + else + { + strncpy (hostbuf, hp->h_name, sizeof (hostbuf) - 1); + hostbuf[sizeof (hostbuf) - 1] = '\0'; + } + } +#endif + if ((result.peer = strdup (hostbuf)) == NULL) result.stat = YP_YPERR; else @@ -1046,7 +1065,7 @@ for (i = 0; i < val.dsize; i++) hostbuf[i] = val.dptr[i]; hostbuf[val.dsize] = '\0'; - free (val.dptr); + ypdb_free (val.dptr); if ((result.peer = strdup (hostbuf)) == NULL) result.stat = YP_YPERR; @@ -1133,7 +1152,7 @@ memcpy (buf, val.dptr, val.dsize); buf[val.dsize + 1] = '\0'; result.ordernum = atoi (buf); - free (val.dptr); + ypdb_free (val.dptr); } result.stat = YP_TRUE; diff -u -r --new-file ypserv-1.2.8/system.h ypserv-1.3.0/system.h --- ypserv-1.2.8/system.h Fri Jan 9 21:41:42 1998 +++ ypserv-1.3.0/system.h Fri Mar 6 21:01:11 1998 @@ -1,4 +1,4 @@ -/* $Id: system.h,v 1.11 1998/01/09 20:41:42 kukuk Exp $ */ +/* $Id: system.h,v 1.12 1998/03/06 20:01:11 kukuk Exp $ */ #ifndef __SYSTEM_H__ #define __SYSTEM_H__ @@ -99,7 +99,11 @@ #define _BSD_SOURCE #endif +#include + +#if !(defined (__GLIBC__) && __GLIBC__ >= 2) extern int snprintf (char *, unsigned int, const char *, ...); +#endif #endif /* linux */ diff -u -r --new-file ypserv-1.2.8/version.h ypserv-1.3.0/version.h --- ypserv-1.2.8/version.h Thu Jan 29 08:36:39 1998 +++ ypserv-1.3.0/version.h Fri Mar 6 21:05:10 1998 @@ -1,4 +1,4 @@ #ifndef __VERSION_H__ #define __VERSION_H__ -static char version[] = "1.2.8"; +static char version[] = "1.3.0"; #endif diff -u -r --new-file ypserv-1.2.8/yp.h ypserv-1.3.0/yp.h --- ypserv-1.2.8/yp.h Thu Jan 30 19:45:12 1997 +++ ypserv-1.3.0/yp.h Wed Feb 4 21:49:19 1998 @@ -31,11 +31,16 @@ #include #endif +#ifdef __cplusplus +extern "C" { +#endif + #define YPMAXRECORD 1024 #define YPMAXDOMAIN 64 #define YPMAXMAP 64 #define YPMAXPEER 64 + enum ypstat { YP_TRUE = 1, YP_NOMORE = 2, @@ -50,14 +55,6 @@ YP_VERS = -8 }; typedef enum ypstat ypstat; -#ifdef __cplusplus -extern "C" bool_t xdr_ypstat(XDR *, ypstat*); -#elif __STDC__ -extern bool_t xdr_ypstat(XDR *, ypstat*); -#else /* Old Style C */ -bool_t xdr_ypstat(); -#endif /* Old Style C */ - enum ypxfrstat { YPXFR_SUCC = 1, @@ -78,69 +75,22 @@ YPXFR_REFUSED = -14 }; typedef enum ypxfrstat ypxfrstat; -#ifdef __cplusplus -extern "C" bool_t xdr_ypxfrstat(XDR *, ypxfrstat*); -#elif __STDC__ -extern bool_t xdr_ypxfrstat(XDR *, ypxfrstat*); -#else /* Old Style C */ -bool_t xdr_ypxfrstat(); -#endif /* Old Style C */ typedef char *domainname; -#ifdef __cplusplus -extern "C" bool_t xdr_domainname(XDR *, domainname*); -#elif __STDC__ -extern bool_t xdr_domainname(XDR *, domainname*); -#else /* Old Style C */ -bool_t xdr_domainname(); -#endif /* Old Style C */ - - typedef char *mapname; -#ifdef __cplusplus -extern "C" bool_t xdr_mapname(XDR *, mapname*); -#elif __STDC__ -extern bool_t xdr_mapname(XDR *, mapname*); -#else /* Old Style C */ -bool_t xdr_mapname(); -#endif /* Old Style C */ - - typedef char *peername; -#ifdef __cplusplus -extern "C" bool_t xdr_peername(XDR *, peername*); -#elif __STDC__ -extern bool_t xdr_peername(XDR *, peername*); -#else /* Old Style C */ -bool_t xdr_peername(); -#endif /* Old Style C */ - typedef struct { u_int keydat_len; char *keydat_val; } keydat; -#ifdef __cplusplus -extern "C" bool_t xdr_keydat(XDR *, keydat*); -#elif __STDC__ -extern bool_t xdr_keydat(XDR *, keydat*); -#else /* Old Style C */ -bool_t xdr_keydat(); -#endif /* Old Style C */ typedef struct { u_int valdat_len; char *valdat_val; } valdat; -#ifdef __cplusplus -extern "C" bool_t xdr_valdat(XDR *, valdat*); -#elif __STDC__ -extern bool_t xdr_valdat(XDR *, valdat*); -#else /* Old Style C */ -bool_t xdr_valdat(); -#endif /* Old Style C */ struct ypmap_parms { @@ -150,13 +100,6 @@ peername peer; }; typedef struct ypmap_parms ypmap_parms; -#ifdef __cplusplus -extern "C" bool_t xdr_ypmap_parms(XDR *, ypmap_parms*); -#elif __STDC__ -extern bool_t xdr_ypmap_parms(XDR *, ypmap_parms*); -#else /* Old Style C */ -bool_t xdr_ypmap_parms(); -#endif /* Old Style C */ struct ypreq_key { @@ -165,13 +108,6 @@ keydat key; }; typedef struct ypreq_key ypreq_key; -#ifdef __cplusplus -extern "C" bool_t xdr_ypreq_key(XDR *, ypreq_key*); -#elif __STDC__ -extern bool_t xdr_ypreq_key(XDR *, ypreq_key*); -#else /* Old Style C */ -bool_t xdr_ypreq_key(); -#endif /* Old Style C */ struct ypreq_nokey { @@ -179,13 +115,6 @@ mapname map; }; typedef struct ypreq_nokey ypreq_nokey; -#ifdef __cplusplus -extern "C" bool_t xdr_ypreq_nokey(XDR *, ypreq_nokey*); -#elif __STDC__ -extern bool_t xdr_ypreq_nokey(XDR *, ypreq_nokey*); -#else /* Old Style C */ -bool_t xdr_ypreq_nokey(); -#endif /* Old Style C */ struct ypreq_xfr { @@ -195,13 +124,6 @@ u_int port; }; typedef struct ypreq_xfr ypreq_xfr; -#ifdef __cplusplus -extern "C" bool_t xdr_ypreq_xfr(XDR *, ypreq_xfr*); -#elif __STDC__ -extern bool_t xdr_ypreq_xfr(XDR *, ypreq_xfr*); -#else /* Old Style C */ -bool_t xdr_ypreq_xfr(); -#endif /* Old Style C */ struct ypresp_val { @@ -209,13 +131,6 @@ valdat val; }; typedef struct ypresp_val ypresp_val; -#ifdef __cplusplus -extern "C" bool_t xdr_ypresp_val(XDR *, ypresp_val*); -#elif __STDC__ -extern bool_t xdr_ypresp_val(XDR *, ypresp_val*); -#else /* Old Style C */ -bool_t xdr_ypresp_val(); -#endif /* Old Style C */ struct ypresp_key_val { @@ -224,13 +139,6 @@ valdat val; }; typedef struct ypresp_key_val ypresp_key_val; -#ifdef __cplusplus -extern "C" bool_t xdr_ypresp_key_val(XDR *, ypresp_key_val*); -#elif __STDC__ -extern bool_t xdr_ypresp_key_val(XDR *, ypresp_key_val*); -#else /* Old Style C */ -bool_t xdr_ypresp_key_val(); -#endif /* Old Style C */ struct ypresp_master { @@ -238,13 +146,6 @@ peername peer; }; typedef struct ypresp_master ypresp_master; -#ifdef __cplusplus -extern "C" bool_t xdr_ypresp_master(XDR *, ypresp_master*); -#elif __STDC__ -extern bool_t xdr_ypresp_master(XDR *, ypresp_master*); -#else /* Old Style C */ -bool_t xdr_ypresp_master(); -#endif /* Old Style C */ struct ypresp_order { @@ -252,13 +153,6 @@ u_int ordernum; }; typedef struct ypresp_order ypresp_order; -#ifdef __cplusplus -extern "C" bool_t xdr_ypresp_order(XDR *, ypresp_order*); -#elif __STDC__ -extern bool_t xdr_ypresp_order(XDR *, ypresp_order*); -#else /* Old Style C */ -bool_t xdr_ypresp_order(); -#endif /* Old Style C */ typedef struct @@ -279,13 +173,6 @@ } ypresp_all_u; }; typedef struct ypresp_all ypresp_all; -#ifdef __cplusplus -extern "C" bool_t xdr_ypresp_all(XDR *, ypresp_all*); -#elif __STDC__ -extern bool_t xdr_ypresp_all(XDR *, ypresp_all*); -#else /* Old Style C */ -bool_t xdr_ypresp_all(); -#endif /* Old Style C */ struct ypresp_xfr { @@ -293,13 +180,6 @@ ypxfrstat xfrstat; }; typedef struct ypresp_xfr ypresp_xfr; -#ifdef __cplusplus -extern "C" bool_t xdr_ypresp_xfr(XDR *, ypresp_xfr*); -#elif __STDC__ -extern bool_t xdr_ypresp_xfr(XDR *, ypresp_xfr*); -#else /* Old Style C */ -bool_t xdr_ypresp_xfr(); -#endif /* Old Style C */ struct ypmaplist { @@ -307,13 +187,6 @@ struct ypmaplist *next; }; typedef struct ypmaplist ypmaplist; -#ifdef __cplusplus -extern "C" bool_t xdr_ypmaplist(XDR *, ypmaplist*); -#elif __STDC__ -extern bool_t xdr_ypmaplist(XDR *, ypmaplist*); -#else /* Old Style C */ -bool_t xdr_ypmaplist(); -#endif /* Old Style C */ struct ypresp_maplist { @@ -321,13 +194,6 @@ ypmaplist *maps; }; typedef struct ypresp_maplist ypresp_maplist; -#ifdef __cplusplus -extern "C" bool_t xdr_ypresp_maplist(XDR *, ypresp_maplist*); -#elif __STDC__ -extern bool_t xdr_ypresp_maplist(XDR *, ypresp_maplist*); -#else /* Old Style C */ -bool_t xdr_ypresp_maplist(); -#endif /* Old Style C */ enum yppush_status { @@ -349,13 +215,6 @@ YPPUSH_REFUSED = -14 }; typedef enum yppush_status yppush_status; -#ifdef __cplusplus -extern "C" bool_t xdr_yppush_status(XDR *, yppush_status*); -#elif __STDC__ -extern bool_t xdr_yppush_status(XDR *, yppush_status*); -#else /* Old Style C */ -bool_t xdr_yppush_status(); -#endif /* Old Style C */ struct yppushresp_xfr { @@ -363,13 +222,6 @@ yppush_status status; }; typedef struct yppushresp_xfr yppushresp_xfr; -#ifdef __cplusplus -extern "C" bool_t xdr_yppushresp_xfr(XDR *, yppushresp_xfr*); -#elif __STDC__ -extern bool_t xdr_yppushresp_xfr(XDR *, yppushresp_xfr*); -#else /* Old Style C */ -bool_t xdr_yppushresp_xfr(); -#endif /* Old Style C */ enum ypbind_resptype { @@ -377,13 +229,6 @@ YPBIND_FAIL_VAL = 2 }; typedef enum ypbind_resptype ypbind_resptype; -#ifdef __cplusplus -extern "C" bool_t xdr_ypbind_resptype(XDR *, ypbind_resptype*); -#elif __STDC__ -extern bool_t xdr_ypbind_resptype(XDR *, ypbind_resptype*); -#else /* Old Style C */ -bool_t xdr_ypbind_resptype(); -#endif /* Old Style C */ struct ypbind_binding { @@ -391,13 +236,6 @@ char ypbind_binding_port[2]; }; typedef struct ypbind_binding ypbind_binding; -#ifdef __cplusplus -extern "C" bool_t xdr_ypbind_binding(XDR *, ypbind_binding*); -#elif __STDC__ -extern bool_t xdr_ypbind_binding(XDR *, ypbind_binding*); -#else /* Old Style C */ -bool_t xdr_ypbind_binding(); -#endif /* Old Style C */ struct ypbind_resp { @@ -408,13 +246,7 @@ } ypbind_resp_u; }; typedef struct ypbind_resp ypbind_resp; -#ifdef __cplusplus -extern "C" bool_t xdr_ypbind_resp(XDR *, ypbind_resp*); -#elif __STDC__ -extern bool_t xdr_ypbind_resp(XDR *, ypbind_resp*); -#else /* Old Style C */ -bool_t xdr_ypbind_resp(); -#endif /* Old Style C */ + #define YPBIND_ERR_ERR 1 #define YPBIND_ERR_NOSERV 2 @@ -426,57 +258,115 @@ u_int ypsetdom_vers; }; typedef struct ypbind_setdom ypbind_setdom; -#ifdef __cplusplus -extern "C" bool_t xdr_ypbind_setdom(XDR *, ypbind_setdom*); -#elif __STDC__ -extern bool_t xdr_ypbind_setdom(XDR *, ypbind_setdom*); -#else /* Old Style C */ -bool_t xdr_ypbind_setdom(); -#endif /* Old Style C */ + +enum ypreqtype { + YPREQ_KEY = 1, + YPREQ_NOKEY = 2, + YPREQ_MAP_PARMS = 3, +}; +typedef enum ypreqtype ypreqtype; + +enum ypresptype { + YPRESP_VAL = 1, + YPRESP_KEY_VAL = 2, + YPRESP_MAP_PARMS = 3, +}; +typedef enum ypresptype ypresptype; + +struct yprequest { + ypreqtype yp_reqtype; + union { + ypreq_key yp_req_keytype; + ypreq_nokey yp_req_nokeytype; + ypmap_parms yp_req_map_parmstype; + } yprequest_u; +}; +typedef struct yprequest yprequest; + +struct ypresponse { + ypresptype yp_resptype; + union { + ypresp_val yp_resp_valtype; + ypresp_key_val yp_resp_key_valtype; + ypmap_parms yp_resp_map_parmstype; + } ypresponse_u; +}; +typedef struct ypresponse ypresponse; #define YPPROG ((u_long)100004) +#define YPOLDVERS ((u_long)1) #define YPVERS ((u_long)2) -#ifdef __cplusplus -#define YPPROC_NULL ((u_long)0) -extern "C" void * ypproc_null_2(void *, CLIENT *); -extern "C" void * ypproc_null_2_svc(void *, struct svc_req *); -#define YPPROC_DOMAIN ((u_long)1) -extern "C" bool_t * ypproc_domain_2(domainname *, CLIENT *); -extern "C" bool_t * ypproc_domain_2_svc(domainname *, struct svc_req *); -#define YPPROC_DOMAIN_NONACK ((u_long)2) -extern "C" bool_t * ypproc_domain_nonack_2(domainname *, CLIENT *); -extern "C" bool_t * ypproc_domain_nonack_2_svc(domainname *, struct svc_req *); -#define YPPROC_MATCH ((u_long)3) -extern "C" ypresp_val * ypproc_match_2(ypreq_key *, CLIENT *); -extern "C" ypresp_val * ypproc_match_2_svc(ypreq_key *, struct svc_req *); -#define YPPROC_FIRST ((u_long)4) -extern "C" ypresp_key_val * ypproc_first_2(ypreq_nokey *, CLIENT *); -extern "C" ypresp_key_val * ypproc_first_2_svc(ypreq_nokey *, struct svc_req *); -#define YPPROC_NEXT ((u_long)5) -extern "C" ypresp_key_val * ypproc_next_2(ypreq_key *, CLIENT *); -extern "C" ypresp_key_val * ypproc_next_2_svc(ypreq_key *, struct svc_req *); -#define YPPROC_XFR ((u_long)6) -extern "C" ypresp_xfr * ypproc_xfr_2(ypreq_xfr *, CLIENT *); -extern "C" ypresp_xfr * ypproc_xfr_2_svc(ypreq_xfr *, struct svc_req *); -#define YPPROC_CLEAR ((u_long)7) -extern "C" void * ypproc_clear_2(void *, CLIENT *); -extern "C" void * ypproc_clear_2_svc(void *, struct svc_req *); -#define YPPROC_ALL ((u_long)8) -extern "C" ypresp_all * ypproc_all_2(ypreq_nokey *, CLIENT *); -extern "C" ypresp_all * ypproc_all_2_svc(ypreq_nokey *, struct svc_req *); -#define YPPROC_MASTER ((u_long)9) -extern "C" ypresp_master * ypproc_master_2(ypreq_nokey *, CLIENT *); -extern "C" ypresp_master * ypproc_master_2_svc(ypreq_nokey *, struct svc_req *); -#define YPPROC_ORDER ((u_long)10) -extern "C" ypresp_order * ypproc_order_2(ypreq_nokey *, CLIENT *); -extern "C" ypresp_order * ypproc_order_2_svc(ypreq_nokey *, struct svc_req *); -#define YPPROC_MAPLIST ((u_long)11) -extern "C" ypresp_maplist * ypproc_maplist_2(domainname *, CLIENT *); -extern "C" ypresp_maplist * ypproc_maplist_2_svc(domainname *, struct svc_req *); -#elif __STDC__ +#if defined(__STDC__) || defined(__cplusplus) +#define YPOLDPROC_NULL ((unsigned long)0) +extern void * ypoldproc_null_1(void *, CLIENT *); +extern void * ypoldproc_null_1_svc(void *, struct svc_req *); +#define YPOLDPROC_DOMAIN ((unsigned long)1) +extern bool_t * ypoldproc_domain_1(domainname *, CLIENT *); +extern bool_t * ypoldproc_domain_1_svc(domainname *, struct svc_req *); +#define YPOLDPROC_DOMAIN_NONACK ((unsigned long)2) +extern bool_t * ypoldproc_domain_nonack_1(domainname *, CLIENT *); +extern bool_t * ypoldproc_domain_nonack_1_svc(domainname *, struct svc_req *); +#define YPOLDPROC_MATCH ((unsigned long)3) +extern ypresponse * ypoldproc_match_1(yprequest *, CLIENT *); +extern ypresponse * ypoldproc_match_1_svc(yprequest *, struct svc_req *); +#define YPOLDPROC_FIRST ((unsigned long)4) +extern ypresponse * ypoldproc_first_1(yprequest *, CLIENT *); +extern ypresponse * ypoldproc_first_1_svc(yprequest *, struct svc_req *); +#define YPOLDPROC_NEXT ((unsigned long)5) +extern ypresponse * ypoldproc_next_1(yprequest *, CLIENT *); +extern ypresponse * ypoldproc_next_1_svc(yprequest *, struct svc_req *); +#define YPOLDPROC_POLL ((unsigned long)6) +extern ypresponse * ypoldproc_poll_1(yprequest *, CLIENT *); +extern ypresponse * ypoldproc_poll_1_svc(yprequest *, struct svc_req *); +#define YPOLDPROC_PUSH ((unsigned long)7) +extern ypresponse * ypoldproc_push_1(yprequest *, CLIENT *); +extern ypresponse * ypoldproc_push_1_svc(yprequest *, struct svc_req *); +#define YPOLDPROC_PULL ((unsigned long)8) +extern ypresponse * ypoldproc_pull_1(yprequest *, CLIENT *); +extern ypresponse * ypoldproc_pull_1_svc(yprequest *, struct svc_req *); +#define YPOLDPROC_GET ((unsigned long)9) +extern ypresponse * ypoldproc_get_1(yprequest *, CLIENT *); +extern ypresponse * ypoldproc_get_1_svc(yprequest *, struct svc_req *); +extern int ypprog_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* K&R C */ +#define YPOLDPROC_NULL ((unsigned long)0) +extern void * ypoldproc_null_1(); +extern void * ypoldproc_null_1_svc(); +#define YPOLDPROC_DOMAIN ((unsigned long)1) +extern bool_t * ypoldproc_domain_1(); +extern bool_t * ypoldproc_domain_1_svc(); +#define YPOLDPROC_DOMAIN_NONACK ((unsigned long)2) +extern bool_t * ypoldproc_domain_nonack_1(); +extern bool_t * ypoldproc_domain_nonack_1_svc(); +#define YPOLDPROC_MATCH ((unsigned long)3) +extern ypresponse * ypoldproc_match_1(); +extern ypresponse * ypoldproc_match_1_svc(); +#define YPOLDPROC_FIRST ((unsigned long)4) +extern ypresponse * ypoldproc_first_1(); +extern ypresponse * ypoldproc_first_1_svc(); +#define YPOLDPROC_NEXT ((unsigned long)5) +extern ypresponse * ypoldproc_next_1(); +extern ypresponse * ypoldproc_next_1_svc(); +#define YPOLDPROC_POLL ((unsigned long)6) +extern ypresponse * ypoldproc_poll_1(); +extern ypresponse * ypoldproc_poll_1_svc(); +#define YPOLDPROC_PUSH ((unsigned long)7) +extern ypresponse * ypoldproc_push_1(); +extern ypresponse * ypoldproc_push_1_svc(); +#define YPOLDPROC_PULL ((unsigned long)8) +extern ypresponse * ypoldproc_pull_1(); +extern ypresponse * ypoldproc_pull_1_svc(); +#define YPOLDPROC_GET ((unsigned long)9) +extern ypresponse * ypoldproc_get_1(); +extern ypresponse * ypoldproc_get_1_svc(); +extern int ypprog_1_freeresult (); +#endif /* K&R C */ + +#if defined(__STDC__) || defined(__cplusplus) #define YPPROC_NULL ((u_long)0) extern void * ypproc_null_2(void *, CLIENT *); extern void * ypproc_null_2_svc(void *, struct svc_req *); @@ -514,7 +404,7 @@ extern ypresp_maplist * ypproc_maplist_2(domainname *, CLIENT *); extern ypresp_maplist * ypproc_maplist_2_svc(domainname *, struct svc_req *); -#else /* Old Style C */ +#else /* Old Style C */ #define YPPROC_NULL ((u_long)0) extern void * ypproc_null_2(); extern void * ypproc_null_2_svc(); @@ -551,7 +441,7 @@ #define YPPROC_MAPLIST ((u_long)11) extern ypresp_maplist * ypproc_maplist_2(); extern ypresp_maplist * ypproc_maplist_2_svc(); -#endif /* Old Style C */ +#endif /* Old Style C */ #define YPPUSH_XFRRESPPROG ((u_long)0x40000000) #define YPPUSH_XFRRESPVERS ((u_long)1) @@ -572,30 +462,20 @@ extern yppushresp_xfr * yppushproc_xfrresp_1(void *, CLIENT *); extern yppushresp_xfr * yppushproc_xfrresp_1_svc(void *, struct svc_req *); -#else /* Old Style C */ +#else /* Old Style C */ #define YPPUSHPROC_NULL ((u_long)0) extern void * yppushproc_null_1(); extern void * yppushproc_null_1_svc(); #define YPPUSHPROC_XFRRESP ((u_long)1) extern yppushresp_xfr * yppushproc_xfrresp_1(); extern yppushresp_xfr * yppushproc_xfrresp_1_svc(); -#endif /* Old Style C */ +#endif /* Old Style C */ #define YPBINDPROG ((u_long)100007) #define YPBINDVERS ((u_long)2) -#ifdef __cplusplus -#define YPBINDPROC_NULL ((u_long)0) -extern "C" void * ypbindproc_null_2(void *, CLIENT *); -extern "C" void * ypbindproc_null_2_svc(void *, struct svc_req *); -#define YPBINDPROC_DOMAIN ((u_long)1) -extern "C" ypbind_resp * ypbindproc_domain_2(domainname *, CLIENT *); -extern "C" ypbind_resp * ypbindproc_domain_2_svc(domainname *, struct svc_req *); -#define YPBINDPROC_SETDOM ((u_long)2) -extern "C" void * ypbindproc_setdom_2(ypbind_setdom *, CLIENT *); -extern "C" void * ypbindproc_setdom_2_svc(ypbind_setdom *, struct svc_req *); -#elif __STDC__ +#if defined(__STDC__) || defined(__cplusplus) #define YPBINDPROC_NULL ((u_long)0) extern void * ypbindproc_null_2(void *, CLIENT *); extern void * ypbindproc_null_2_svc(void *, struct svc_req *); @@ -606,7 +486,7 @@ extern void * ypbindproc_setdom_2(ypbind_setdom *, CLIENT *); extern void * ypbindproc_setdom_2_svc(ypbind_setdom *, struct svc_req *); -#else /* Old Style C */ +#else /* Old Style C */ #define YPBINDPROC_NULL ((u_long)0) extern void * ypbindproc_null_2(); extern void * ypbindproc_null_2_svc(); @@ -616,6 +496,75 @@ #define YPBINDPROC_SETDOM ((u_long)2) extern void * ypbindproc_setdom_2(); extern void * ypbindproc_setdom_2_svc(); -#endif /* Old Style C */ +#endif /* Old Style C */ + +/* the xdr functions */ + +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t xdr_ypstat (XDR *, ypstat*); +extern bool_t xdr_ypxfrstat (XDR *, ypxfrstat*); +extern bool_t xdr_domainname (XDR *, domainname*); +extern bool_t xdr_mapname (XDR *, mapname*); +extern bool_t xdr_peername (XDR *, peername*); +extern bool_t xdr_keydat (XDR *, keydat*); +extern bool_t xdr_valdat (XDR *, valdat*); +extern bool_t xdr_ypmap_parms (XDR *, ypmap_parms*); +extern bool_t xdr_ypreq_key (XDR *, ypreq_key*); +extern bool_t xdr_ypreq_nokey (XDR *, ypreq_nokey*); +extern bool_t xdr_ypreq_xfr (XDR *, ypreq_xfr*); +extern bool_t xdr_ypresp_val (XDR *, ypresp_val*); +extern bool_t xdr_ypresp_key_val (XDR *, ypresp_key_val*); +extern bool_t xdr_ypresp_master (XDR *, ypresp_master*); +extern bool_t xdr_ypresp_order (XDR *, ypresp_order*); +extern bool_t xdr_ypresp_all (XDR *, ypresp_all*); +extern bool_t xdr_ypresp_xfr (XDR *, ypresp_xfr*); +extern bool_t xdr_ypmaplist (XDR *, ypmaplist*); +extern bool_t xdr_ypresp_maplist (XDR *, ypresp_maplist*); +extern bool_t xdr_yppush_status (XDR *, yppush_status*); +extern bool_t xdr_yppushresp_xfr (XDR *, yppushresp_xfr*); +extern bool_t xdr_ypbind_resptype (XDR *, ypbind_resptype*); +extern bool_t xdr_ypbind_binding (XDR *, ypbind_binding*); +extern bool_t xdr_ypbind_resp (XDR *, ypbind_resp*); +extern bool_t xdr_ypbind_setdom (XDR *, ypbind_setdom*); +extern bool_t xdr_ypreqtype (XDR *, ypreqtype*); +extern bool_t xdr_ypresptype (XDR *, ypresptype*); +extern bool_t xdr_yprequest (XDR *, yprequest*); +extern bool_t xdr_ypresponse (XDR *, ypresponse*); + +#else /* K&R C */ +extern bool_t xdr_ypstat (); +extern bool_t xdr_ypxfrstat (); +extern bool_t xdr_domainname (); +extern bool_t xdr_mapname (); +extern bool_t xdr_peername (); +extern bool_t xdr_keydat (); +extern bool_t xdr_valdat (); +extern bool_t xdr_ypmap_parms (); +extern bool_t xdr_ypreq_key (); +extern bool_t xdr_ypreq_nokey (); +extern bool_t xdr_ypreq_xfr (); +extern bool_t xdr_ypresp_val (); +extern bool_t xdr_ypresp_key_val (); +extern bool_t xdr_ypresp_master (); +extern bool_t xdr_ypresp_order (); +extern bool_t xdr_ypresp_all (); +extern bool_t xdr_ypresp_xfr (); +extern bool_t xdr_ypmaplist (); +extern bool_t xdr_ypresp_maplist (); +extern bool_t xdr_yppush_status (); +extern bool_t xdr_yppushresp_xfr (); +extern bool_t xdr_ypbind_resptype (); +extern bool_t xdr_ypbind_binding (); +extern bool_t xdr_ypbind_resp (); +extern bool_t xdr_ypbind_setdom (); +extern bool_t xdr_ypreqtype (); +extern bool_t xdr_ypresptype (); +extern bool_t xdr_yprequest (); +extern bool_t xdr_ypresponse (); +#endif /* K&R C */ + +#ifdef __cplusplus +} +#endif #endif /* !_YP_H_RPCGEN */ diff -u -r --new-file ypserv-1.2.8/ypMakefile.in ypserv-1.3.0/ypMakefile.in --- ypserv-1.2.8/ypMakefile.in Thu Jan 29 08:37:30 1998 +++ ypserv-1.3.0/ypMakefile.in Wed Feb 4 20:45:12 1998 @@ -1,7 +1,7 @@ # # Makefile for the NIS databases # -# $Id: ypMakefile.in,v 1.15 1998/01/25 07:31:47 kukuk Exp $ +# $Id: ypMakefile.in,v 1.16 1998/02/04 19:45:12 kukuk Exp $ # # This Makefile should only be run on the NIS master server of a domain. # All updated maps will be pushed to all NIS slave servers listed in the diff -u -r --new-file ypserv-1.2.8/yp_db.c ypserv-1.3.0/yp_db.c --- ypserv-1.2.8/yp_db.c Tue Dec 30 16:22:57 1997 +++ ypserv-1.3.0/yp_db.c Sat Mar 7 13:14:06 1998 @@ -22,7 +22,7 @@ */ #ifndef LINUT -static const char rcsid[] = "$Id: yp_db.c,v 1.11 1997/12/30 15:22:57 kukuk Exp $"; +static const char rcsid[] = "$Id: yp_db.c,v 1.17 1998/03/07 12:07:42 kukuk Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -31,6 +31,8 @@ #include "system.h" +#include +#include #include #include #include @@ -43,6 +45,8 @@ #if defined(HAVE_LIBGDBM) #include +#elif defined(HAVE_NDBM) +#include #endif /* repleace "field" with x, if field 3 != user id and user id != 0 */ @@ -217,6 +221,159 @@ /* Free old key, unless it comes from the caller! */ if (ikey == NULL || ckey.dptr != ikey->dptr) free (ckey.dptr); + + if (ckey.dptr == NULL || nkey.dptr == NULL) + return YP_NOMORE; + + ckey = nkey; + } +} + + +#elif defined(HAVE_NDBM) + +/***************************************************** + The following stuff is for NDBM suport ! +******************************************************/ + +/* Open a NDBM database */ +static DB_FILE +_db_open (const char *domain, const char *map) +{ + DB_FILE dbp; + char buf[MAXPATHLEN + 2]; + + if (debug_flag) + yp_msg ("\tdb_open(\"%s\", \"%s\")\n", domain, map); + + if (map[0] == '.' || strchr (map, '/')) + { + if (debug_flag) + yp_msg ("\t\t->Returning 0\n"); + return 0; + } + + if (strlen (domain) + strlen (map) < MAXPATHLEN) + { + sprintf (buf, "%s/%s", domain, map); + + dbp = dbm_open (buf, O_RDONLY, 0600); + + if (debug_flag && dbp == NULL) + yp_msg ("dbm_open: NDBM Error Code #%d\n", errno); + else if (debug_flag) + yp_msg ("\t\t->Returning OK!\n"); + } + else + { + dbp = NULL; + yp_msg ("Path to long: %s/%s\n", domain, map); + } + + return dbp; +} + +static inline int +_db_close (DB_FILE file) +{ + dbm_close (file); + return 0; +} + +int +ypdb_exists (DB_FILE dbp, datum key) +{ + datum tmp = dbm_fetch (dbp, key); + + if (tmp.dptr != NULL) + return 1; + else + return 0; +} + +/* Get a record from a GDBM database. */ +int +ypdb_read (DB_FILE dbp, const datum *ikey, datum *okey, + datum *dval, int flags, int mangle) +{ + int first_flag = 0; + datum nkey, ckey; + + if (ikey == NULL || ikey->dptr == NULL) + { + if (debug_flag) + yp_msg ("\tread_database(), dbm_firstkey()\n"); + + ckey = dbm_firstkey (dbp); + first_flag = 1; + } + else + { + if (debug_flag) + yp_msg ("\tread_database(), dbm_nextkey()\n"); + + ckey = dbm_firstkey (dbp); + while (ckey.dptr) + { + if (((ikey->dsize == ckey.dsize) && + strncmp (ikey->dptr, ckey.dptr, ikey->dsize) == 0)) + break; + ckey = dbm_nextkey (dbp); + } + + if ((flags & F_NEXT)) + ckey = dbm_nextkey (dbp); + else + ckey = *ikey; + } + + if (ckey.dptr == NULL) + { + return (flags & F_NEXT) ? YP_NOMORE : YP_NOKEY; + } + + while (1) + { + *dval = dbm_fetch (dbp, ckey); + if (dval->dptr == NULL) + { + /* Free key, unless it comes from the caller! */ + if (ikey == NULL || ckey.dptr != ikey->dptr) + ypdb_free (ckey.dptr); + + if (ikey && ikey->dptr != NULL) + { + return YP_NOKEY; + } + else if (first_flag) + return YP_BADDB; + else + return YP_FALSE; + } + + if ((flags & F_ALL) || strncmp (ckey.dptr, "YP_", 3) != 0) + { + if (okey) + *okey = ckey; + else if (ikey == NULL || ikey->dptr != ckey.dptr) + ypdb_free (ckey.dptr); + + if (mangle) + if (mangle_field (dval, mangle) < 0) + return YP_YPERR; + + return YP_TRUE; + } + + /* Free old value */ + ypdb_free (dval->dptr); + + /* XXX Check this */ + nkey = dbm_nextkey (dbp); + + /* Free old key, unless it comes from the caller! */ + if (ikey == NULL || ckey.dptr != ikey->dptr) + ypdb_free (ckey.dptr); if (ckey.dptr == NULL || nkey.dptr == NULL) return YP_NOMORE; diff -u -r --new-file ypserv-1.2.8/yp_db.h ypserv-1.3.0/yp_db.h --- ypserv-1.2.8/yp_db.h Fri May 2 18:34:16 1997 +++ ypserv-1.3.0/yp_db.h Fri Mar 6 21:01:11 1998 @@ -1,7 +1,7 @@ #ifndef __YP_DB_H__ #define __YP_DB_H__ -/* $Id: yp_db.h,v 1.5 1997/05/02 16:34:16 kukuk Exp $ */ +/* $Id: yp_db.h,v 1.8 1998/03/06 20:01:11 kukuk Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -16,6 +16,17 @@ #define DB_FILE GDBM_FILE #define ypdb_fetch(a,b) gdbm_fetch(a,b) #define ypdb_exists(a,b) gdbm_exists(a,b) +#define ypdb_free(a) free(a) + +#elif defined(HAVE_NDBM) + +#include + +#define DB_FILE DBM* +#define ypdb_fetch(a,b) dbm_fetch(a,b) +#define ypdb_free(a) + +extern int ypdb_exists (DB_FILE file, datum key); #else diff -u -r --new-file ypserv-1.2.8/ypinit.in ypserv-1.3.0/ypinit.in --- ypserv-1.2.8/ypinit.in Wed Jan 28 18:12:45 1998 +++ ypserv-1.3.0/ypinit.in Wed Feb 4 20:45:12 1998 @@ -2,7 +2,7 @@ # # ypinit - set up the YP directory on a master server or a slave server. # -# $Id: ypinit.in,v 1.1.1.1 1996/08/11 17:35:13 kukuk Exp $ +# $Id: ypinit.in,v 1.2 1998/02/04 19:45:12 kukuk Exp $ # ### some variables diff -u -r --new-file ypserv-1.2.8/ypmake/.version.orig ypserv-1.3.0/ypmake/.version.orig --- ypserv-1.2.8/ypmake/.version.orig Mon Aug 12 18:19:55 1996 +++ ypserv-1.3.0/ypmake/.version.orig Thu Jan 1 01:00:00 1970 @@ -1 +0,0 @@ -0.7 diff -u -r --new-file ypserv-1.2.8/yppasswd.c ypserv-1.3.0/yppasswd.c --- ypserv-1.2.8/yppasswd.c Fri Jan 9 21:41:42 1998 +++ ypserv-1.3.0/yppasswd.c Wed Feb 4 20:45:13 1998 @@ -30,7 +30,7 @@ */ #ifndef LINT -static const char rcsid[] = "$Id: yppasswd.c,v 1.11 1998/01/09 20:41:42 kukuk Exp $"; +static const char rcsid[] = "$Id: yppasswd.c,v 1.12 1998/02/04 19:45:13 kukuk Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -385,14 +385,15 @@ map = "passwd.byname"; } /* Fill in values. */ - resp.valdat.valdat_val = malloc (1024); + memset (&resp, '\0', sizeof (resp)); key.domain = domainname; key.map = map; key.keydat.keydat_val = keyval; key.keydat.keydat_len = strlen (keyval); - re = clnt_call (clnt, YPPROC_MATCH, (xdrproc_t) xdr_ypreq_key, (caddr_t) & key, - (xdrproc_t) xdr_ypresp_val, (caddr_t) & resp, TIMEOUT); + re = clnt_call (clnt, YPPROC_MATCH, (xdrproc_t) xdr_ypreq_key, + (caddr_t) &key, (xdrproc_t) xdr_ypresp_val, (caddr_t) &resp, + TIMEOUT); if (re != RPC_SUCCESS) { @@ -400,6 +401,7 @@ fprintf (stderr, "\n"); return NULL; } + if (resp.status != 1) { fprintf (stderr, "%s\n", yp_strerror (resp.status)); diff -u -r --new-file ypserv-1.2.8/yppush.c ypserv-1.3.0/yppush.c --- ypserv-1.2.8/yppush.c Fri Jan 9 21:41:43 1998 +++ ypserv-1.3.0/yppush.c Fri Mar 6 21:01:11 1998 @@ -22,7 +22,7 @@ */ #ifndef LINT -static const char rcsid[] = "$Id: yppush.c,v 1.12 1998/01/09 20:41:43 kukuk Exp $"; +static const char rcsid[] = "$Id: yppush.c,v 1.14 1998/03/06 20:01:11 kukuk Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -47,9 +47,14 @@ #include #include #include -#include #include #include +#if defined(HAVE_LIBGDBM) +#include +#elif defined(HAVE_NDBM) +#include +#include +#endif #if defined(HAVE_GETOPT_H) && defined(HAVE_GETOPT_LONG) #include #else @@ -85,164 +90,190 @@ struct hostlist *hostliste = NULL; -static char *DomainName=NULL; -int verbose_flag=0; -int debug_flag=1; -static char local_hostname[MAXHOSTNAMELEN+2]; +static char *DomainName = NULL; +int verbose_flag = 0; +int debug_flag = 1; +static char local_hostname[MAXHOSTNAMELEN + 2]; static char *current_map; -static u_int CallbackProg=0; -static u_int timeout=90; +static u_int CallbackProg = 0; +static u_int timeout = 90; static u_int MapOrderNum; static u_int maxchildren = 1; static u_int children = 0; #if HAVE__RPC_DTABLESIZE -extern int _rpc_dtablesize(void); +extern int _rpc_dtablesize (void); #elif HAVE_GETDTABLESIZE -int _rpc_dtablesize() + +int +_rpc_dtablesize () { - static int size; + static int size; - if (size == 0) { - size = getdtablesize(); - } - return (size); + if (size == 0) + { + size = getdtablesize (); + } + return (size); } #else #include -int _rpc_dtablesize() +int +_rpc_dtablesize () { - static int size = 0; - struct rlimit rlb; + static int size = 0; + struct rlimit rlb; - if (size == 0) + if (size == 0) { - if (getrlimit(RLIMIT_NOFILE, &rlb) >= 0) - size = rlb.rlim_cur; - } - - return size; + if (getrlimit (RLIMIT_NOFILE, &rlb) >= 0) + size = rlb.rlim_cur; + } + + return size; } #endif -static char *yppush_err_string(enum yppush_status status) -{ - switch(status) - { - case YPPUSH_SUCC: return "Success"; - case YPPUSH_AGE: return "Master's version not newer"; - case YPPUSH_NOMAP: return "Can't find server for map"; - case YPPUSH_NODOM: return "Domain not supported"; - case YPPUSH_RSRC: return "Local resource alloc failure"; - case YPPUSH_RPC: return "RPC failure talking to server"; - case YPPUSH_MADDR: return "Can't get master address"; - case YPPUSH_YPERR: return "YP server/map db error"; - case YPPUSH_BADARGS: return "Request arguments bad"; - case YPPUSH_DBM: return "Local dbm operation failed"; - case YPPUSH_FILE: return "Local file I/O operation failed"; - case YPPUSH_SKEW: return "Map version skew during transfer"; - case YPPUSH_CLEAR: return "Can't send \"Clear\" req to local ypserv"; - case YPPUSH_FORCE: return "No local order number in map use -f flag."; - case YPPUSH_XFRERR: return "ypxfr error"; - case YPPUSH_REFUSED: return "Transfer request refused by ypserv"; +static char * +yppush_err_string (enum yppush_status status) +{ + switch (status) + { + case YPPUSH_SUCC: + return "Success"; + case YPPUSH_AGE: + return "Master's version not newer"; + case YPPUSH_NOMAP: + return "Can't find server for map"; + case YPPUSH_NODOM: + return "Domain not supported"; + case YPPUSH_RSRC: + return "Local resource alloc failure"; + case YPPUSH_RPC: + return "RPC failure talking to server"; + case YPPUSH_MADDR: + return "Can't get master address"; + case YPPUSH_YPERR: + return "YP server/map db error"; + case YPPUSH_BADARGS: + return "Request arguments bad"; + case YPPUSH_DBM: + return "Local dbm operation failed"; + case YPPUSH_FILE: + return "Local file I/O operation failed"; + case YPPUSH_SKEW: + return "Map version skew during transfer"; + case YPPUSH_CLEAR: + return "Can't send \"Clear\" req to local ypserv"; + case YPPUSH_FORCE: + return "No local order number in map use -f flag."; + case YPPUSH_XFRERR: + return "ypxfr error"; + case YPPUSH_REFUSED: + return "Transfer request refused by ypserv"; } return "YPPUSH: Unknown Error, this should not happen!"; } -void *yppushproc_null_1_svc(void *req, struct svc_req * rqstp) +void * +yppushproc_null_1_svc (void *req, struct svc_req *rqstp) { static void *resp = NULL; - if(verbose_flag > 1) - yp_msg("yppushproc_null_1_svc\n"); + if (verbose_flag > 1) + yp_msg ("yppushproc_null_1_svc\n"); return &resp; } -yppushresp_xfr *yppushproc_xfrresp_1_svc(void *req, struct svc_req * rqstp) +yppushresp_xfr * +yppushproc_xfrresp_1_svc (void *req, struct svc_req * rqstp) { static yppushresp_xfr resp; struct sockaddr_in *sin; char *h; struct hostent *hp; - if(verbose_flag > 1) - yp_msg("yppushproc_xfrresp_1_svc\n"); + if (verbose_flag > 1) + yp_msg ("yppushproc_xfrresp_1_svc\n"); - sin = svc_getcaller(rqstp->rq_xprt); + sin = svc_getcaller (rqstp->rq_xprt); - hp = gethostbyaddr((char *) &sin->sin_addr.s_addr, - sizeof (sin->sin_addr.s_addr), AF_INET); - h = (hp && hp->h_name) ? hp->h_name : inet_ntoa(sin->sin_addr); + hp = gethostbyaddr ((char *) &sin->sin_addr.s_addr, + sizeof (sin->sin_addr.s_addr), AF_INET); + h = (hp && hp->h_name) ? hp->h_name : inet_ntoa (sin->sin_addr); - memcpy(&resp, (yppushresp_xfr*)req, sizeof(yppushresp_xfr)); - if(verbose_flag) + memcpy (&resp, (yppushresp_xfr *) req, sizeof (yppushresp_xfr)); + if (verbose_flag) { - yp_msg("Status received from ypxfr on %s:\n",h); - yp_msg("\tTransfer %sdone: %s\n",resp.status==YPPUSH_SUCC?"":"not ", - yppush_err_string(resp.status)); + yp_msg ("Status received from ypxfr on %s:\n", h); + yp_msg ("\tTransfer %sdone: %s\n", resp.status == YPPUSH_SUCC ? "" : "not ", + yppush_err_string (resp.status)); } - else - if (resp.status!=YPPUSH_SUCC) - yp_msg("%s: %s\n", h, yppush_err_string(resp.status)); + else if (resp.status != YPPUSH_SUCC) + yp_msg ("%s: %s\n", h, yppush_err_string (resp.status)); return &resp; } -void yppush_xfrrespprog_1( struct svc_req *rqstp, SVCXPRT *transp) +void +yppush_xfrrespprog_1 (struct svc_req *rqstp, SVCXPRT * transp) { - union { + union + { int fill; - } argument; + } + argument; static char *result; - static bool_t (*xdr_argument)(XDR *, void *), (*xdr_result)(XDR *, void *); - static char *(*local)( void *, struct svc_req *); + static bool_t (*xdr_argument) (XDR *, void *), (*xdr_result) (XDR *, void *); + static char *(*local) (void *, struct svc_req *); - if(verbose_flag > 1) - yp_msg("yppush_xfrrespprog_1\n"); + if (verbose_flag > 1) + yp_msg ("yppush_xfrrespprog_1\n"); switch (rqstp->rq_proc) { case YPPUSHPROC_NULL: - xdr_argument = (bool_t (*)(XDR *, void *))xdr_void; - xdr_result = (bool_t (*)(XDR *, void *))xdr_void; - local = (char *(*)( void *, struct svc_req *)) yppushproc_null_1_svc; + xdr_argument = (bool_t (*)(XDR *, void *)) xdr_void; + xdr_result = (bool_t (*)(XDR *, void *)) xdr_void; + local = (char *(*)(void *, struct svc_req *)) yppushproc_null_1_svc; break; case YPPUSHPROC_XFRRESP: - xdr_argument = (bool_t (*) (XDR *, void *))xdr_yppushresp_xfr; - xdr_result = (bool_t (*)(XDR *, void *))xdr_void; - local = (char *(*)( void *, struct svc_req *)) yppushproc_xfrresp_1_svc; + xdr_argument = (bool_t (*)(XDR *, void *)) xdr_yppushresp_xfr; + xdr_result = (bool_t (*)(XDR *, void *)) xdr_void; + local = (char *(*)(void *, struct svc_req *)) yppushproc_xfrresp_1_svc; break; default: - svcerr_noproc(transp); - exit(1); + svcerr_noproc (transp); + exit (1); } - memset(&argument, '\0', sizeof(argument)); - if (!svc_getargs(transp, (xdrproc_t) xdr_argument, (void *) &argument)) + memset (&argument, '\0', sizeof (argument)); + if (!svc_getargs (transp, (xdrproc_t) xdr_argument, (void *) &argument)) { - svcerr_decode(transp); - exit(1); + svcerr_decode (transp); + exit (1); } - result = (*local)(&argument, rqstp); + result = (*local) (&argument, rqstp); if (result != NULL && - !svc_sendreply(transp, (xdrproc_t) xdr_result, result)) + !svc_sendreply (transp, (xdrproc_t) xdr_result, result)) { - svcerr_systemerr(transp); + svcerr_systemerr (transp); } - if (!svc_freeargs(transp, (xdrproc_t) xdr_argument, (void *) &argument)) + if (!svc_freeargs (transp, (xdrproc_t) xdr_argument, (void *) &argument)) { - yp_msg("unable to free arguments\n"); - exit(1); + yp_msg ("unable to free arguments\n"); + exit (1); } - exit(0); + exit (0); } -static void yppush_svc_run(char *target) +static void +yppush_svc_run (char *target) { #ifdef FD_SETSIZE fd_set readfds; @@ -251,7 +282,8 @@ #endif /* def FD_SETSIZE */ struct timeval tr, tb; - tb.tv_sec=timeout; tb.tv_usec=0; + tb.tv_sec = timeout; + tb.tv_usec = 0; tr = tb; for (;;) @@ -261,288 +293,313 @@ #else readfds = svc_fds; #endif /* def FD_SETSIZE */ - switch (select(_rpc_dtablesize(), &readfds, (void *)0, (void *)0, &tr)) + switch (select (_rpc_dtablesize (), &readfds, (void *) 0, (void *) 0, &tr)) { case -1: if (errno == EINTR) { - tr = tb; /* Read the Linux select.2 manpage ! */ + tr = tb; /* Read the Linux select.2 manpage ! */ continue; } - yp_msg("svc_run: - select failed (%s)",strerror(errno)); + yp_msg ("svc_run: - select failed (%s)", strerror (errno)); return; case 0: - yp_msg( "%s->%s: Callback timed out\n",current_map,target); - exit(0); + yp_msg ("%s->%s: Callback timed out\n", current_map, target); + exit (0); default: - svc_getreqset(&readfds); + svc_getreqset (&readfds); break; } } } /* - * Compare 2 hostnames. + * Compare 2 hostnames. */ -static int hostcmp(char *h1, char *h2) +static int +hostcmp (char *h1, char *h2) { - char buf1[MAXHOSTNAMELEN+1], buf2[MAXHOSTNAMELEN+1]; + char buf1[MAXHOSTNAMELEN + 1], buf2[MAXHOSTNAMELEN + 1]; char *p, *s; - strncpy(buf1, h1, sizeof(buf1)); - strncpy(buf2, h2, sizeof(buf2)); - s = strchr(buf1, '.'); - p = strchr(buf2, '.'); - if (s && !p) *s = 0; - if (p && !s) *p = 0; + strncpy (buf1, h1, sizeof (buf1)); + strncpy (buf2, h2, sizeof (buf2)); + s = strchr (buf1, '.'); + p = strchr (buf2, '.'); + if (s && !p) + *s = 0; + if (p && !s) + *p = 0; - return strcmp(buf1, buf2); + return strcmp (buf1, buf2); } -static char *get_dbm_entry(char *key) +static char * +get_dbm_entry (char *key) { - static char mappath[MAXPATHLEN+2]; + static char mappath[MAXPATHLEN + 2]; char *val; - datum dkey,dval; + datum dkey, dval; +#if defined(HAVE_LIBGDBM) GDBM_FILE dbm; +#elif defined (HAVE_NDBM) + DBM *dbm; +#endif #if defined(HAVE_SNPRINTF) - if(snprintf(mappath, MAXPATHLEN, "%s/%s/%s", YPMAPDIR, DomainName, current_map)==MAXPATHLEN) + if (snprintf (mappath, MAXPATHLEN, "%s/%s/%s", YPMAPDIR, DomainName, current_map) == MAXPATHLEN) #else - if(strlen(YPMAPDIR)+strlen(DomainName)+strlen(current_map)+3 < MAXPATHLEN) - sprintf(mappath, "%s/%s/%s", YPMAPDIR, DomainName, current_map); + if (strlen (YPMAPDIR) + strlen (DomainName) + strlen (current_map) + 3 < MAXPATHLEN) + sprintf (mappath, "%s/%s/%s", YPMAPDIR, DomainName, current_map); else #endif { - yp_msg("ERROR: Path to long: %s/%s/%s\n",YPMAPDIR, DomainName,current_map); - exit(-1); + yp_msg ("ERROR: Path to long: %s/%s/%s\n", YPMAPDIR, DomainName, current_map); + exit (-1); } - if ((dbm=gdbm_open(mappath, 0, GDBM_READER, 0600, NULL))==NULL) +#if defined(HAVE_LIBGDBM) + dbm = gdbm_open (mappath, 0, GDBM_READER, 0600, NULL); +#elif defined(HAVE_NDBM) + dbm = dbm_open (mappath, O_CREAT | O_RDWR, 0600); +#endif + if (dbm == NULL) { - yp_msg("YPPUSH: Cannot open %s\n", mappath); - exit(-1); + yp_msg ("YPPUSH: Cannot open %s\n", mappath); + exit (-1); } - dkey.dptr=key; dkey.dsize=strlen(dkey.dptr); - dval=gdbm_fetch(dbm,dkey); - gdbm_close(dbm); - if (dval.dptr==NULL) + dkey.dptr = key; + dkey.dsize = strlen (dkey.dptr); +#if defined(HAVE_LIBGDBM) + dval = gdbm_fetch (dbm, dkey); + gdbm_close (dbm); +#elif defined(HAVE_NDBM) + dval = dbm_fetch (dbm, dkey); + dbm_close (dbm); +#endif + if (dval.dptr == NULL) return NULL; else { - val = malloc(dval.dsize+1); - strncpy(val,dval.dptr,dval.dsize); + val = malloc (dval.dsize + 1); + strncpy (val, dval.dptr, dval.dsize); val[dval.dsize] = 0; return val; } } -static u_int getordernum( void) +static u_int +getordernum (void) { char *val; u_int i; - val = get_dbm_entry("YP_LAST_MODIFIED"); + val = get_dbm_entry ("YP_LAST_MODIFIED"); - if (val==NULL) + if (val == NULL) { - if (verbose_flag >1) - yp_msg("YPPUSH: %s: Cannot determine order number\n", current_map); + if (verbose_flag > 1) + yp_msg ("YPPUSH: %s: Cannot determine order number\n", current_map); return -1; } - for (i=0; i1) - yp_msg("add_slave_server: Key=%.*s, Val=%.*s, status=%d\n",keylen,key,vallen,val,status); + if (verbose_flag > 1) + yp_msg ("add_slave_server: Key=%.*s, Val=%.*s, status=%d\n", keylen, key, vallen, val, status); - if (status!=YP_TRUE) + if (status != YP_TRUE) return status; #if defined(HAVE_SNPRINTF) - if(snprintf(host,YPMAXPEER,"%.*s", vallen, val)==YPMAXPEER) + if (snprintf (host, YPMAXPEER, "%.*s", vallen, val) == YPMAXPEER) #else - if(vallen < YPMAXPEER) - sprintf(host, "%.*s", vallen, val); + if (vallen < YPMAXPEER) + sprintf (host, "%.*s", vallen, val); else #endif { - yp_msg("ERROR: add_slave_server: %.*s to long\n",vallen,val); - exit(-1); + yp_msg ("ERROR: add_slave_server: %.*s to long\n", vallen, val); + exit (-1); } /* Do not add ourself! */ - if (hostcmp(local_hostname, host) == 0) + if (hostcmp (local_hostname, host) == 0) { if (verbose_flag > 1) - yp_msg("add_slave_server: skipping %s\n", host); + yp_msg ("add_slave_server: skipping %s\n", host); return 0; } - if ((tmp = (struct hostlist *)malloc(sizeof(struct hostlist))) == NULL) + if ((tmp = (struct hostlist *) malloc (sizeof (struct hostlist))) == NULL) { - yp_msg("malloc() failed: %s", strerror(errno)); + yp_msg ("malloc() failed: %s", strerror (errno)); return -1; } - tmp->hostname = strdup(host); + tmp->hostname = strdup (host); tmp->next = hostliste; hostliste = tmp; return 0; } -static void child_sig_int(int sig) +static void +child_sig_int (int sig) { - if (CallbackProg!=0) - svc_unregister(CallbackProg, 1); - exit(-1); + if (CallbackProg != 0) + svc_unregister (CallbackProg, 1); + exit (-1); } -static int yppush_foreach(const char *host) +static int +yppush_foreach (const char *host) { SVCXPRT *CallbackXprt; - CLIENT *PushClient=NULL; + CLIENT *PushClient = NULL; struct ypreq_xfr req; - struct timeval tv={10,0}; + struct timeval tv = + {10, 0}; u_int transid; - char server[YPMAXPEER+2]; + char server[YPMAXPEER + 2]; int sock; struct sigaction sa; #if HAVE_WAIT4 struct rusage r; #endif - if(verbose_flag>1) - yp_msg("yppush_foreach: host=%s\n",host); + if (verbose_flag > 1) + yp_msg ("yppush_foreach: host=%s\n", host); - sa.sa_handler=child_sig_int; - sigemptyset(&sa.sa_mask); + sa.sa_handler = child_sig_int; + sigemptyset (&sa.sa_mask); #if defined(linux) || (defined(sun) && defined(__srv4__)) - sa.sa_flags=SA_NOMASK; + sa.sa_flags = SA_NOMASK; /* Do not prevent the signal from being received from within its own signal handler. */ #endif - sigaction(SIGINT, &sa, NULL); + sigaction (SIGINT, &sa, NULL); #if defined(HAVE_SNPRINTF) - if(snprintf(server,YPMAXPEER,"%s", host)==YPMAXPEER) + if (snprintf (server, YPMAXPEER, "%s", host) == YPMAXPEER) #else - if(strlen(host) < YPMAXPEER) - sprintf(server, "%s",host ); + if (strlen (host) < YPMAXPEER) + sprintf (server, "%s", host); else #endif { - yp_msg("ERROR: yppush_foreach: %.*s to long\n",host); - exit(-1); + yp_msg ("ERROR: yppush_foreach: %.*s to long\n", host); + exit (-1); } - PushClient=clnt_create(server, YPPROG, YPVERS, "tcp"); - if (PushClient==NULL) + PushClient = clnt_create (server, YPPROG, YPVERS, "tcp"); + if (PushClient == NULL) { - yp_msg("%s",host); - clnt_pcreateerror(""); + yp_msg ("%s", host); + clnt_pcreateerror (""); return 1; } - sock=RPC_ANYSOCK; - CallbackXprt=svcudp_create(sock); - if (CallbackXprt==NULL) + sock = RPC_ANYSOCK; + CallbackXprt = svcudp_create (sock); + if (CallbackXprt == NULL) { - yp_msg("YPPUSH: Cannot create callback transport.\n"); + yp_msg ("YPPUSH: Cannot create callback transport.\n"); return 1; } - for (CallbackProg=0x40000000; CallbackProg<0x5fffffff; CallbackProg++) + for (CallbackProg = 0x40000000; CallbackProg < 0x5fffffff; CallbackProg++) { - if (svc_register(CallbackXprt, CallbackProg, 1, - yppush_xfrrespprog_1, IPPROTO_UDP)) + if (svc_register (CallbackXprt, CallbackProg, 1, + yppush_xfrrespprog_1, IPPROTO_UDP)) break; } - switch (transid=fork()) + switch (transid = fork ()) { case -1: - perror("Cannot fork"); - exit(-1); + perror ("Cannot fork"); + exit (-1); case 0: - yppush_svc_run(server); - exit(0); + yppush_svc_run (server); + exit (0); default: - close(CallbackXprt->xp_sock); - req.map_parms.domain=(char *)DomainName; - req.map_parms.map=(char *)current_map; + close (CallbackXprt->xp_sock); + req.map_parms.domain = (char *) DomainName; + req.map_parms.map = (char *) current_map; /* local_hostname is correct since we have compared it with YP_MASTER_NAME */ - req.map_parms.peer=local_hostname; - req.map_parms.ordernum=MapOrderNum; - req.transid=transid; - req.prog=CallbackProg; - req.port=CallbackXprt->xp_port; + req.map_parms.peer = local_hostname; + req.map_parms.ordernum = MapOrderNum; + req.transid = transid; + req.prog = CallbackProg; + req.port = CallbackXprt->xp_port; if (verbose_flag) { - yp_msg("%s has been called.\n",server); - if (verbose_flag>1) + yp_msg ("%s has been called.\n", server); + if (verbose_flag > 1) { - yp_msg("\t->target: %s\n",server); - yp_msg("\t->domain: %s\n",req.map_parms.domain); - yp_msg("\t->map: %s\n",req.map_parms.map); - yp_msg("\t->tarnsid: %d\n",req.transid); - yp_msg("\t->prog: %d\n",req.prog); - yp_msg("\t->master: %s\n",req.map_parms.peer); - yp_msg("\t->ordernum: %d\n",req.map_parms.ordernum); + yp_msg ("\t->target: %s\n", server); + yp_msg ("\t->domain: %s\n", req.map_parms.domain); + yp_msg ("\t->map: %s\n", req.map_parms.map); + yp_msg ("\t->tarnsid: %d\n", req.transid); + yp_msg ("\t->prog: %d\n", req.prog); + yp_msg ("\t->master: %s\n", req.map_parms.peer); + yp_msg ("\t->ordernum: %d\n", req.map_parms.ordernum); } } - if(clnt_call(PushClient, YPPROC_XFR, (xdrproc_t) xdr_ypreq_xfr, - (void *) &req, (xdrproc_t) xdr_void, NULL, tv) - != RPC_SUCCESS) + if (clnt_call (PushClient, YPPROC_XFR, (xdrproc_t) xdr_ypreq_xfr, + (void *) &req, (xdrproc_t) xdr_void, NULL, tv) + != RPC_SUCCESS) { - clnt_perror(PushClient, "YPPUSH: Cannot call YPPROC_XFR"); - kill(transid, SIGTERM); + clnt_perror (PushClient, "YPPUSH: Cannot call YPPROC_XFR"); + kill (transid, SIGTERM); } #if HAVE_WAIT4 - wait4(transid, &sock, 0, &r); + wait4 (transid, &sock, 0, &r); #else - waitpid(transid,&sock, 0); + waitpid (transid, &sock, 0); #endif - svc_unregister(CallbackProg, 1); - CallbackProg=0; - if (PushClient!=NULL) + svc_unregister (CallbackProg, 1); + CallbackProg = 0; + if (PushClient != NULL) { - clnt_destroy(PushClient); - PushClient=NULL; + clnt_destroy (PushClient); + PushClient = NULL; } } @@ -552,29 +609,30 @@ static void sig_child (int sig) { - int status; + int status; #ifdef HAVE_WAIT3 - while (wait3(&status, WNOHANG, NULL) > 0) + while (wait3 (&status, WNOHANG, NULL) > 0) #else - while (waitpid(-1, &status, WNOHANG) > 0) + while (waitpid (-1, &status, WNOHANG) > 0) #endif - { - if(verbose_flag > 1) - yp_msg("Child %d exists\n",WEXITSTATUS(status)); - children--; - } + { + if (verbose_flag > 1) + yp_msg ("Child %d exists\n", WEXITSTATUS (status)); + children--; + } } static inline void Usage (int exit_code) { - yp_msg("Usage: yppush [-d domain] [-t timeout] [-p #] [-h host] [-v] mapname ...\n"); - yp_msg(" yppush --version\n"); - exit(exit_code); + yp_msg ("Usage: yppush [-d domain] [-t timeout] [-p #] [-h host] [-v] mapname ...\n"); + yp_msg (" yppush --version\n"); + exit (exit_code); } -int main(int argc, char **argv) +int +main (int argc, char **argv) { struct hostlist *tmp; @@ -582,157 +640,176 @@ enum ypstat y; struct sigaction a; - a.sa_handler=sig_child; - sigemptyset(&a.sa_mask); + a.sa_handler = sig_child; + sigemptyset (&a.sa_mask); #if defined(linux) || (defined(sun) && defined(__srv4__)) - a.sa_flags=SA_NOMASK; + a.sa_flags = SA_NOMASK; /* Do not prevent the signal from being received from within its own signal handler. */ #endif - sigaction(SIGCHLD, &a, NULL); + sigaction (SIGCHLD, &a, NULL); - while(1) + while (1) { int c; int option_index = 0; static struct option long_options[] = { - {"version", no_argument, NULL, '\255'}, + {"version", no_argument, NULL, '\255'}, {"verbose", no_argument, NULL, 'v'}, {"host", required_argument, NULL, 'h'}, - {"help", no_argument, NULL, 'u'}, - {"usage", no_argument, NULL, 'u'}, + {"help", no_argument, NULL, 'u'}, + {"usage", no_argument, NULL, 'u'}, {"parallel", required_argument, NULL, 'p'}, {"timeout", required_argument, NULL, 't'}, - {NULL, 0, NULL, '\0'} + {NULL, 0, NULL, '\0'} }; - c=getopt_long(argc, argv, "d:vh:ut:p:j:",long_options, &option_index); - if (c==EOF) break; + c = getopt_long (argc, argv, "d:vh:ut:p:j:", long_options, &option_index); + if (c == EOF) + break; switch (c) { case 'd': - DomainName=optarg; + DomainName = optarg; break; case 'v': verbose_flag++; break; case 't': - timeout=atoi(optarg); + timeout = atoi (optarg); break; case 'j': case 'p': - maxchildren=atoi(optarg); + maxchildren = atoi (optarg); break; case 'h': /* we can handle multiple hosts */ - if ((tmp = (struct hostlist *)malloc(sizeof(struct hostlist))) == NULL) + if ((tmp = (struct hostlist *) malloc (sizeof (struct hostlist))) == NULL) { - yp_msg("malloc() failed: %s", strerror(errno)); + yp_msg ("malloc() failed: %s", strerror (errno)); return 1; } - tmp->hostname = strdup(optarg); + tmp->hostname = strdup (optarg); tmp->next = hostliste; hostliste = tmp; break; case 'u': - Usage(0); + Usage (0); break; case '\255': - fprintf(stderr,"yppush - NYS YP Server version %s\n",version); - exit(0); + fprintf (stderr, "yppush - NYS YP Server version %s\n", version); + exit (0); default: - Usage(1); + Usage (1); } } - argc-=optind; - argv+=optind; + argc -= optind; + argv += optind; - if (argc<1) Usage(1); + if (argc < 1) + Usage (1); - if (DomainName==NULL) + if (DomainName == NULL) { - if (yp_get_default_domain(&DomainName)!=0) + if (yp_get_default_domain (&DomainName) != 0) { - yp_msg("YPPUSH: Cannot get default domain\n"); + yp_msg ("YPPUSH: Cannot get default domain\n"); return 1; } } - if (gethostname(local_hostname, MAXHOSTNAMELEN)!=0) + if (gethostname (local_hostname, MAXHOSTNAMELEN) != 0) { - perror("YPPUSH: gethostname"); - yp_msg("YPPUSH: Cannot determine local hostname\n"); + perror ("YPPUSH: gethostname"); + yp_msg ("YPPUSH: Cannot determine local hostname\n"); return 1; } +#if USE_FQDN + else + { + struct hostent *hp; + + if (!(hp = gethostbyname (local_hostname))) + { + perror ("YPPUSH: gethostbyname()"); + yp_msg ("YPPUSH: using not FQDN name\n"); + } + else + { + strncpy (local_hostname, hp->h_name, MAXHOSTNAMELEN); + local_hostname[MAXHOSTNAMELEN] = '\0'; + } + } +#endif - if(hostliste == NULL) + if (hostliste == NULL) { - f.foreach=add_slave_server; + f.foreach = add_slave_server; #ifdef OSF_KLUDGE y = yp_all (DomainName, "ypservers", f); #else y = yp_all (DomainName, "ypservers", &f); #endif - if (y && y!=YP_NOMORE) + if (y && y != YP_NOMORE) { - yp_msg("Could not read ypservers: %d %s\n", - y, yperr_string(y)); + yp_msg ("Could not read ypservers: %d %s\n", + y, yperr_string (y)); } } - while(*argv) + while (*argv) { char *val; - current_map=*argv++; - val = get_dbm_entry("YP_MASTER_NAME"); - if(val && strcmp(val,local_hostname) != 0) - { - yp_msg("YPPUSH: %s is not the master for %s, try it from %s.\n", - local_hostname, current_map, val); - free(val); + current_map = *argv++; + val = get_dbm_entry ("YP_MASTER_NAME"); + if (val && strcmp (val, local_hostname) != 0) + { + yp_msg ("YPPUSH: %s is not the master for %s, try it from %s.\n", + local_hostname, current_map, val); + free (val); continue; } - else - if(val) free(val); + else if (val) + free (val); - MapOrderNum=getordernum(); + MapOrderNum = getordernum (); #if 0 - if (MapOrderNum==0xffffffff) + if (MapOrderNum == 0xffffffff) continue; #endif tmp = hostliste; - while(tmp != NULL) + while (tmp != NULL) { - while(children >= maxchildren) - sleep(1); + while (children >= maxchildren) + sleep (1); children++; - switch(fork()) + switch (fork ()) { case -1: - perror("YPPUSH: Cannot fork"); - exit(1); + perror ("YPPUSH: Cannot fork"); + exit (1); case 0: - yppush_foreach(tmp->hostname); - exit(children); + yppush_foreach (tmp->hostname); + exit (children); default: - if(verbose_flag>1) - yp_msg("Start new child (%d)\n",children); + if (verbose_flag > 1) + yp_msg ("Start new child (%d)\n", children); break; } tmp = tmp->next; } - while(children != 0) + while (children != 0) { - sleep(10); - if(verbose_flag>1) - yp_msg("Running Children: %d\n",children); + sleep (10); + if (verbose_flag > 1) + yp_msg ("Running Children: %d\n", children); } } - if(verbose_flag>1) - yp_msg("all done (%d running childs)\n",children); + if (verbose_flag > 1) + yp_msg ("all done (%d running childs)\n", children); return 0; } diff -u -r --new-file ypserv-1.2.8/ypserv.c ypserv-1.3.0/ypserv.c --- ypserv-1.2.8/ypserv.c Fri Jan 9 21:41:43 1998 +++ ypserv-1.3.0/ypserv.c Sun Mar 8 17:07:35 1998 @@ -26,7 +26,7 @@ */ #ifndef LINT -static const char rcsid[] = "$Id: ypserv.c,v 1.10 1998/01/09 20:41:43 kukuk Exp $"; +static const char rcsid[] = "$Id: ypserv.c,v 1.14 1998/03/08 16:05:40 kukuk Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -87,7 +87,6 @@ int version_flag = 0; int debug_flag = 0; int dns_flag = 0; -int sunos_kludge_flag = 1; #ifndef YPMAPDIR #define YPMAPDIR "/var/yp" @@ -132,6 +131,105 @@ #endif static void +ypprog_1 (struct svc_req *rqstp, register SVCXPRT *transp) +{ + union { + domainname ypoldproc_domain_1_arg; + domainname ypoldproc_domain_nonack_1_arg; + yprequest ypoldproc_match_1_arg; + yprequest ypoldproc_first_1_arg; + yprequest ypoldproc_next_1_arg; + yprequest ypoldproc_poll_1_arg; + yprequest ypoldproc_push_1_arg; + yprequest ypoldproc_pull_1_arg; + yprequest ypoldproc_get_1_arg; + } argument; + char *result; + xdrproc_t xdr_argument, xdr_result; + char *(*local)(char *, struct svc_req *); + + switch (rqstp->rq_proc) { + case YPOLDPROC_NULL: + xdr_argument = (xdrproc_t) xdr_void; + xdr_result = (xdrproc_t) xdr_void; + local = (char *(*)(char *, struct svc_req *)) ypoldproc_null_1_svc; + break; + + case YPOLDPROC_DOMAIN: + xdr_argument = (xdrproc_t) xdr_domainname; + xdr_result = (xdrproc_t) xdr_bool; + local = (char *(*)(char *, struct svc_req *)) ypoldproc_domain_1_svc; + break; + + case YPOLDPROC_DOMAIN_NONACK: + xdr_argument = (xdrproc_t) xdr_domainname; + xdr_result = (xdrproc_t) xdr_bool; + local = (char *(*)(char *, struct svc_req *)) ypoldproc_domain_nonack_1_svc; + break; + + case YPOLDPROC_MATCH: + xdr_argument = (xdrproc_t) xdr_yprequest; + xdr_result = (xdrproc_t) xdr_ypresponse; + local = (char *(*)(char *, struct svc_req *)) ypoldproc_match_1_svc; + break; + + case YPOLDPROC_FIRST: + xdr_argument = (xdrproc_t) xdr_yprequest; + xdr_result = (xdrproc_t) xdr_ypresponse; + local = (char *(*)(char *, struct svc_req *)) ypoldproc_first_1_svc; + break; + + case YPOLDPROC_NEXT: + xdr_argument = (xdrproc_t) xdr_yprequest; + xdr_result = (xdrproc_t) xdr_ypresponse; + local = (char *(*)(char *, struct svc_req *)) ypoldproc_next_1_svc; + break; + + case YPOLDPROC_POLL: + xdr_argument = (xdrproc_t) xdr_yprequest; + xdr_result = (xdrproc_t) xdr_ypresponse; + local = (char *(*)(char *, struct svc_req *)) ypoldproc_poll_1_svc; + break; + + case YPOLDPROC_PUSH: + xdr_argument = (xdrproc_t) xdr_yprequest; + xdr_result = (xdrproc_t) xdr_ypresponse; + local = (char *(*)(char *, struct svc_req *)) ypoldproc_push_1_svc; + break; + + case YPOLDPROC_PULL: + xdr_argument = (xdrproc_t) xdr_yprequest; + xdr_result = (xdrproc_t) xdr_ypresponse; + local = (char *(*)(char *, struct svc_req *)) ypoldproc_pull_1_svc; + break; + + case YPOLDPROC_GET: + xdr_argument = (xdrproc_t) xdr_yprequest; + xdr_result = (xdrproc_t) xdr_ypresponse; + local = (char *(*)(char *, struct svc_req *)) ypoldproc_get_1_svc; + break; + + default: + svcerr_noproc (transp); + return; + } + memset ((char *)&argument, 0, sizeof (argument)); + if (!svc_getargs (transp, xdr_argument, (caddr_t) &argument)) { + svcerr_decode (transp); + return; + } + result = (*local)((char *)&argument, rqstp); + if (result != NULL && !svc_sendreply(transp, xdr_result, result)) { + svcerr_systemerr (transp); + } + if (!svc_freeargs (transp, xdr_argument, (caddr_t) &argument)) { + fprintf (stderr, "unable to free arguments"); + exit (1); + } + return; +} + +static void ypprog_2(struct svc_req *rqstp, register SVCXPRT *transp) { union { @@ -296,7 +394,7 @@ */ void create_pidfile(void) { - int fd, left, written; + int fd, left, written, flags; pid_t pid; char pbuf[10], *ptr; struct flock lock; @@ -309,6 +407,22 @@ if(debug_flag) yp_msg("\n"); } + /* Make sure file gets correctly closed when process finished. */ + flags = fcntl (fd, F_GETFD, 0); + if (flags == -1) + { + /* Cannot get file flags. */ + close (fd); + return; + } + flags |= FD_CLOEXEC; /* Close on exit. */ + if (fcntl (fd, F_SETFD, flags) < 0) + { + /* Cannot set new flags. */ + close (fd); + return; + } + lock.l_type = F_WRLCK; lock.l_start = 0; lock.l_whence = SEEK_SET; @@ -373,42 +487,22 @@ */ void sig_quit(int sig) { - (void) pmap_unset(YPPROG, YPVERS); - if(sunos_kludge_flag) - (void) pmap_unset(YPPROG, 1); + pmap_unset(YPPROG, YPVERS); + pmap_unset(YPPROG, YPOLDVERS); unlink(_YPSERV_PIDFILE); exit(0); } -static SVCXPRT *main_transp; /* ** Reload securenets and config file */ void sig_hup(int sig) { - int old_sunos_kludge; - - old_sunos_kludge = sunos_kludge_flag; - #ifndef HAVE_LIBWRAP load_securenets(); #endif load_config(); - - if(sunos_kludge_flag && ! old_sunos_kludge) - {/* We must register it new */ - if (!svc_register(main_transp, YPPROG, 1, ypprog_2, IPPROTO_UDP)) - { - yp_msg("unable to register (YPPROG, 1, udp)."); - sunos_kludge_flag = 0; - } - } - else - if(!sunos_kludge_flag && old_sunos_kludge) - { /* We must unregister it now */ - (void) pmap_unset(YPPROG, 1); - } } void Usage(int exitcode) @@ -422,6 +516,7 @@ int main (int argc, char **argv) { + SVCXPRT *main_transp; int my_port = -1, my_socket, result; struct sockaddr_in socket_address; struct sigaction sa; @@ -587,9 +682,8 @@ sigemptyset(&sa.sa_mask); sigaction(SIGHUP, &sa, NULL); - (void) pmap_unset(YPPROG, YPVERS); - if(sunos_kludge_flag) - (void) pmap_unset(YPPROG, 1); + pmap_unset(YPPROG, YPVERS); + pmap_unset(YPPROG, YPOLDVERS); if (my_port >= 0) { @@ -617,41 +711,35 @@ else my_socket = RPC_ANYSOCK; - main_transp = svcudp_create(my_socket); - if (main_transp == NULL) { - yp_msg("cannot create udp service."); - exit(1); - } - if (!svc_register(main_transp, YPPROG, YPVERS, ypprog_2, IPPROTO_UDP)) { - yp_msg("unable to register (YPPROG, YPVERS, udp)."); - exit(1); - } + main_transp = svcudp_create (my_socket); + if (main_transp == NULL) + { + yp_msg ("cannot create udp service."); + exit (1); + } - /* - ** This is just to make us reply to YP version 1 calls which SunOS 4's - ** ypbind seems to insist on finding. If someone _really_ tries to - ** use this then they will probably be bitten - _hard_, since I haven't - ** got the faintest idea on how the XDR calls for YP version 1 should - ** look like. The Domain_NoNack call seems to be compatible though :-) - */ - if(sunos_kludge_flag) - if (!svc_register(main_transp, YPPROG, 1, ypprog_2, IPPROTO_UDP)) - { - yp_msg("unable to register (YPPROG, 1, udp)."); - exit(1); - } + if (!svc_register (main_transp, YPPROG, YPVERS, ypprog_2, IPPROTO_UDP)) + { + yp_msg ("unable to register (YPPROG, YPVERS, udp)."); + exit (1); + } + + if (!svc_register(main_transp, YPPROG, YPOLDVERS, ypprog_1, IPPROTO_UDP)) + { + yp_msg("unable to register (YPPROG, YPOLDVERS, udp)."); + exit(1); + } if (my_port >= 0) { my_socket = socket (AF_INET, SOCK_STREAM, 0); if (my_socket < 0) { - yp_msg ("%s: can not create TCP ", - progname); + yp_msg ("%s: can not create TCP: %s", progname, strerror (errno)); exit (1); } - memset((char *) &socket_address, 0, sizeof(socket_address)); + memset (&socket_address, 0, sizeof (socket_address)); socket_address.sin_family = AF_INET; socket_address.sin_addr.s_addr = htonl (INADDR_ANY); socket_address.sin_port = htons (my_port); @@ -660,8 +748,7 @@ sizeof (socket_address)); if (result < 0) { - yp_msg("%s: can not bind TCP ", - progname); + yp_msg("%s: can not bind TCP ", progname, strerror (errno)); exit (1); } } @@ -669,14 +756,23 @@ my_socket = RPC_ANYSOCK; main_transp = svctcp_create(my_socket, 0, 0); - if (main_transp == NULL) { - yp_msg("%s: cannot create tcp service\n", progname); - exit(1); - } - if (!svc_register(main_transp, YPPROG, YPVERS, ypprog_2, IPPROTO_TCP)) { - yp_msg("%s: unable to register (YPPROG, YPVERS, tcp)\n", progname); - exit(1); - } + if (main_transp == NULL) + { + yp_msg("%s: cannot create tcp service\n", progname); + exit(1); + } + + if (!svc_register(main_transp, YPPROG, YPVERS, ypprog_2, IPPROTO_TCP)) + { + yp_msg("%s: unable to register (YPPROG, YPVERS, tcp)\n", progname); + exit(1); + } + + if (!svc_register(main_transp, YPPROG, YPOLDVERS, ypprog_1, IPPROTO_TCP)) + { + yp_msg("%s: unable to register (YPPROG, YPOLDVERS, tcp)\n", progname); + exit(1); + } ypserv_svc_run(); yp_msg("svc_run returned"); diff -u -r --new-file ypserv-1.2.8/ypserv.conf.5.in ypserv-1.3.0/ypserv.conf.5.in --- ypserv-1.2.8/ypserv.conf.5.in Tue Dec 30 19:08:05 1997 +++ ypserv-1.3.0/ypserv.conf.5.in Wed Feb 4 21:49:19 1998 @@ -1,6 +1,6 @@ .\" -*- nroff -*- -.\" $Id: ypserv.conf.5.in,v 1.4 1997/12/30 18:08:05 kukuk Exp $ -.\" Copyright (c) 1996, 1997 Thorsten Kukuk kukuk@uni-paderborn.de +.\" $Id: ypserv.conf.5.in,v 1.5 1998/02/04 20:49:19 kukuk Exp $ +.\" Copyright (c) 1996, 1997, 1998 Thorsten Kukuk kukuk@uni-paderborn.de .\" .TH YPSERV.CONF 5 "December 1997" "NYS YP Server" "NIS Server Reference Manual" .SH NAME @@ -35,13 +35,9 @@ overwrite the "-dns" option. .TP .B sunos_kludge -This is just to make +This is not longer supported, since .B ypserv -reply to YP version 1 calls which SunOS 4's ypbind seems to insist -on finding. If someone \fIreally\fP tries to use this then they will -probably be bitten \fIhard\fP, since the XDR calls for YP version 1 are -not implemented. The Domain_NoNack call seems to be compatible. -The default is "yes". +supports the most YP version 1 functions. .TP .B xfr_check_port With this option enabled, the NIS master server have to run on a diff -u -r --new-file ypserv-1.2.8/ypserv.h ypserv-1.3.0/ypserv.h --- ypserv-1.2.8/ypserv.h Tue Dec 30 19:08:05 1997 +++ ypserv-1.3.0/ypserv.h Wed Feb 4 21:49:19 1998 @@ -2,7 +2,7 @@ #define __YPSERV_H__ /* -** $Id: ypserv.h,v 1.5 1997/12/30 18:08:05 kukuk Exp $ +** $Id: ypserv.h,v 1.6 1998/02/04 20:49:19 kukuk Exp $ */ #include @@ -23,7 +23,6 @@ extern char *path_ypdb; /* ypserv.c */ extern int debug_flag; /* ypserv.c || ypxfrd.c */ extern int dns_flag; /* ypserv.c || ypxfrd.c */ -extern int sunos_kludge_flag; /* ypserv.c || ypxfrd.c */ extern int children; /* server.c || ypxfrd.c */ extern int forked; /* server.c || ypxfrd.c */ extern int xfr_check_port; /* server.c || ypxfrd.c */ diff -u -r --new-file ypserv-1.2.8/ypserv.spec ypserv-1.3.0/ypserv.spec --- ypserv-1.2.8/ypserv.spec Thu Jan 29 09:01:13 1998 +++ ypserv-1.3.0/ypserv.spec Sat Mar 7 09:58:56 1998 @@ -1,10 +1,10 @@ Summary: NIS/YP Server Name: ypserv -Version: 1.2.8 +Version: 1.3.0 Release: 1 Copyright: GNU Group: Networking/Daemons -Source: ftp.kernel.org:/pub/linux/utils/net/NIS/ypserv-%{PACKAGE_VERSION}.tar.gz +Source: weber.uni-paderborn.de:/pub/linux/NIS/ypserv-%{PACKAGE_VERSION}.tar.gz Packager: Thorsten Kukuk URL: http://www-vt.uni-paderborn.de/~kukuk/linux/nis.html BuildRoot: /var/tmp/ypserv-root @@ -14,11 +14,8 @@ %changelog -* Mon Jan 25 1998 Thorsten Kukuk -- update to new version 1.2.8 - -* Sat Jan 17 1998 Thorsten Kukuk -- update to new version 1.2.7 +* Sat Mar 7 1998 Thorsten Kukuk +- update to new version 1.3.0 * Thu Dec 30 1997 Thorsten Kukuk - update to new version 1.2.6 diff -u -r --new-file ypserv-1.2.8/ypserv_conf.c ypserv-1.3.0/ypserv_conf.c --- ypserv-1.2.8/ypserv_conf.c Thu Jan 8 23:07:47 1998 +++ ypserv-1.3.0/ypserv_conf.c Wed Feb 4 21:49:19 1998 @@ -22,7 +22,7 @@ */ #ifndef LINT -static const char rcsid[] = "$Id: ypserv_conf.c,v 1.7 1998/01/08 22:07:47 kukuk Exp $"; +static const char rcsid[] = "$Id: ypserv_conf.c,v 1.8 1998/02/04 20:49:19 kukuk Exp $"; #endif #if defined(HAVE_CONFIG_H) @@ -244,7 +244,7 @@ } case 's': { /* sunos_kludge */ - size_t i, j; + size_t i; fgets (buf1, sizeof (buf1) - 1, in); i = 0; @@ -263,29 +263,11 @@ if ((buf1[i - 1] == ':') && (strcmp (buf2, "sunos_kludge") == 0)) { - while (((buf1[i] == ' ') || (buf1[i] == '\t')) && - (i <= strlen (buf1))) - i++; - j = 0; - while ((buf1[i] != '\0') && (buf1[i] != '\n')) - buf3[j++] = buf1[i++]; - buf3[j] = 0; - - sscanf (buf3, "%s", buf2); - if (strcmp (buf2, "yes") == 0) - sunos_kludge_flag = 1; - else if (strcmp (buf2, "no") == 0) - sunos_kludge_flag = 0; - else - yp_msg ("Unknown sunos_kludge option in line %d: => Ignore line\n", - line); + yp_msg ("sunos_kludge (line %d) is not longer supported.\n", + line); } else yp_msg ("Parse error in line %d: => Ignore line\n", line); - - if (debug_flag) - yp_msg ("ypserv.conf: sunos_kludge: %d\n", sunos_kludge_flag); - break; } case 't': { /* tryresolve */ diff -u -r --new-file ypserv-1.2.8/ypserv_v1.c ypserv-1.3.0/ypserv_v1.c --- ypserv-1.2.8/ypserv_v1.c Thu Jan 1 01:00:00 1970 +++ ypserv-1.3.0/ypserv_v1.c Thu Feb 5 21:21:26 1998 @@ -0,0 +1,228 @@ +/* + ypserv_v1.c - YP server routines for V1 + + Copyright (c) 1998 Thorsten Kukuk + + This file is part of the NYS YP Server. + + The NYS YP Server is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The NYS YP Server is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with the NYS YP Server; see the file COPYING. If + not, write to the Free Software Foundation, Inc., 675 Mass Ave, + Cambridge, MA 02139, USA. + + Author: Thorsten Kukuk +*/ + +#ifndef LINT +static const char rcsid[] = "$Id: server.c,v 1.20 1998/02/04 19:45:12 kukuk Exp + $"; +#endif + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include "system.h" + +#include "yp.h" +#include "yp_msg.h" + +void * +ypoldproc_null_1_svc (void *argp, struct svc_req *rqstp) +{ + return (ypproc_null_2_svc (argp, rqstp)); +} + +bool_t * +ypoldproc_domain_1_svc (domainname * argp, struct svc_req * rqstp) +{ + return (ypproc_domain_2_svc (argp, rqstp)); +} + +bool_t * +ypoldproc_domain_nonack_1_svc (domainname * argp, struct svc_req * rqstp) +{ + return (ypproc_domain_nonack_2_svc (argp, rqstp)); +} + +ypresponse * +ypoldproc_match_1_svc (yprequest * argp, struct svc_req * rqstp) +{ + static ypresponse result; + ypresp_val *v2_result; + + result.yp_resptype = YPRESP_VAL; + result.ypresponse_u.yp_resp_valtype.val.valdat_val = ""; + result.ypresponse_u.yp_resp_valtype.val.valdat_len = 0; + + if (argp->yp_reqtype != YPREQ_KEY) + { + result.ypresponse_u.yp_resp_valtype.stat = YP_BADARGS; + return (&result); + } + + v2_result = ypproc_match_2_svc (&argp->yprequest_u.yp_req_keytype, rqstp); + if (v2_result == NULL) + return (NULL); + + memcpy (&result.ypresponse_u.yp_resp_valtype, v2_result, + sizeof (ypresp_val)); + + return (&result); +} + +ypresponse * +ypoldproc_first_1_svc (yprequest * argp, struct svc_req * rqstp) +{ + static ypresponse result; + ypresp_key_val *v2_result; + + result.yp_resptype = YPRESP_KEY_VAL; + result.ypresponse_u.yp_resp_key_valtype.val.valdat_val = + result.ypresponse_u.yp_resp_key_valtype.key.keydat_val = ""; + result.ypresponse_u.yp_resp_key_valtype.val.valdat_len = + result.ypresponse_u.yp_resp_key_valtype.key.keydat_len = 0; + + if (argp->yp_reqtype != YPREQ_NOKEY) + { + result.ypresponse_u.yp_resp_key_valtype.stat = YP_BADARGS; + return (&result); + } + + v2_result = ypproc_first_2_svc (&argp->yprequest_u.yp_req_nokeytype, + rqstp); + if (v2_result == NULL) + return (NULL); + + memcpy (&result.ypresponse_u.yp_resp_key_valtype, v2_result, + sizeof (ypresp_key_val)); + + return (&result); +} + +ypresponse * +ypoldproc_next_1_svc (yprequest * argp, struct svc_req * rqstp) +{ + static ypresponse result; + ypresp_key_val *v2_result; + + result.yp_resptype = YPRESP_KEY_VAL; + result.ypresponse_u.yp_resp_key_valtype.val.valdat_val = + result.ypresponse_u.yp_resp_key_valtype.key.keydat_val = ""; + result.ypresponse_u.yp_resp_key_valtype.val.valdat_len = + result.ypresponse_u.yp_resp_key_valtype.key.keydat_len = 0; + + if (argp->yp_reqtype != YPREQ_KEY) + { + result.ypresponse_u.yp_resp_key_valtype.stat = YP_BADARGS; + return &result; + } + + v2_result = ypproc_next_2_svc (&argp->yprequest_u.yp_req_keytype, rqstp); + if (v2_result == NULL) + return NULL; + + memcpy (&result.ypresponse_u.yp_resp_key_valtype, v2_result, + sizeof (ypresp_key_val)); + + return &result; +} + +ypresponse * +ypoldproc_poll_1_svc (yprequest * argp, struct svc_req * rqstp) +{ + static ypresponse result; + ypresp_master *v2_result1; + ypresp_order *v2_result2; + + result.yp_resptype = YPRESP_MAP_PARMS; + result.ypresponse_u.yp_resp_map_parmstype.domain = + argp->yprequest_u.yp_req_nokeytype.domain; + result.ypresponse_u.yp_resp_map_parmstype.map = + argp->yprequest_u.yp_req_nokeytype.map; + /* + * Hmm... there is no 'status' value in the + * yp_resp_map_parmstype structure, so I have to + * guess at what to do to indicate a failure. + * I hope this is right. + */ + result.ypresponse_u.yp_resp_map_parmstype.ordernum = 0; + result.ypresponse_u.yp_resp_map_parmstype.peer = ""; + + if (argp->yp_reqtype != YPREQ_MAP_PARMS) + { + return (&result); + } + + v2_result1 = ypproc_master_2_svc (&argp->yprequest_u.yp_req_nokeytype, + rqstp); + if (v2_result1 == NULL) + return (NULL); + if (v2_result1->stat != YP_TRUE) + { + return (&result); + } + + v2_result2 = ypproc_order_2_svc (&argp->yprequest_u.yp_req_nokeytype, + rqstp); + if (v2_result2 == NULL) + return (NULL); + + if (v2_result2->stat != YP_TRUE) + { + return (&result); + } + + result.ypresponse_u.yp_resp_map_parmstype.peer = + v2_result1->peer; + result.ypresponse_u.yp_resp_map_parmstype.ordernum = + v2_result2->ordernum; + + return (&result); +} + +ypresponse * +ypoldproc_push_1_svc (yprequest * argp, struct svc_req * rqstp) +{ + static ypresponse result; + + /* + * Not implemented. + */ + + return (&result); +} + +ypresponse * +ypoldproc_pull_1_svc (yprequest * argp, struct svc_req * rqstp) +{ + static ypresponse result; + + /* + * Not implemented. + */ + + return (&result); +} + +ypresponse * +ypoldproc_get_1_svc (yprequest * argp, struct svc_req * rqstp) +{ + static ypresponse result; + + /* + * Not implemented. + */ + + return (&result); +} diff -u -r --new-file ypserv-1.2.8/ypserv_xdr.c ypserv-1.3.0/ypserv_xdr.c --- ypserv-1.2.8/ypserv_xdr.c Fri May 2 18:34:16 1997 +++ ypserv-1.3.0/ypserv_xdr.c Wed Feb 4 22:20:30 1998 @@ -13,7 +13,7 @@ */ #ifndef LINT -static const char rcsid[] = "$Id: ypserv_xdr.c,v 1.2 1997/05/02 16:34:16 kukuk Exp $"; +static const char rcsid[] = "$Id: ypserv_xdr.c,v 1.3 1998/02/04 21:20:30 kukuk Exp $"; #endif #include "system.h" @@ -355,61 +355,65 @@ } bool_t -xdr_ypbind_resptype(XDR *xdrs, ypbind_resptype *objp) +xdr_ypreqtype (XDR *xdrs, ypreqtype *objp) { - if (!xdr_enum(xdrs, (enum_t *)objp)) - return FALSE; - - return TRUE; + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; } bool_t -xdr_ypbind_binding(XDR *xdrs, ypbind_binding *objp) -{ - if (!xdr_opaque(xdrs, objp->ypbind_binding_addr, 4)) - return FALSE; - - if (!xdr_opaque(xdrs, objp->ypbind_binding_port, 2)) - return FALSE; - - return TRUE; +xdr_ypresptype (XDR *xdrs, ypresptype *objp) +{ + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; } bool_t -xdr_ypbind_resp(XDR *xdrs, ypbind_resp *objp) -{ - if (!xdr_ypbind_resptype(xdrs, &objp->ypbind_status)) - return FALSE; - - switch (objp->ypbind_status) - { - case YPBIND_FAIL_VAL: - if (!xdr_u_int(xdrs, &objp->ypbind_resp_u.ypbind_error)) - return FALSE; - break; - - case YPBIND_SUCC_VAL: - if (!xdr_ypbind_binding(xdrs, &objp->ypbind_resp_u.ypbind_bindinfo)) - return FALSE; - break; - - default: - return FALSE; - } - return TRUE; +xdr_yprequest (XDR *xdrs, yprequest *objp) +{ + if (!xdr_ypreqtype (xdrs, &objp->yp_reqtype)) + return FALSE; + switch (objp->yp_reqtype) { + case YPREQ_KEY: + if (!xdr_ypreq_key (xdrs, &objp->yprequest_u.yp_req_keytype)) + return FALSE; + break; + case YPREQ_NOKEY: + if (!xdr_ypreq_nokey (xdrs, &objp->yprequest_u.yp_req_nokeytype)) + return FALSE; + break; + case YPREQ_MAP_PARMS: + if (!xdr_ypmap_parms (xdrs, &objp->yprequest_u.yp_req_map_parmstype)) + return FALSE; + break; + default: + return FALSE; + } + return TRUE; } bool_t -xdr_ypbind_setdom(XDR *xdrs, ypbind_setdom *objp) -{ - if (!xdr_domainname(xdrs, &objp->ypsetdom_domain)) - return FALSE; - - if (!xdr_ypbind_binding(xdrs, &objp->ypsetdom_binding)) - return FALSE; - - if (!xdr_u_int(xdrs, &objp->ypsetdom_vers)) - return FALSE; - - return TRUE; +xdr_ypresponse (XDR *xdrs, ypresponse *objp) +{ + if (!xdr_ypresptype (xdrs, &objp->yp_resptype)) + return FALSE; + switch (objp->yp_resptype) { + case YPRESP_VAL: + if (!xdr_ypresp_val (xdrs, &objp->ypresponse_u.yp_resp_valtype)) + return FALSE; + break; + case YPRESP_KEY_VAL: + if (!xdr_ypresp_key_val (xdrs, &objp->ypresponse_u.yp_resp_key_valtype)) + return FALSE; + break; + case YPRESP_MAP_PARMS: + if (!xdr_ypmap_parms (xdrs, &objp->ypresponse_u.yp_resp_map_parmstype)) + return FALSE; + break; + default: + return FALSE; + } + return TRUE; } diff -u -r --new-file ypserv-1.2.8/ypxfr.c ypserv-1.3.0/ypxfr.c --- ypserv-1.2.8/ypxfr.c Wed Jan 28 18:12:45 1998 +++ ypserv-1.3.0/ypxfr.c Sat Mar 7 09:59:37 1998 @@ -22,14 +22,14 @@ */ #ifndef LINT -static const char rcsid[] = "$Id: ypxfr.c,v 1.14 1997/10/17 21:25:11 kukuk Exp $"; +static const char rcsid[] = "$Id: ypxfr.c,v 1.17 1998/03/07 08:59:37 kukuk Exp $"; #endif #ifdef HAVE_CONFIG_H #include #endif -#include /* Ultrix needs this */ +#include /* Ultrix needs this */ #include "system.h" #include @@ -46,7 +46,7 @@ #include #include #ifndef LOG_DAEMON -#include /* for ULTRIX */ +#include /* for ULTRIX */ #endif #include #include @@ -54,7 +54,6 @@ #include #include #include -#include #include #if defined(HAVE_GETOPT_H) && defined(HAVE_GETOPT_LONG) #include @@ -66,6 +65,24 @@ #include "yp_msg.h" #include "ypxfr.h" +#if defined(HAVE_LIBGDBM) +#include + +#define ypdb_store gdbm_store +#define YPDB_REPLACE GDBM_REPLACE +#define ypdb_close gdbm_close +#define ypdb_fetch gdbm_fetch +static GDBM_FILE dbm; +#elif defined (HAVE_NDBM) +#include + +#define ypdb_store dbm_store +#define YPDB_REPLACE DBM_REPLACE +#define ypdb_close dbm_close +#define ypdb_fetch dbm_fetch +static DBM *dbm; +#endif + #ifndef HAVE_STRDUP #include #endif @@ -85,77 +102,97 @@ #ifdef __NetBSD__ /* is missing the prototype */ -int callrpc(char *host, u_long prognum, u_long versnum, u_long procnum, - xdrproc_t inproc, char *in, xdrproc_t outproc, char *out); +int callrpc (char *host, u_long prognum, u_long versnum, u_long procnum, + xdrproc_t inproc, char *in, xdrproc_t outproc, char *out); #endif static char *path_ypdb = YPMAPDIR; -static char SourceHost[MAXHOSTNAMELEN], *TargetDomain=NULL, *SourceDomain=NULL; +static char SourceHost[MAXHOSTNAMELEN], *TargetDomain = NULL, *SourceDomain = NULL; static struct in_addr IpAddress; -static int Force=0, NoClear=0, TaskId=0, ProgramNumber=0, PortNumber=0; -static GDBM_FILE dbm; +static int Force = 0, NoClear = 0, TaskId = 0, ProgramNumber = 0, PortNumber = 0; -int debug_flag=0; +int debug_flag = 0; -static char *ypxfr_err_string(enum ypxfrstat error) +static char * +ypxfr_err_string (enum ypxfrstat error) { - switch(error) + switch (error) { - case YPXFR_SUCC: return "Success"; - case YPXFR_AGE: return "Master's version not newer"; - case YPXFR_NOMAP: return "Can't find server for map"; - case YPXFR_NODOM: return "Domain not supported"; - case YPXFR_RSRC: return "Local resource alloc failure"; - case YPXFR_RPC: return "RPC failure talking to server"; - case YPXFR_MADDR: return "Can't get master address"; - case YPXFR_YPERR: return "YP server/map db error"; - case YPXFR_BADARGS: return "Request arguments bad"; - case YPXFR_DBM: return "Local dbm operation failed"; - case YPXFR_FILE: return "Local file I/O operation failed"; - case YPXFR_SKEW: return "Map version skew during transfer"; - case YPXFR_CLEAR: return "Can't send \"Clear\" req to local ypserv"; - case YPXFR_FORCE: return "No local order number in map use -f flag."; - case YPXFR_XFRERR: return "ypxfr error"; - case YPXFR_REFUSED: return "Transfer request refused by ypserv"; + case YPXFR_SUCC: + return "Success"; + case YPXFR_AGE: + return "Master's version not newer"; + case YPXFR_NOMAP: + return "Can't find server for map"; + case YPXFR_NODOM: + return "Domain not supported"; + case YPXFR_RSRC: + return "Local resource alloc failure"; + case YPXFR_RPC: + return "RPC failure talking to server"; + case YPXFR_MADDR: + return "Can't get master address"; + case YPXFR_YPERR: + return "YP server/map db error"; + case YPXFR_BADARGS: + return "Request arguments bad"; + case YPXFR_DBM: + return "Local dbm operation failed"; + case YPXFR_FILE: + return "Local file I/O operation failed"; + case YPXFR_SKEW: + return "Map version skew during transfer"; + case YPXFR_CLEAR: + return "Can't send \"Clear\" req to local ypserv"; + case YPXFR_FORCE: + return "No local order number in map use -f flag."; + case YPXFR_XFRERR: + return "ypxfr error"; + case YPXFR_REFUSED: + return "Transfer request refused by ypserv"; } return "Unknown Error, should not happen"; } /* NetBSD has a different prototype in struct ypall_callback */ #if defined(__NetBSD__) -static int ypxfr_foreach(u_long status, char *key, int keylen, - char *val, int vallen, void *data) +static int +ypxfr_foreach (u_long status, char *key, int keylen, + char *val, int vallen, void *data) #else -static int ypxfr_foreach(int status, char *key, int keylen, - char *val, int vallen, int *data) +static int +ypxfr_foreach (int status, char *key, int keylen, + char *val, int vallen, int *data) #endif { datum outKey, outData; - if(debug_flag>1) + if (debug_flag > 1) { if (keylen != 0 && vallen != 0) - yp_msg("ypxfr_foreach: key=%.*s, val=%.*s\n",keylen, key, vallen, val); + yp_msg ("ypxfr_foreach: key=%.*s, val=%.*s\n", keylen, key, vallen, val); else - yp_msg("ypxfr_foreach: empty key/value pair!\n"); + yp_msg ("ypxfr_foreach: empty key/value pair!\n"); } - if (status==YP_NOMORE) + if (status == YP_NOMORE) return 0; - if (status!=YP_TRUE) + if (status != YP_TRUE) { - int s=ypprot_err(status); - yp_msg("%s\n", yperr_string(s)); + int s = ypprot_err (status); + yp_msg ("%s\n", yperr_string (s)); return 1; } if (keylen != 0) { - outKey.dptr=keylen?key:""; outKey.dsize=keylen; - outData.dptr=vallen?val:""; outData.dsize=vallen; - if(gdbm_store(dbm,outKey, outData, GDBM_REPLACE) != GDBM_NO_ERROR) + outKey.dptr = keylen ? key : ""; + outKey.dsize = keylen; + outData.dptr = vallen ? val : ""; + outData.dsize = vallen; + if (ypdb_store (dbm, outKey, outData, YPDB_REPLACE) != 0) return 1; } @@ -163,24 +200,25 @@ } /* -** Collects all the answers for our query for hosts running ypserv -*/ + ** Collects all the answers for our query for hosts running ypserv + */ static char *ypserver = NULL; -static bool_t eachresult(bool_t *resp, struct sockaddr_in *addr) +static bool_t +eachresult (bool_t * resp, struct sockaddr_in *addr) { if (*resp) { struct hostent *h; - h = gethostbyaddr((char *) &addr->sin_addr.s_addr, - sizeof(addr->sin_addr.s_addr), AF_INET); + h = gethostbyaddr ((char *) &addr->sin_addr.s_addr, + sizeof (addr->sin_addr.s_addr), AF_INET); if (ypserver == NULL) - ypserver=strdup(h->h_name); + ypserver = strdup (h->h_name); if (debug_flag) - { - yp_msg("Find running ypserv on %s\n", h->h_name); - } + { + yp_msg ("Find running ypserv on %s\n", h->h_name); + } return 1; } else @@ -190,44 +228,45 @@ } /* -** At first, use the yp lib routines. If we are not bound to a server, -** do a broadcast and search one. -*/ -static int __yp_master( char *domain, char *map, char **master) + ** At first, use the yp lib routines. If we are not bound to a server, + ** do a broadcast and search one. + */ +static int +__yp_master (char *domain, char *map, char **master) { static ypresp_master res; ypreq_nokey req; int status; - if((status=yp_master(domain, map, master))!=0) + if ((status = yp_master (domain, map, master)) != 0) { bool_t out; - status = clnt_broadcast(YPPROG, YPVERS, YPPROC_DOMAIN_NONACK, - (xdrproc_t) xdr_domainname, (void *)&domain, - (xdrproc_t) xdr_bool, (void *)&out, - (resultproc_t) eachresult); + status = clnt_broadcast (YPPROG, YPVERS, YPPROC_DOMAIN_NONACK, + (xdrproc_t) xdr_domainname, (void *) &domain, + (xdrproc_t) xdr_bool, (void *) &out, + (resultproc_t) eachresult); if (status != RPC_SUCCESS) { - yp_msg("broadcast: %s.", clnt_sperrno(status)); + yp_msg ("broadcast: %s.", clnt_sperrno (status)); } else { req.domain = domain; req.map = map; - if ((status = callrpc(ypserver,YPPROG,YPVERS,YPPROC_MASTER, - (xdrproc_t)xdr_ypreq_nokey, (void*) &req, - (xdrproc_t)xdr_ypresp_master, (void*) &res)) + if ((status = callrpc (ypserver, YPPROG, YPVERS, YPPROC_MASTER, + (xdrproc_t) xdr_ypreq_nokey, (void *) &req, + (xdrproc_t) xdr_ypresp_master, (void *) &res)) != RPC_SUCCESS) { - yp_msg("failed to send 'ypproc_master' to %s's ypserv: %s", - ypserver, clnt_sperrno((enum clnt_stat) status)); + yp_msg ("failed to send 'ypproc_master' to %s's ypserv: %s", + ypserver, clnt_sperrno ((enum clnt_stat) status)); } else { - if((res.peer != NULL) && (strlen(res.peer) > 0)) - *master=strdup(res.peer); + if ((res.peer != NULL) && (strlen (res.peer) > 0)) + *master = strdup (res.peer); else return 1; } @@ -236,14 +275,15 @@ return status; } -static enum ypxfrstat ypxfr(char *mapName) +static enum ypxfrstat +ypxfr (char *mapName) { - int localOrderNum=0; - int masterOrderNum=0; + int localOrderNum = 0; + int masterOrderNum = 0; char *masterName = NULL; struct ypall_callback callback; - char dbName[MAXPATHLEN+1]; - char dbName2[MAXPATHLEN+1]; + char dbName[MAXPATHLEN + 1]; + char dbName2[MAXPATHLEN + 1]; CLIENT *clnt_tcp, *clnt_udp; struct sockaddr_in sockaddr, sockaddr_udp; struct ypreq_nokey req_nokey; @@ -257,258 +297,277 @@ char orderNum[12]; int result; int sock; - struct timeval TIMEOUT={25,0}; + struct timeval TIMEOUT = + {25, 0}; /* - ** Get the Master hostname for the map, if no explicit - ** sourcename is given. - */ + ** Get the Master hostname for the map, if no explicit + ** sourcename is given. + */ if (SourceHost[0] == '\0') { - if (__yp_master(SourceDomain, mapName, &masterName)) + if (__yp_master (SourceDomain, mapName, &masterName)) return YPXFR_MADDR; - strcpy(SourceHost,masterName); + strcpy (SourceHost, masterName); } /* - ** Build a connection to the host with the master map, not the - ** the nearest ypserv, because this map could be out of date. - */ - memset(&sockaddr, '\0', sizeof(sockaddr)); - sockaddr.sin_family=AF_INET; + ** Build a connection to the host with the master map, not the + ** the nearest ypserv, because this map could be out of date. + */ + memset (&sockaddr, '\0', sizeof (sockaddr)); + sockaddr.sin_family = AF_INET; { - struct hostent *h=gethostbyname(SourceHost); + struct hostent *h = gethostbyname (SourceHost); if (!h) return YPXFR_RSRC; - memcpy(&sockaddr.sin_addr, h->h_addr, sizeof sockaddr.sin_addr); + memcpy (&sockaddr.sin_addr, h->h_addr, sizeof sockaddr.sin_addr); } - memcpy(&sockaddr_udp, &sockaddr, sizeof(sockaddr)); + memcpy (&sockaddr_udp, &sockaddr, sizeof (sockaddr)); - sock=RPC_ANYSOCK; - clnt_tcp=clnttcp_create(&sockaddr, YPPROG, YPVERS, &sock, 0, 0); - if (clnt_tcp==NULL) + sock = RPC_ANYSOCK; + clnt_tcp = clnttcp_create (&sockaddr, YPPROG, YPVERS, &sock, 0, 0); + if (clnt_tcp == NULL) { - clnt_pcreateerror("YPXFR"); + clnt_pcreateerror ("YPXFR"); return YPXFR_RPC; } - sock=RPC_ANYSOCK; - clnt_udp=clntudp_create(&sockaddr_udp, YPPROG, YPVERS, TIMEOUT, &sock); - if (clnt_udp==NULL) + sock = RPC_ANYSOCK; + clnt_udp = clntudp_create (&sockaddr_udp, YPPROG, YPVERS, TIMEOUT, &sock); + if (clnt_udp == NULL) { - clnt_pcreateerror("YPXFR"); + clnt_pcreateerror ("YPXFR"); return YPXFR_RPC; } - req_nokey.domain=SourceDomain; - req_nokey.map=mapName; - if ((resp_order=ypproc_order_2(&req_nokey, clnt_udp))==NULL) + req_nokey.domain = SourceDomain; + req_nokey.map = mapName; + if ((resp_order = ypproc_order_2 (&req_nokey, clnt_udp)) == NULL) { - clnt_perror(clnt_udp, "masterOrderNum"); - masterOrderNum=0x7fffffff; + clnt_perror (clnt_udp, "masterOrderNum"); + masterOrderNum = 0x7fffffff; } else { - masterOrderNum=resp_order->ordernum; - xdr_free((xdrproc_t) xdr_ypresp_order, (char *)resp_order); + masterOrderNum = resp_order->ordernum; + xdr_free ((xdrproc_t) xdr_ypresp_order, (char *) resp_order); } if (masterName == NULL) { - req_nokey.domain=SourceDomain; - req_nokey.map=mapName; - if ((resp_master=ypproc_master_2(&req_nokey, clnt_udp))==NULL) + req_nokey.domain = SourceDomain; + req_nokey.map = mapName; + if ((resp_master = ypproc_master_2 (&req_nokey, clnt_udp)) == NULL) { - clnt_perror(clnt_udp, "ypmaster"); + clnt_perror (clnt_udp, "ypmaster"); } else { - masterName = strdup(resp_master->peer); - xdr_free((xdrproc_t) xdr_ypresp_master, (char *)resp_master); + masterName = strdup (resp_master->peer); + xdr_free ((xdrproc_t) xdr_ypresp_master, (char *) resp_master); } } /* - ** If we doesn't force the map, look, if the new map is really newer - */ + ** If we doesn't force the map, look, if the new map is really newer + */ if (!Force) { datum inKey, inVal; - if(strlen(path_ypdb)+strlen(TargetDomain)+strlen(mapName)+3 < MAXPATHLEN) - sprintf(dbName, "%s/%s/%s", path_ypdb, TargetDomain, mapName); + if (strlen (path_ypdb) + strlen (TargetDomain) + strlen (mapName) + 3 < MAXPATHLEN) + sprintf (dbName, "%s/%s/%s", path_ypdb, TargetDomain, mapName); else { - yp_msg("ERROR: Path to long: %s/%s/%s\n",path_ypdb, TargetDomain,mapName); + yp_msg ("ERROR: Path to long: %s/%s/%s\n", path_ypdb, TargetDomain, mapName); return YPXFR_RSRC; } - if ((dbm=gdbm_open(dbName,0,GDBM_READER, 0600, NULL))==NULL) + +#if defined(HAVE_LIBGDBM) + dbm = gdbm_open (dbName, 0, GDBM_READER, 0600, NULL); +#elif defined(HAVE_NDBM) + dbm = dbm_open (dbName, O_CREAT|O_RDWR, 0600); +#endif + if (dbm == NULL) { - yp_msg("Cannot open old %s - ignored.\n", dbName); - localOrderNum=0; + yp_msg ("Cannot open old %s - ignored.\n", dbName); + localOrderNum = 0; } else { - inKey.dptr="YP_LAST_MODIFIED"; inKey.dsize=strlen(inKey.dptr); - inVal=gdbm_fetch(dbm,inKey); + inKey.dptr = "YP_LAST_MODIFIED"; + inKey.dsize = strlen (inKey.dptr); + inVal = ypdb_fetch (dbm, inKey); if (inVal.dptr) { int i; - char *d=inVal.dptr; - for (i=0; i1) - yp_msg("masterOrderNum=%d, localOrderNum=%d\n", - masterOrderNum, localOrderNum); - if (localOrderNum>=masterOrderNum) return YPXFR_AGE; + if (debug_flag > 1) + yp_msg ("masterOrderNum=%d, localOrderNum=%d\n", + masterOrderNum, localOrderNum); + if (localOrderNum >= masterOrderNum) + return YPXFR_AGE; } - if(strlen(path_ypdb)+strlen(TargetDomain)+strlen(mapName)+4 < MAXPATHLEN) - sprintf(dbName, "%s/%s/%s~", path_ypdb, TargetDomain, mapName); + if (strlen (path_ypdb) + strlen (TargetDomain) + strlen (mapName) + 4 < MAXPATHLEN) + sprintf (dbName, "%s/%s/%s~", path_ypdb, TargetDomain, mapName); else { - yp_msg("ERROR: Path to long: %s/%s/%s~\n",path_ypdb, TargetDomain,mapName); + yp_msg ("ERROR: Path to long: %s/%s/%s~\n", path_ypdb, TargetDomain, mapName); return YPXFR_RSRC; } /* - ** Try to use ypxfrd for getting the new map. If it fails, use the old - ** method. - */ - if ((result=ypxfrd_transfer(masterName, mapName, TargetDomain, dbName))!=0) + ** Try to use ypxfrd for getting the new map. If it fails, use the old + ** method. + */ + if ((result = ypxfrd_transfer (masterName, mapName, TargetDomain, dbName)) != 0) { - if ((dbm=gdbm_open(dbName,0,GDBM_NEWDB,0600,NULL))==NULL) + +#if defined(HAVE_LIBGDBM) + dbm = gdbm_open (dbName, 0, GDBM_NEWDB, 0600, NULL); +#elif defined(HAVE_NDBM) + dbm = dbm_open (dbName, O_CREAT|O_RDWR, 0600); +#endif + if (dbm == NULL) { - yp_msg("Cannot open %s\n", dbName); + yp_msg ("Cannot open %s\n", dbName); return YPXFR_DBM; } - outKey.dptr="YP_MASTER_NAME"; outKey.dsize=strlen(outKey.dptr); - outData.dptr=masterName; outData.dsize=strlen(outData.dptr); - if(gdbm_store(dbm,outKey, outData, GDBM_REPLACE) != GDBM_NO_ERROR) + outKey.dptr = "YP_MASTER_NAME"; + outKey.dsize = strlen (outKey.dptr); + outData.dptr = masterName; + outData.dsize = strlen (outData.dptr); + if (ypdb_store (dbm, outKey, outData, YPDB_REPLACE) != 0) { - gdbm_close(dbm); - unlink(dbName); + ypdb_close (dbm); + unlink (dbName); return YPXFR_DBM; } - sprintf(orderNum, "%d", masterOrderNum); - outKey.dptr="YP_LAST_MODIFIED"; outKey.dsize=strlen(outKey.dptr); - outData.dptr=orderNum; outData.dsize=strlen(outData.dptr); - if(gdbm_store(dbm, outKey, outData, GDBM_REPLACE) != GDBM_NO_ERROR) + sprintf (orderNum, "%d", masterOrderNum); + outKey.dptr = "YP_LAST_MODIFIED"; + outKey.dsize = strlen (outKey.dptr); + outData.dptr = orderNum; + outData.dsize = strlen (outData.dptr); + if (ypdb_store (dbm, outKey, outData, YPDB_REPLACE) != 0) { - gdbm_close(dbm); - unlink(dbName); + ypdb_close (dbm); + unlink (dbName); return YPXFR_DBM; } /* - ** Get the YP_INTERDOMAIN field. This is needed from the SunOS ypserv. - ** We ignore this, since we have the "dns" option. But a Sun could be - ** a NIS slave server and request the map from us. - */ - req_key.domain=SourceDomain; - req_key.map=mapName; - req_key.key.keydat_val="YP_INTERDOMAIN"; - req_key.key.keydat_len=strlen("YP_INTERDOMAIN"); - if ((resp_val=ypproc_match_2(&req_key, clnt_udp))==NULL) + ** Get the YP_INTERDOMAIN field. This is needed from the SunOS ypserv. + ** We ignore this, since we have the "dns" option. But a Sun could be + ** a NIS slave server and request the map from us. + */ + req_key.domain = SourceDomain; + req_key.map = mapName; + req_key.key.keydat_val = "YP_INTERDOMAIN"; + req_key.key.keydat_len = strlen ("YP_INTERDOMAIN"); + if ((resp_val = ypproc_match_2 (&req_key, clnt_udp)) == NULL) { - clnt_perror(clnt_udp, "yproc_match"); + clnt_perror (clnt_udp, "yproc_match"); } else { if (resp_val->stat == YP_TRUE) { - outKey.dptr="YP_INTERDOMAIN"; - outKey.dsize=strlen(outKey.dptr); - outData.dptr=""; - outData.dsize=0; - if (gdbm_store(dbm, outKey, outData, GDBM_REPLACE) != GDBM_NO_ERROR) + outKey.dptr = "YP_INTERDOMAIN"; + outKey.dsize = strlen (outKey.dptr); + outData.dptr = ""; + outData.dsize = 0; + if (ypdb_store (dbm, outKey, outData, YPDB_REPLACE) != 0) { - gdbm_close(dbm); - unlink(dbName); + ypdb_close (dbm); + unlink (dbName); return YPXFR_DBM; } } - xdr_free((xdrproc_t) xdr_ypresp_val, (char *)resp_val); + xdr_free ((xdrproc_t) xdr_ypresp_val, (char *) resp_val); } /* Get the YP_SECURE field. */ - req_key.domain=SourceDomain; - req_key.map=mapName; - req_key.key.keydat_val="YP_SECURE"; - req_key.key.keydat_len=strlen("YP_SECURE"); - if ((resp_val=ypproc_match_2(&req_key, clnt_udp))==NULL) + req_key.domain = SourceDomain; + req_key.map = mapName; + req_key.key.keydat_val = "YP_SECURE"; + req_key.key.keydat_len = strlen ("YP_SECURE"); + if ((resp_val = ypproc_match_2 (&req_key, clnt_udp)) == NULL) { - clnt_perror(clnt_udp, "yproc_match"); + clnt_perror (clnt_udp, "yproc_match"); } else { if (resp_val->stat == YP_TRUE) { - outKey.dptr="YP_SECURE"; - outKey.dsize=strlen(outKey.dptr); - outData.dptr=""; - outData.dsize=0; - if (gdbm_store(dbm, outKey, outData, GDBM_REPLACE) != GDBM_NO_ERROR) + outKey.dptr = "YP_SECURE"; + outKey.dsize = strlen (outKey.dptr); + outData.dptr = ""; + outData.dsize = 0; + if (ypdb_store (dbm, outKey, outData, YPDB_REPLACE) != 0) { - gdbm_close(dbm); - unlink(dbName); + ypdb_close (dbm); + unlink (dbName); return YPXFR_DBM; } } - xdr_free((xdrproc_t) xdr_ypresp_val, (char *)resp_val); + xdr_free ((xdrproc_t) xdr_ypresp_val, (char *) resp_val); } - callback.foreach=ypxfr_foreach; - callback.data=NULL; + callback.foreach = ypxfr_foreach; + callback.data = NULL; { - req_nokey.domain=SourceDomain; - req_nokey.map=mapName; - xdr_ypall_callback=&callback; - if ((resp_all=ypproc_all_2(&req_nokey, clnt_tcp))==NULL) + req_nokey.domain = SourceDomain; + req_nokey.map = mapName; + xdr_ypall_callback = &callback; + if ((resp_all = ypproc_all_2 (&req_nokey, clnt_tcp)) == NULL) { - clnt_perror(clnt_tcp, "ypall"); + clnt_perror (clnt_tcp, "ypall"); } else { - switch (resp_all->ypresp_all_u.val.stat) - { - case YP_TRUE: - case YP_NOMORE: - result=0; - break; - default: - result=ypprot_err(resp_all->ypresp_all_u.val.stat); - } - clnt_freeres(clnt_tcp, (xdrproc_t) ypxfr_xdr_ypresp_all, (void *)resp_all); + switch (resp_all->ypresp_all_u.val.stat) + { + case YP_TRUE: + case YP_NOMORE: + result = 0; + break; + default: + result = ypprot_err (resp_all->ypresp_all_u.val.stat); + } + clnt_freeres (clnt_tcp, (xdrproc_t) ypxfr_xdr_ypresp_all, (void *) resp_all); } } - clnt_destroy(clnt_tcp); + clnt_destroy (clnt_tcp); - gdbm_close(dbm); + ypdb_close (dbm); } - if(strlen(path_ypdb)+strlen(TargetDomain)+strlen(mapName)+3 < MAXPATHLEN) - sprintf(dbName2, "%s/%s/%s", path_ypdb, TargetDomain, mapName); + if (strlen (path_ypdb) + strlen (TargetDomain) + strlen (mapName) + 3 < MAXPATHLEN) + sprintf (dbName2, "%s/%s/%s", path_ypdb, TargetDomain, mapName); else { - yp_msg("ERROR: Path to long: %s/%s/%s\n",path_ypdb,TargetDomain,mapName); + yp_msg ("ERROR: Path to long: %s/%s/%s\n", path_ypdb, TargetDomain, mapName); return YPXFR_RSRC; } - unlink(dbName2); - rename(dbName, dbName2); + unlink (dbName2); + rename (dbName, dbName2); if (!NoClear) { @@ -516,70 +575,73 @@ char *out = NULL; int stat; - if ((stat = callrpc("localhost",YPPROG,YPVERS,YPPROC_CLEAR, - (xdrproc_t)xdr_void, &in, - (xdrproc_t)xdr_void, out)) != RPC_SUCCESS) + if ((stat = callrpc ("localhost", YPPROG, YPVERS, YPPROC_CLEAR, + (xdrproc_t) xdr_void, &in, + (xdrproc_t) xdr_void, out)) != RPC_SUCCESS) { - yp_msg("failed to send 'clear' to local ypserv: %s", - clnt_sperrno((enum clnt_stat) stat)); + yp_msg ("failed to send 'clear' to local ypserv: %s", + clnt_sperrno ((enum clnt_stat) stat)); return YPXFR_CLEAR; } } - return result==0?YPXFR_SUCC:YPXFR_YPERR; + return result == 0 ? YPXFR_SUCC : YPXFR_YPERR; } -void Usage(int exit_code) +void +Usage (int exit_code) { - fprintf(stderr,"usage: ypxfr [-f] [-c] [-d target domain] [-h source host] [-s source domain]\n"); - fprintf(stderr," [-C taskid program-number ipaddr port] [-p yp_path] mapname ...\n"); - fprintf(stderr," ypxfr --version\n"); - fprintf(stderr,"\n"); - fprintf(stderr,"where\n"); - fprintf(stderr,"\t-f forces transfer even if the master's copy is not newer.\n"); - fprintf(stderr,"\thost may be either a name or an internet\n"); - fprintf(stderr,"\t address of form ww.xx.yy.zz\n"); - fprintf(stderr,"\t-c inhibits sending a \"Clear map\" message to the local ypserv.\n"); - fprintf(stderr,"\t-C is used by ypserv to pass callback information.\n"); - exit(exit_code); + fprintf (stderr, "usage: ypxfr [-f] [-c] [-d target domain] [-h source host] [-s source domain]\n"); + fprintf (stderr, " [-C taskid program-number ipaddr port] [-p yp_path] mapname ...\n"); + fprintf (stderr, " ypxfr --version\n"); + fprintf (stderr, "\n"); + fprintf (stderr, "where\n"); + fprintf (stderr, "\t-f forces transfer even if the master's copy is not newer.\n"); + fprintf (stderr, "\thost may be either a name or an internet\n"); + fprintf (stderr, "\t address of form ww.xx.yy.zz\n"); + fprintf (stderr, "\t-c inhibits sending a \"Clear map\" message to the local ypserv.\n"); + fprintf (stderr, "\t-C is used by ypserv to pass callback information.\n"); + exit (exit_code); } -int main (int argc, char **argv) +int +main (int argc, char **argv) { static char res; if (argc < 2) - Usage(1); + Usage (1); - if(!isatty(fileno(stderr))) - openlog("ypxfr", LOG_PID, LOG_DAEMON); + if (!isatty (fileno (stderr))) + openlog ("ypxfr", LOG_PID, LOG_DAEMON); else - debug_flag=1; + debug_flag = 1; - memset(SourceHost, '\0', sizeof(SourceHost)); + memset (SourceHost, '\0', sizeof (SourceHost)); - while(1) + while (1) { int c; int option_index = 0; static struct option long_options[] = { - {"version", no_argument, NULL, '\255'}, + {"version", no_argument, NULL, '\255'}, {"debug", no_argument, NULL, '\254'}, - {"help", no_argument, NULL, 'u'}, - {"usage", no_argument, NULL, 'u'}, + {"help", no_argument, NULL, 'u'}, + {"usage", no_argument, NULL, 'u'}, {"path", required_argument, NULL, 'p'}, - {NULL, 0, NULL, '\0'} + {NULL, 0, NULL, '\0'} }; - c=getopt_long(argc, argv, "ufcd:h:p:s:C:S",long_options, &option_index); - if (c==EOF) break; + c = getopt_long (argc, argv, "ufcd:h:p:s:C:S", long_options, &option_index); + if (c == EOF) + break; switch (c) { case 'p': path_ypdb = optarg; - if (debug_flag) - yp_msg("Using database directory: %s\n", path_ypdb); - break; + if (debug_flag) + yp_msg ("Using database directory: %s\n", path_ypdb); + break; case 'f': Force++; break; @@ -587,48 +649,48 @@ NoClear++; break; case 'd': - TargetDomain=optarg; + TargetDomain = optarg; break; case 'h': - strncpy(SourceHost,optarg,sizeof (SourceHost) -1); - SourceHost[sizeof (SourceHost) -1] = '\0'; + strncpy (SourceHost, optarg, sizeof (SourceHost) - 1); + SourceHost[sizeof (SourceHost) - 1] = '\0'; break; case 's': - SourceDomain=optarg; + SourceDomain = optarg; break; case 'C': - if(optind+3 > argc) + if (optind + 3 > argc) { - Usage(1); + Usage (1); break; } - TaskId=atoi(optarg); - ProgramNumber=atoi(argv[optind++]); - IpAddress.s_addr=inet_addr(argv[optind++]); - PortNumber=atoi(argv[optind++]); + TaskId = atoi (optarg); + ProgramNumber = atoi (argv[optind++]); + IpAddress.s_addr = inet_addr (argv[optind++]); + PortNumber = atoi (argv[optind++]); break; case 'u': - Usage(0); + Usage (0); break; case '\254': - debug_flag=2; + debug_flag = 2; break; case '\255': - fprintf(stderr,"ypxfr - NYS YP Server version %s\n",version); - exit(0); + fprintf (stderr, "ypxfr - NYS YP Server version %s\n", version); + exit (0); default: - Usage(1); + Usage (1); break; } } - argc-=optind; - argv+=optind; + argc -= optind; + argv += optind; if (!TargetDomain) - yp_get_default_domain(&TargetDomain); + yp_get_default_domain (&TargetDomain); if (!SourceDomain) - SourceDomain=TargetDomain; + SourceDomain = TargetDomain; for (; *argv; argv++) @@ -636,22 +698,22 @@ enum ypxfrstat y; /* - ** Start the map Transfer - */ - if ((y=ypxfr(*argv))!=YPXFR_SUCC) + ** Start the map Transfer + */ + if ((y = ypxfr (*argv)) != YPXFR_SUCC) { /* - ** Don't syslog "Master's version not newer" as that is - ** the common case. - */ + ** Don't syslog "Master's version not newer" as that is + ** the common case. + */ if (debug_flag || y != YPXFR_AGE) - yp_msg("ypxfr: %s\n", ypxfr_err_string(y)); + yp_msg ("ypxfr: %s\n", ypxfr_err_string (y)); } /* - ** Now send the status to the yppush program, so it can display a - ** message for the sysop and do not timeout. - */ + ** Now send the status to the yppush program, so it can display a + ** message for the sysop and do not timeout. + */ if (TaskId) { struct sockaddr_in addr; @@ -659,30 +721,32 @@ CLIENT *clnt; int s; ypresp_xfr resp; - static struct timeval tv={10,0}; + static struct timeval tv = + {10, 0}; - memset(&addr, '\0', sizeof addr); - addr.sin_addr=IpAddress; - addr.sin_port=htons(PortNumber); - addr.sin_family=AF_INET; - wait.tv_sec=25; wait.tv_usec=0; - s=RPC_ANYSOCK; + memset (&addr, '\0', sizeof addr); + addr.sin_addr = IpAddress; + addr.sin_port = htons (PortNumber); + addr.sin_family = AF_INET; + wait.tv_sec = 25; + wait.tv_usec = 0; + s = RPC_ANYSOCK; - clnt=clntudp_create(&addr, ProgramNumber, 1, wait, &s); + clnt = clntudp_create (&addr, ProgramNumber, 1, wait, &s); if (!clnt) { - clnt_pcreateerror("ypxfr_callback"); + clnt_pcreateerror ("ypxfr_callback"); continue; } - resp.transid=TaskId; - resp.xfrstat=y; + resp.transid = TaskId; + resp.xfrstat = y; - if(clnt_call(clnt, 1, (xdrproc_t) xdr_ypresp_xfr, (void *) &resp, - (xdrproc_t) xdr_void, &res, tv) != RPC_SUCCESS) - clnt_perror(clnt, "ypxfr_callback"); + if (clnt_call (clnt, 1, (xdrproc_t) xdr_ypresp_xfr, (void *) &resp, + (xdrproc_t) xdr_void, &res, tv) != RPC_SUCCESS) + clnt_perror (clnt, "ypxfr_callback"); - clnt_destroy(clnt); + clnt_destroy (clnt); } } return 0; diff -u -r --new-file ypserv-1.2.8/ypxfrd.c ypserv-1.3.0/ypxfrd.c --- ypserv-1.2.8/ypxfrd.c Fri Jan 9 21:41:43 1998 +++ ypserv-1.3.0/ypxfrd.c Wed Feb 4 21:49:19 1998 @@ -24,7 +24,7 @@ */ #ifndef LINT -static const char rcsid[] = "$Id: ypxfrd.c,v 1.7 1998/01/09 20:41:43 kukuk Exp $"; +static const char rcsid[] = "$Id: ypxfrd.c,v 1.8 1998/02/04 20:49:19 kukuk Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -82,7 +82,6 @@ int children = 0; int dns_flag = 0; int debug_flag = 0; -int sunos_kludge_flag = 1; int xfr_check_port = 1; int _rpcpmstart = 0; int _rpcfdtype = 0; diff -u -r --new-file ypserv-1.2.8/ypxfrd_getmap.c ypserv-1.3.0/ypxfrd_getmap.c --- ypserv-1.2.8/ypxfrd_getmap.c Fri Jan 9 21:41:43 1998 +++ ypserv-1.3.0/ypxfrd_getmap.c Fri Mar 6 21:01:12 1998 @@ -22,7 +22,7 @@ */ #ifndef LINT -static const char rcsid[] = "$Id: ypxfrd_getmap.c,v 1.8 1998/01/09 20:41:43 kukuk Exp $"; +static const char rcsid[] = "$Id: ypxfrd_getmap.c,v 1.9 1998/03/06 20:01:12 kukuk Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -147,8 +147,18 @@ req.xfrmap = map; req.xfrdomain = domain; req.xfrmap_filename = map; +#if defined(HAVE_LIBGDBM) req.xfr_db_type = XFR_DB_GNU_GDBM; req.xfr_byte_order = XFR_ENDIAN_LITTLE; +#elif defined (HAVE_NDBM) +#if defined(__sun__) || defined (sun) + req.xfr_db_type = XFR_DB_NDBM; + req.xfr_byte_order = XFR_ENDIAN_BIG; +#else + req.xfr_db_type = XFR_DB_BSD_NDBM; + req.xfr_byte_order = XFR_ENDIAN_ANY; +#endif +#endif memset((char *)&resp, 0, sizeof(resp)); if ((clnt = clnt_create(host, YPXFRD_FREEBSD_PROG, diff -u -r --new-file ypserv-1.2.8/ypxfrd_server.c ypserv-1.3.0/ypxfrd_server.c --- ypserv-1.2.8/ypxfrd_server.c Fri May 2 18:34:17 1997 +++ ypserv-1.3.0/ypxfrd_server.c Fri Mar 6 21:01:12 1998 @@ -1,7 +1,7 @@ /* ** ypxfrd_server.c - ypxfrd server routines. ** -** Copyright (c) 1996, 1997 Thorsten Kukuk +** Copyright (c) 1996, 1997, 1998 Thorsten Kukuk ** ** This file is part of the NYS YP Server. ** @@ -24,7 +24,7 @@ */ #ifndef LINT -static const char rcsid[] = "$Id: ypxfrd_server.c,v 1.6 1997/05/02 16:34:17 kukuk Exp $"; +static const char rcsid[] = "$Id: ypxfrd_server.c,v 1.7 1998/03/06 20:01:12 kukuk Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -149,6 +149,14 @@ #if defined(HAVE_LIBGDBM) if ((argp->xfr_db_type != XFR_DB_GNU_GDBM) && (argp->xfr_db_type != XFR_DB_ANY)) +#elif defined (HAVE_LIBNDBM) +#if defined(__sun__) || defined(sun) + if ((argp->xfr_db_type != XFR_DB_NDBM) && + (argp->xfr_db_type != XFR_DB_ANY)) +#else + if ((argp->xfr_db_type != XFR_DB_BSD_NDBM) && + (argp->xfr_db_type != XFR_DB_ANY)) +#endif /* sun */ #else if (argp->xfr_db_type != XFR_DB_ANY) #endif