home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume42 / tcp_wrappers / patch02 next >
Encoding:
Internet Message Format  |  1994-03-30  |  40.9 KB

  1. From: wietse@wzv.win.tue.nl (Wietse Venema)
  2. Newsgroups: comp.sources.misc
  3. Subject: v42i036:  tcp_wrappers - TCP/IP daemon wrappers v6.0, Patch02
  4. Date: 30 Mar 1994 15:27:04 -0600
  5. Organization: Eindhoven University of Technology, The Netherlands
  6. Sender: kent@sparky.sterling.com
  7. Approved: kent@sparky.sterling.com
  8. Message-ID: <2ncqr8$f8u@sparky.sterling.com>
  9. X-Md4-Signature: 35809842629fc95c3de6e2d8c4af8691
  10.  
  11. Submitted-by: wietse@wzv.win.tue.nl (Wietse Venema)
  12. Posting-number: Volume 42, Issue 36
  13. Archive-name: tcp_wrappers/patch02
  14. Environment: UNIX, INET
  15. Patch-To: tcp_wrappers: Volume 39, Issue 110-113
  16.  
  17. With these programs you can monitor and control who connects to your
  18. TFTP, EXEC, FTP, RSH, TELNET, RLOGIN, FINGER, and SYSTAT network
  19. daemons, and many others. The programs run on a wide variety of BSD
  20. and System-V systems, and can be installed without change to system
  21. software or configuration files.
  22.  
  23. This is a two-part update to the 6.1 version of last December.  After
  24. application of patch02 (this article) and patch03 (separate posting)
  25. the source will be at patchlevel 6.3.
  26.  
  27. A complete 6.3 source kit can be found on the primary archive site:
  28.  
  29.     ftp.win.tue.nl:/pub/security/tcp_wrappers_6.3.shar.Z
  30.  
  31. A copy is to appear soon in:
  32.  
  33.     cert.org:/pub/tools
  34.  
  35. Changes since release 6.1:
  36.  
  37.     - Portability: new Makefile rule sets for SCO and Pyramid OSx 5.1;
  38.       improved TLI support for Dynix/PTX; fix for Ultrix core dumps.
  39.  
  40.     - Features: compile-time option (APPEND_DOT) for faster DNS lookup
  41.       of already fully-qualified hostnames; a run-time option to enable
  42.       keepalives (useful when users reset or turn off the PC while
  43.       still connected), and an option to change the process nice value.
  44.  
  45. Good news: Sun patch 100804-03 for SunOS 4.1.x fixes the problem with
  46. the anti source-routing attack feature.
  47.  
  48. The libwrap.a library code should be binary compatible with release 6.1.
  49.  
  50.     Wietse Venema (wietse@wzv.win.tue.nl),
  51.     Department of Mathematics and Computing Science,
  52.     Eindhoven University of Technology,
  53.     The Netherlands.
  54.  
  55. *** ./BLURB-    Mon Dec 13 22:22:53 1993
  56. --- ./BLURB    Sat Feb  5 15:22:03 1994
  57. ***************
  58. *** 1,6 ****
  59. ! @(#) BLURB 1.15 93/12/13 22:22:51
  60.   
  61. ! This is the 6.1 version of the TCP/IP daemon wrapper package.
  62.   
  63.   With these programs you can monitor and control who connects to your
  64.   TFTP, EXEC, FTP, RSH, TELNET, RLOGIN, FINGER, and SYSTAT network
  65. --- 1,6 ----
  66. ! @(#) BLURB 1.17 94/02/05 15:22:01
  67.   
  68. ! This is the 6.2 version of the TCP/IP daemon wrapper package.
  69.   
  70.   With these programs you can monitor and control who connects to your
  71.   TFTP, EXEC, FTP, RSH, TELNET, RLOGIN, FINGER, and SYSTAT network
  72. ***************
  73. *** 11,23 ****
  74.   and do some sanity checks on the origin of the request. No information
  75.   is exchanged with the remote client process.
  76.   
  77. ! Release 6.1 deals with portability issues: new ready-to-build Makefile
  78. ! rule sets for Dynix, Convex, SCO, EP/IX and others; workarounds for
  79. ! strangeness in NeXT, Dynix/PTX (still incomplete), and DG/UX.  If the
  80. ! 6.0 release works for you, there is no need to install 6.1.
  81.   
  82. ! There is a small change in internal interfaces; older applications must
  83. ! be recompiled before they can be linked to the new wrapper library.
  84.   
  85.       Wietse Venema (wietse@wzv.win.tue.nl),
  86.       Department of Mathematics and Computing Science,
  87. --- 11,28 ----
  88.   and do some sanity checks on the origin of the request. No information
  89.   is exchanged with the remote client process.
  90.   
  91. ! Changes with this release:
  92.   
  93. !     - Portability: new Makefile rule sets for SCO and Pyramid OSx 5.1.
  94. !     - Portability: improved TLI support for Dynix/PTX.
  95. !     - Feature: a compile-time option (APPEND_DOT) to keep the hostname
  96. !       lookup routines from trying to append your own domain name to
  97. !       already fully-qualified hostnames. This may reduce the load on
  98. !       your name servers somewhat.
  99. ! Other than that, the code should be binary compatible with release 6.1.
  100.   
  101.       Wietse Venema (wietse@wzv.win.tue.nl),
  102.       Department of Mathematics and Computing Science,
  103. *** ./CHANGES-    Mon Dec 13 22:22:55 1993
  104. --- ./CHANGES    Tue Feb  1 22:11:55 1994
  105. ***************
  106. *** 1,6 ****
  107. ! Changes per release 6.1.
  108. ! ========================
  109.   
  110.   - Re-implemented all environment access routines. Most systems have
  111.   putenv() but no setenv(), some systems have setenv() but no putenv(),
  112.   and there are even systems that have neither setenv() nor putenv(). The
  113. --- 1,26 ----
  114. ! Changes per release 6.2 (Feb 1994)
  115. ! ==================================
  116.   
  117. + - Resurrected my year-old code to reduce DNS load by appending a dot to
  118. + the gethostbyname() argument. This feature is still experimental and it
  119. + may go away if it causes more problems than it solves.
  120. + - Auxiliary code for the Pyramid, BSD universe. Karl Vogel figured out
  121. + what was missing: yp_get_default_domain() and vfprintf().
  122. + - Improved support for Dynix/PTX. The wrapper should now be able to
  123. + deal with all TLI over IP services.
  124. + - The try command now uses the hostname that gethostbyaddr() would
  125. + return, instead of the hostname returned by gethostbyname(). This can
  126. + be significant on systems with NIS that have short host names in the
  127. + hosts map. For example, gethostbyname("wzv.win.tue.nl") returns
  128. + "wzv.win.tue.nl"; gethostbyaddr(131.155.210.17) returns "wzv", and
  129. + so does gethostbyname("wzv").
  130. + Changes per release 6.1 (Dec 1993)
  131. + ==================================
  132.   - Re-implemented all environment access routines. Most systems have
  133.   putenv() but no setenv(), some systems have setenv() but no putenv(),
  134.   and there are even systems that have neither setenv() nor putenv(). The
  135. ***************
  136. *** 38,45 ****
  137.   - On some systems the finger client program lives in /usr/bsd. File:
  138.   safe_finger.c.
  139.   
  140. ! Changes per release 6.0.
  141. ! ========================
  142.   
  143.   - Easy build procedures for common platforms (sun, ultrix, aix, hpux
  144.   and others).
  145. --- 58,65 ----
  146.   - On some systems the finger client program lives in /usr/bsd. File:
  147.   safe_finger.c.
  148.   
  149. ! Changes per release 6.0 (Sept 1993)
  150. ! ===================================
  151.   
  152.   - Easy build procedures for common platforms (sun, ultrix, aix, hpux
  153.   and others).
  154. ***************
  155. *** 94,96 ****
  156. --- 114,209 ----
  157.   or down. Many sites wanted a means to shut up the program; other sites
  158.   wanted to to emphasize specific events.  Adapted from code contributed
  159.   by Dave Mitchell <D.Mitchell@dcs.shef.ac.uk>.
  160. + Changes per release 5.1 (Mar 1993)
  161. + ==================================
  162. + - The additional protection against source-routing attacks from hosts
  163. + that pretend to have someone elses network address has become optional
  164. + because it causes kernel panics with SunOS <= 4.1.3.
  165. + Changes per release 5.0 (Mar 1993)
  166. + ==================================
  167. + - Additional protection against source-routing attacks from hosts that
  168. + pretend to have someone elses network address. For example, the address
  169. + of a trusted host within your own network.
  170. + - The access control language has been extended with a simple but
  171. + powerful operator that greatly simplifies the design of rule sets (ALL:
  172. + .foo.edu EXCEPT dialup.foo.edu). Blank lines are permitted, and long
  173. + lines can be continued with backslash-newline.
  174. + - All configurable stuff, including path names, has been moved into the
  175. + Makefile so that you no longer have to hack source code to just
  176. + configure the programs.
  177. + - Ported to Solaris 2. TLI-based applications not yet supported.
  178. + Several workarounds for System V bugs.
  179. + - A small loophole in the netgroup lookup code was closed, and the
  180. + remote username lookup code was made more portable.
  181. + - Still more documentation. The README file now provides tutorial
  182. + sections with introductions to client, server, inetd and syslogd.
  183. + Changes per release 4.3 (Aug 1992) 
  184. + ==================================
  185. + - Some sites reported that connections would be rejected because
  186. + localhost != localhost.domain. The host name checking code now
  187. + special-cases localhost (problem reported by several sites).
  188. + - The programs now report an error if an existing access control file
  189. + cannot be opened (e.g. due to lack of privileges).  Until now, the
  190. + programs would just pretend that the access control file does not exist
  191. + (reported by Darren Reed, avalon@coombs.anu.edu.au).
  192. + - The timeout period for remote userid lookups was upped to 30 seconds,
  193. + in order to cope with slow hosts or networks.  If this is too long for
  194. + you, adjust the TIMEOUT definition in file rfc931.c (problem reported
  195. + by several sites).
  196. + - On hosts with more than one IP network interface, remote userid
  197. + lookups could use the IP address of the "wrong" local interface.  The
  198. + problem and its solution were discussed on the rfc931-users mailing
  199. + list.  Scott Schwartz (schwartz@cs.psu.edu) folded the fix into the
  200. + rfc931.c module.
  201. + - The result of % expansion (in shell commands) is now checked for
  202. + stuff that may confuse the shell; it is replaced by underscores
  203. + (problem reported by Icarus Sparry, I.Sparry@gdr.bath.ac.uk).
  204. + - A portability problem was fixed that caused compile-time problems
  205. + on a CRAY (problem reported by Michael Barnett, mikeb@rmit.edu.au).
  206. + Changes per release 4.0 (Jun 1992)
  207. + ==================================
  208. + 1 - network daemons no longer have to live within a common directory
  209. + 2 - the access control code now uses both the host address and name
  210. + 3 - an access control pattern that supports netmasks
  211. + 4 - additional protection against forged host names
  212. + 5 - a pattern that matches hosts whose name or address lookup fails
  213. + 6 - an operator that prevents hosts or services from being matched
  214. + 7 - optional remote username lookup with the RFC 931 protocol
  215. + 8 - an optional umask to prevent the creation of world-writable files
  216. + 9 - hooks for access control language extensions
  217. + 10 - last but not least, thoroughly revised documentation.
  218. + Changes per release 3.0 (Oct 1991)
  219. + ==================================
  220. + Enhancements over the previous release are: support for datagram (UDP
  221. + and RPC) services, and execution of shell commands when a (remote host,
  222. + requested service) pair matches a pattern in the access control tables.
  223. + Changes per release 2.0 (May 1991)
  224. + ==================================
  225. + Enhancements over the previous release are: protection against rlogin
  226. + and rsh attacks through compromised domain name servers, optional
  227. + netgroup support for systems with NIS (formerly YP), and an extension
  228. + of the wild card patterns supported by the access control files.
  229. + Release 1.0 (Jan 1991)
  230. *** ./Makefile-    Mon Dec 13 22:22:58 1993
  231. --- ./Makefile    Tue Feb  1 22:11:58 1994
  232. ***************
  233. *** 1,4 ****
  234. ! # @(#) Makefile 1.10 93/12/13 22:22:56
  235.   
  236.   what:
  237.       @echo
  238. --- 1,4 ----
  239. ! # @(#) Makefile 1.11 94/02/01 22:11:56
  240.   
  241.   what:
  242.       @echo
  243. ***************
  244. *** 19,26 ****
  245.       @echo "    generic (most bsd-ish systems with sys5 compatibility)"
  246.       @echo "    386bsd aix alpha apollo convex-ultranet dgux dynix"
  247.       @echo "    dynix-ptx epix esix freebsd hpux irix isc(untested)"
  248. !     @echo "    linux mips(untested) netbsd next osf sco-nis sco-od2"
  249. !     @echo "    sunos4 sunos40 sunos5 sysv4 ultrix unicos(untested)"
  250.       @echo
  251.       @echo "If none of these match your environment, edit the system"
  252.       @echo "dependencies sections in the Makefile and do a 'make other'."
  253. --- 19,26 ----
  254.       @echo "    generic (most bsd-ish systems with sys5 compatibility)"
  255.       @echo "    386bsd aix alpha apollo convex-ultranet dgux dynix"
  256.       @echo "    dynix-ptx epix esix freebsd hpux irix isc(untested)"
  257. !     @echo "    linux mips(untested) netbsd next osf pyramid sco sco-nis"
  258. !     @echo "    sco-od2 sunos4 sunos40 sunos5 sysv4 ultrix unicos(untested)"
  259.       @echo
  260.       @echo "If none of these match your environment, edit the system"
  261.       @echo "dependencies sections in the Makefile and do a 'make other'."
  262. ***************
  263. *** 143,149 ****
  264.   dynix-ptx:
  265.       @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  266.       LIBS="-lsocket -linet -lnsl" RANLIB=echo ARFLAGS=rv \
  267. !     AUX_OBJ="environ.o strcasecmp.o" NETGROUP= TLI=-DTLI_SOCKETS all
  268.   
  269.   # IRIX 4.0.x has a special ar(1) flag.
  270.   irix:
  271. --- 143,149 ----
  272.   dynix-ptx:
  273.       @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  274.       LIBS="-lsocket -linet -lnsl" RANLIB=echo ARFLAGS=rv \
  275. !     AUX_OBJ="environ.o strcasecmp.o ptx.o" NETGROUP= TLI=-DPTX all
  276.   
  277.   # IRIX 4.0.x has a special ar(1) flag.
  278.   irix:
  279. ***************
  280. *** 164,175 ****
  281.       NETGROUP=-DNETGROUP AUX_OBJ=environ.o TLI=-DTLI \
  282.       BUGS="$(BUGS) -DINET_ADDR_BUG" all
  283.   
  284.   # SCO OpenDesktop 2.0, release 3.2 (peter@midnight.com).
  285.   sco-od2:
  286.       @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  287.       LIBS="-lrpcsvc -lrpc -lyp -lrpc -lrpcsvc -lsocket" \
  288.       RANLIB=echo ARFLAGS=rv AUX_OBJ=environ.o \
  289. !     NETGROUP=-DNETGROUP TLI="" all
  290.   
  291.   # SCO 3.2v4.2 with TCP/IP 1.2.1 (Eduard.Vopicka@vse.cz)
  292.   sco-nis:
  293. --- 164,181 ----
  294.       NETGROUP=-DNETGROUP AUX_OBJ=environ.o TLI=-DTLI \
  295.       BUGS="$(BUGS) -DINET_ADDR_BUG" all
  296.   
  297. + # SCO 3.2v4.1 no frills (jedwards@sol1.solinet.net).
  298. + sco:
  299. +     @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  300. +     LIBS="-lsocket -lnsl_s" RANLIB=echo ARFLAGS=rv \
  301. +     NETGROUP= AUX_OBJ=environ.o TLI= all
  302.   # SCO OpenDesktop 2.0, release 3.2 (peter@midnight.com).
  303.   sco-od2:
  304.       @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  305.       LIBS="-lrpcsvc -lrpc -lyp -lrpc -lrpcsvc -lsocket" \
  306.       RANLIB=echo ARFLAGS=rv AUX_OBJ=environ.o \
  307. !     NETGROUP=-DNETGROUP TLI= all
  308.   
  309.   # SCO 3.2v4.2 with TCP/IP 1.2.1 (Eduard.Vopicka@vse.cz)
  310.   sco-nis:
  311. ***************
  312. *** 184,189 ****
  313. --- 190,202 ----
  314.       LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ=environ.o \
  315.       NETGROUP=-DNETGROUP TLI= SYSTYPE="-A run,any -A sys,any" all
  316.   
  317. + # Pyramid OSx 5.1, using the BSD universe.
  318. + pyramid:
  319. +     @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  320. +     LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ="environ.o vfprintf.o" \
  321. +     STRINGS="-Dstrchr=index -Dstrrchr=rindex -Dmemcmp=bcmp -Dno_memcpy" \
  322. +     NETGROUP="-DNETGROUP -DUSE_GETDOMAIN" TLI= all
  323.   # Untested.
  324.   mips:
  325.       @echo "Warning: some definitions may be wrong."
  326. ***************
  327. *** 332,338 ****
  328.   # are sent to a dedicated loghost. It may also be that no syslog daemon
  329.   # is running at all. The README file gives pointers to surrogate syslog
  330.   # implementations for systems that have no syslog library routines or
  331. ! # no syslog daemons.
  332.   #
  333.   # The LOG_XXX names below are taken from the /usr/include/syslog.h file.
  334.   
  335. --- 345,352 ----
  336.   # are sent to a dedicated loghost. It may also be that no syslog daemon
  337.   # is running at all. The README file gives pointers to surrogate syslog
  338.   # implementations for systems that have no syslog library routines or
  339. ! # no syslog daemons. When changing the syslog.conf file, remember that
  340. ! # there must be TABs between fields.
  341.   #
  342.   # The LOG_XXX names below are taken from the /usr/include/syslog.h file.
  343.   
  344. ***************
  345. *** 342,347 ****
  346. --- 356,375 ----
  347.   
  348.   SEVERITY= LOG_INFO    # LOG_INFO is normally not logged to the console
  349.   
  350. + ###########################
  351. + # Optional: Reduce DNS load
  352. + #
  353. + # When looking up the address for a host.domain name, the typical DNS
  354. + # server will first append substrings of your own domain, so it tries
  355. + # host.domain.your.own.domain, then host.domain.own.domain, and then
  356. + # host.domain. The APPEND_DOT feature stops this waste of cycles. It is
  357. + # off by default because it causes problems on sites that don't use DNS.
  358. + #
  359. + # This feature has undergone light testing and it may go away if there
  360. + # are problems with it. If you enable it let me know if it helps.
  361. + #
  362. + # DOT= -DAPPEND_DOT
  363.   ##################################################
  364.   # Optional: Always attempt remote username lookups
  365.   #
  366. ***************
  367. *** 455,461 ****
  368.       -DREAL_MISCD=\"$(REAL_DAEMON_DIR)/miscd\" \
  369.       -DREAL_DAEMON_DIR=\"$(REAL_DAEMON_DIR)\" $(STYLE) $(KILL_OPT) \
  370.       -DSEVERITY=$(SEVERITY) -DRFC931_TIMEOUT=$(RFC931_TIMEOUT) \
  371. !     $(UCHAR) $(TABLES) $(STRINGS) $(TLI) $(EXTRA_CFLAGS)
  372.   
  373.   LIB_OBJ= hosts_access.o options.o shell_cmd.o rfc931.o hosts_info.o \
  374.       hosts_ctl.o refuse.o percent_x.o clean_exit.o $(AUX_OBJ) \
  375. --- 483,489 ----
  376.       -DREAL_MISCD=\"$(REAL_DAEMON_DIR)/miscd\" \
  377.       -DREAL_DAEMON_DIR=\"$(REAL_DAEMON_DIR)\" $(STYLE) $(KILL_OPT) \
  378.       -DSEVERITY=$(SEVERITY) -DRFC931_TIMEOUT=$(RFC931_TIMEOUT) \
  379. !     $(UCHAR) $(TABLES) $(STRINGS) $(TLI) $(EXTRA_CFLAGS) $(DOT)
  380.   
  381.   LIB_OBJ= hosts_access.o options.o shell_cmd.o rfc931.o hosts_info.o \
  382.       hosts_ctl.o refuse.o percent_x.o clean_exit.o $(AUX_OBJ) \
  383. ***************
  384. *** 468,474 ****
  385.       percent_x.c options.c clean_exit.c environ.c patchlevel.h strtok.c \
  386.       fix_options.c workarounds.c socket.c tli.c DISCLAIMER \
  387.       fakelog.c safe_finger.c hosts_options.5 options.h CHANGES \
  388. !     try-from.c init_client.c 6compat.c
  389.   
  390.   LIB    = libwrap.a
  391.   
  392. --- 496,502 ----
  393.       percent_x.c options.c clean_exit.c environ.c patchlevel.h strtok.c \
  394.       fix_options.c workarounds.c socket.c tli.c DISCLAIMER \
  395.       fakelog.c safe_finger.c hosts_options.5 options.h CHANGES \
  396. !     try-from.c init_client.c 6compat.c ptx.c vfprintf.c
  397.   
  398.   LIB    = libwrap.a
  399.   
  400. *** ./README-    Tue Feb  1 22:05:46 1994
  401. --- ./README    Sat Feb  5 15:22:00 1994
  402. ***************
  403. *** 1,6 ****
  404. ! @(#) README 1.18 93/12/14 20:53:13
  405.   
  406. ! This is the 6.1 version of the TCP/IP daemon wrapper package.
  407.   
  408.   Table of contents
  409.   -----------------
  410. --- 1,6 ----
  411. ! @(#) README 1.20 94/02/05 15:21:57
  412.   
  413. ! This is the 6.2 version of the TCP/IP daemon wrapper package.
  414.   
  415.   Table of contents
  416.   -----------------
  417. ***************
  418. *** 223,233 ****
  419.   the Makefile, or by providing no access control tables. The install
  420.   instructions below describe the Makefile editing process.
  421.   
  422. ! When TCP/IP or UDP/IP is used underneath TLI, the wrapper programs
  423. ! provide the same functions as with socket-based applications. When some
  424. ! other protocol is used underneath TLI, the host address will be some
  425. ! universal magic cookie that may not be usable for access control
  426. ! purposes.
  427.   
  428.   4.2 - Host name spoofing
  429.   ------------------------
  430. --- 223,233 ----
  431.   the Makefile, or by providing no access control tables. The install
  432.   instructions below describe the Makefile editing process.
  433.   
  434. ! On System V when TCP/IP or UDP/IP is used underneath TLI, the wrapper
  435. ! programs provide the same functions as with socket-based applications.
  436. ! When some other protocol is used underneath TLI, the host address will
  437. ! be some universal magic cookie that may not be usable for access
  438. ! control purposes.
  439.   
  440.   4.2 - Host name spoofing
  441.   ------------------------
  442. ***************
  443. *** 326,333 ****
  444.   TAP). To add to the confusion, both protocols use the same network
  445.   port.  The daemon wrappers implement a common subset of the protocols.
  446.   
  447. ! With TLI-based network services, remote username lookups will be
  448. ! possible only when TCP/IP is the underlying network protocol.
  449.   
  450.   4.5 - Language extensions
  451.   -------------------------
  452. --- 326,333 ----
  453.   TAP). To add to the confusion, both protocols use the same network
  454.   port.  The daemon wrappers implement a common subset of the protocols.
  455.   
  456. ! On System V with TLI-based network services, remote username lookups
  457. ! will be possible only when the underlying network protocol is TCP/IP.
  458.   
  459.   4.5 - Language extensions
  460.   -------------------------
  461. ***************
  462. *** 406,416 ****
  463.   runs until the machine goes down.  Available from eecs.nwu.edu, file
  464.   /pub/securelib.tar.
  465.   
  466. ! xinetd (posted to comp.sources.unix) is an inetd replacement program
  467. ! that provides, among others, logging, username lookup and access
  468. ! control. However, it does not support TLI services, and it is only six
  469. ! times as much source code as the daemon wrapper programs.
  470.   
  471.   Where shared libraries or router-based packet filtering are not an
  472.   option, an alternative portmap daemon can help to improve RPC security,
  473.   in particular that of NFS and of the NIS (YP) information service.
  474. --- 406,420 ----
  475.   runs until the machine goes down.  Available from eecs.nwu.edu, file
  476.   /pub/securelib.tar.
  477.   
  478. ! xinetd (posted to comp.sources.unix) is an inetd replacement that
  479. ! provides, among others, logging, username lookup and access control.
  480. ! However, it does not support the System V TLI services, and it is only
  481. ! six times as much source code as the daemon wrapper programs.
  482.   
  483. + netlog from Texas A&M relies on the SunOS 4.x /dev/nit interface to
  484. + passively watch all TCP and UDP network traffic on a network.  The
  485. + current version is net.tamu.edu:/pub/security/TAMU/netlog-1.03.tar.gz.
  486.   Where shared libraries or router-based packet filtering are not an
  487.   option, an alternative portmap daemon can help to improve RPC security,
  488.   in particular that of NFS and of the NIS (YP) information service.
  489. ***************
  490. *** 777,782 ****
  491. --- 781,790 ----
  492.   describes the external interface of the libwrap.a library.
  493.   
  494.   The tcpd wrapper can even be used to control access to the smtp port.
  495. + This can be useful when you suspect that someone is trying out some
  496. + obscure sendmail bug, or when a remote site is misconfigured and keeps
  497. + hammering your mail daemon.
  498.   In that case, sendmail should not be run as a stand-alone daemon, but
  499.   it should be registered in the inetd configuration file. For example:
  500.   
  501. ***************
  502. *** 787,795 ****
  503.   
  504.       0,15,30,45 * * * * /usr/lib/sendmail -q
  505.   
  506. ! should take care of that. When you are going to "protect" your sendmail
  507. ! daemon this way, you should realize that there are many "unprotected"
  508. ! sendmail daemons all over the network that can still be abused.
  509.   
  510.   8 - Acknowledgements
  511.   --------------------
  512. --- 795,803 ----
  513.   
  514.       0,15,30,45 * * * * /usr/lib/sendmail -q
  515.   
  516. ! should take care of that. You cannot really prevent people from posting
  517. ! forged mail this way, because there are many unprotected smtp daemons
  518. ! on the network.
  519.   
  520.   8 - Acknowledgements
  521.   --------------------
  522. *** ./fromhost.c-    Mon Dec 13 22:23:07 1993
  523. --- ./fromhost.c    Tue Feb  1 22:12:05 1994
  524. ***************
  525. *** 23,29 ****
  526.     */
  527.   
  528.   #ifndef lint
  529. ! static char sccsid[] = "@(#) fromhost.c 1.14 93/12/13 22:23:05";
  530.   #endif
  531.   
  532.   /* System libraries. */
  533. --- 23,29 ----
  534.     */
  535.   
  536.   #ifndef lint
  537. ! static char sccsid[] = "@(#) fromhost.c 1.15 94/02/01 22:12:03";
  538.   #endif
  539.   
  540.   /* System libraries. */
  541. ***************
  542. *** 32,38 ****
  543.   #include <stdio.h>
  544.   #include <syslog.h>
  545.   
  546. ! #if defined(TLI) || defined(TLI_SOCKETS)
  547.   #include <sys/tiuser.h>
  548.   #include <stropts.h>
  549.   #endif
  550. --- 32,38 ----
  551.   #include <stdio.h>
  552.   #include <syslog.h>
  553.   
  554. ! #if defined(TLI) || defined(PTX)
  555.   #include <sys/tiuser.h>
  556.   #include <stropts.h>
  557.   #endif
  558. ***************
  559. *** 41,47 ****
  560.   
  561.   #include "log_tcp.h"
  562.   
  563. ! #if !defined(TLI) && !defined(TLI_SOCKETS)
  564.   
  565.   /* fromhost - compatibility wrapper for socket-only systems */
  566.   
  567. --- 41,47 ----
  568.   
  569.   #include "log_tcp.h"
  570.   
  571. ! #if !defined(TLI) && !defined(PTX)
  572.   
  573.   /* fromhost - compatibility wrapper for socket-only systems */
  574.   
  575. ***************
  576. *** 53,61 ****
  577.       return (sock_host(client, client_fd));
  578.   }
  579.   
  580. ! #endif /* !defined(TLI) && !defined(TLI_SOCKETS) */
  581.   
  582. ! #ifdef TLI
  583.   
  584.   /* fromhost - find out what network API we should use */
  585.   
  586. --- 53,61 ----
  587.       return (sock_host(client, client_fd));
  588.   }
  589.   
  590. ! #endif /* !defined(TLI) && !defined(PTX) */
  591.   
  592. ! #if defined(TLI) || defined(PTX)
  593.   
  594.   /* fromhost - find out what network API we should use */
  595.   
  596. ***************
  597. *** 80,116 ****
  598.       }
  599.   }
  600.   
  601. ! #endif /* TLI */
  602. ! #ifdef TLI_SOCKETS
  603. ! /* fromhost - use socket primitives even with TLI */
  604. ! int     fromhost(client)
  605. ! struct client_info *client;
  606. ! {
  607. !     int     client_fd = 0;        /* XXX compatibility */
  608. !     int     ret;
  609. !     /*
  610. !      * Some System V.3 based systems have TLI but the supporting libraries
  611. !      * are not as complete as with System V.4. Dynix/PTX is an example. The
  612. !      * workaround is to temporarily switch to the socket interface, identify
  613. !      * the client name/address with socket calls, then to switch back to TLI.
  614. !      */
  615. ! #define SWAP_MODULE(f, old, new) (ioctl(f, I_POP, old), ioctl(f, I_PUSH, new))
  616. !     if (ioctl(client_fd, I_FIND, "timod") > 0) {
  617. !     if (SWAP_MODULE(client_fd, "timod", "sockmod") != 0)
  618. !         syslog(LOG_ERR, "swap timod for sockmod: %m");
  619. !     ret = sock_host(client, client_fd);
  620. !     if (SWAP_MODULE(client_fd, "sockmod", "timod") != 0)
  621. !         syslog(LOG_ERR, "swap sockmod for timod: %m");
  622. !     return (ret);
  623. !     } else {
  624. !     return (sock_host(client, client_fd));
  625. !     }
  626. ! }
  627. ! #endif /* TLI_SOCKETS */
  628. --- 80,83 ----
  629.       }
  630.   }
  631.   
  632. ! #endif /* TLI || PTX */
  633. *** ./options.c-    Mon Dec 13 22:23:18 1993
  634. --- ./options.c    Tue Feb  1 22:12:13 1994
  635. ***************
  636. *** 186,192 ****
  637.   struct client_info *client;
  638.   {
  639.       if (dry_run)
  640. !     syslog(LOG_DEBUG, "option: allow");
  641.       longjmp(options_buf, OPT_ALLOW);
  642.   }
  643.   
  644. --- 186,192 ----
  645.   struct client_info *client;
  646.   {
  647.       if (dry_run)
  648. !     syslog(LOG_DEBUG, "option:   allow");
  649.       longjmp(options_buf, OPT_ALLOW);
  650.   }
  651.   
  652. ***************
  653. *** 200,206 ****
  654.   struct client_info *client;
  655.   {
  656.       if (dry_run)
  657. !     syslog(LOG_DEBUG, "option: deny");
  658.       longjmp(options_buf, OPT_DENY);
  659.   }
  660.   
  661. --- 200,206 ----
  662.   struct client_info *client;
  663.   {
  664.       if (dry_run)
  665. !     syslog(LOG_DEBUG, "option:   deny");
  666.       longjmp(options_buf, OPT_DENY);
  667.   }
  668.   
  669. ***************
  670. *** 224,230 ****
  671.       endpwent();
  672.   
  673.       if (dry_run) {
  674. !     syslog(LOG_DEBUG, "option: user = %s", value);
  675.       return;
  676.       }
  677.       if (setuid(pwd->pw_uid)) {
  678. --- 224,230 ----
  679.       endpwent();
  680.   
  681.       if (dry_run) {
  682. !     syslog(LOG_DEBUG, "option:   user = %s", value);
  683.       return;
  684.       }
  685.       if (setuid(pwd->pw_uid)) {
  686. ***************
  687. *** 254,260 ****
  688.       endgrent();
  689.   
  690.       if (dry_run) {
  691. !     syslog(LOG_DEBUG, "option: group = %s", value);
  692.       return;
  693.       }
  694.       if (setgid(grp->gr_gid)) {
  695. --- 254,260 ----
  696.       endgrent();
  697.   
  698.       if (dry_run) {
  699. !     syslog(LOG_DEBUG, "option:   group = %s", value);
  700.       return;
  701.       }
  702.       if (setgid(grp->gr_gid)) {
  703. ***************
  704. *** 282,288 ****
  705.       longjmp(options_buf, OPT_DENY);
  706.       }
  707.       if (dry_run) {
  708. !     syslog(LOG_DEBUG, "option: umask = %o", mask);
  709.       return;
  710.       }
  711.       (void) umask(mask);
  712. --- 282,288 ----
  713.       longjmp(options_buf, OPT_DENY);
  714.       }
  715.       if (dry_run) {
  716. !     syslog(LOG_DEBUG, "option:   umask = %o", mask);
  717.       return;
  718.       }
  719.       (void) umask(mask);
  720. ***************
  721. *** 300,306 ****
  722.   
  723.       if (dry_run) {
  724.       percent_x(buf, sizeof(buf), value, daemon, client, pid);
  725. !     syslog(LOG_DEBUG, "option: spawn = %s", buf);
  726.       return;
  727.       }
  728.       shell_cmd(value, daemon, client);
  729. --- 300,306 ----
  730.   
  731.       if (dry_run) {
  732.       percent_x(buf, sizeof(buf), value, daemon, client, pid);
  733. !     syslog(LOG_DEBUG, "option:   spawn = %s", buf);
  734.       return;
  735.       }
  736.       shell_cmd(value, daemon, client);
  737. ***************
  738. *** 326,332 ****
  739.       longjmp(options_buf, OPT_DENY);
  740.       }
  741.       if (dry_run) {
  742. !     syslog(LOG_DEBUG, "option: linger = %d", linger.l_linger);
  743.       return;
  744.       }
  745.       linger.l_onoff = (linger.l_linger != 0);
  746. --- 326,332 ----
  747.       longjmp(options_buf, OPT_DENY);
  748.       }
  749.       if (dry_run) {
  750. !     syslog(LOG_DEBUG, "option:   linger = %d", linger.l_linger);
  751.       return;
  752.       }
  753.       linger.l_onoff = (linger.l_linger != 0);
  754. ***************
  755. *** 357,363 ****
  756.       percent_x(buf, sizeof(buf), value, daemon, client, pid);
  757.   
  758.       if (dry_run) {
  759. !     syslog(LOG_DEBUG, "option: twist = %s", buf);
  760.       dry_run = 0;
  761.       return;
  762.       }
  763. --- 357,363 ----
  764.       percent_x(buf, sizeof(buf), value, daemon, client, pid);
  765.   
  766.       if (dry_run) {
  767. !     syslog(LOG_DEBUG, "option:   twist = %s", buf);
  768.       dry_run = 0;
  769.       return;
  770.       }
  771. ***************
  772. *** 412,418 ****
  773.       rfc931_timeout = timeout;
  774.       }
  775.       if (dry_run) {
  776. !     syslog(LOG_DEBUG, "option: rfc931 = %d", rfc931_timeout);
  777.       return;
  778.       }
  779.       if (client->user[0] == 0 && RFC931_POSSIBLE(client))
  780. --- 412,418 ----
  781.       rfc931_timeout = timeout;
  782.       }
  783.       if (dry_run) {
  784. !     syslog(LOG_DEBUG, "option:   rfc931 = %d", rfc931_timeout);
  785.       return;
  786.       }
  787.       if (client->user[0] == 0 && RFC931_POSSIBLE(client))
  788. ***************
  789. *** 449,455 ****
  790.       var_value = chop_string(buf);
  791.       }
  792.       if (dry_run) {
  793. !     syslog(LOG_DEBUG, "option: setenv = %s %s", var_name, var_value);
  794.       return;
  795.       }
  796.       if (setenv(var_name, var_value, 1)) {
  797. --- 449,455 ----
  798.       var_value = chop_string(buf);
  799.       }
  800.       if (dry_run) {
  801. !     syslog(LOG_DEBUG, "option:   setenv = %s %s", var_name, var_value);
  802.       return;
  803.       }
  804.       if (setenv(var_name, var_value, 1)) {
  805. ***************
  806. *** 675,681 ****
  807.       new_severity = severity_map(log_severities, chop_string(value));
  808.       }
  809.       if (dry_run) {
  810. !     syslog(LOG_DEBUG, "option: severity = %s", value);
  811.       return;
  812.       }
  813.       allow_severity = deny_severity = new_severity;
  814. --- 675,681 ----
  815.       new_severity = severity_map(log_severities, chop_string(value));
  816.       }
  817.       if (dry_run) {
  818. !     syslog(LOG_DEBUG, "option:   severity = %s", value);
  819.       return;
  820.       }
  821.       allow_severity = deny_severity = new_severity;
  822. *** ./hosts_access.c-    Mon Sep 27 20:59:51 1993
  823. --- ./hosts_access.c    Tue Feb  1 22:12:09 1994
  824. ***************
  825. *** 17,23 ****
  826.     */
  827.   
  828.   #ifndef lint
  829. ! static char sccsid[] = "@(#) hosts_access.c 1.15 93/09/27 20:59:49";
  830.   #endif
  831.   
  832.   /* System libraries. */
  833. --- 17,23 ----
  834.     */
  835.   
  836.   #ifndef lint
  837. ! static char sccsid[] = "@(#) hosts_access.c 1.16 94/02/01 22:12:05";
  838.   #endif
  839.   
  840.   /* System libraries. */
  841. ***************
  842. *** 34,39 ****
  843. --- 34,40 ----
  844.   extern char *fgets();
  845.   extern char *strchr();
  846.   extern char *strtok();
  847. + extern int errno;
  848.   
  849.   #ifndef    INADDR_NONE
  850.   #define    INADDR_NONE    (-1)        /* XXX should be 0xffffffff */
  851. *** ./patchlevel.h-    Mon Dec 13 22:23:20 1993
  852. --- ./patchlevel.h    Tue Feb  1 22:12:15 1994
  853. ***************
  854. *** 1,3 ****
  855.   #ifndef lint
  856. ! static char patchlevel[] = "@(#) patchlevel 6.1";
  857.   #endif
  858. --- 1,3 ----
  859.   #ifndef lint
  860. ! static char patchlevel[] = "@(#) patchlevel 6.2";
  861.   #endif
  862. *** ./ptx.c-    Tue Feb  1 21:54:49 1994
  863. --- ./ptx.c    Tue Feb  1 22:12:16 1994
  864. ***************
  865. *** 0 ****
  866. --- 1,122 ----
  867. +  /*
  868. +   * The Dynix/PTX TLI implementation is not quite compatible with System V
  869. +   * Release 4. Some important functions are not present so we are limited to
  870. +   * IP-based services.
  871. +   * 
  872. +   * This module takes a TLI endpoint, and tries to determine the local IP
  873. +   * address, the client IP address, and the remote username if username
  874. +   * lookups are done irrespective of client. All results are in static memory
  875. +   * and will be overwritten upon the next call.
  876. +   * 
  877. +   * The return status is (-1) if the remote host pretends to have someone elses
  878. +   * name, or if the remote host name is available but could not be verified;
  879. +   * in either case the hostname will be ignored. The return status is zero in
  880. +   * all other cases (the hostname is unavailable, or the host name double
  881. +   * check succeeds).
  882. +   * 
  883. +   * Diagnostics are reported through syslog(3).
  884. +   * 
  885. +   * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
  886. +   */
  887. + #ifndef lint
  888. + static char sccsid[] = "@(#) ptx.c 1.1 94/02/01 22:12:15";
  889. + #endif
  890. + #ifdef PTX
  891. + /* System libraries. */
  892. + #include <sys/types.h>
  893. + #include <sys/tiuser.h>
  894. + #include <sys/socket.h>
  895. + #include <stropts.h>
  896. + #include <netinet/in.h>
  897. + #include <netdb.h>
  898. + #include <stdio.h>
  899. + #include <syslog.h>
  900. + /* Local stuff. */
  901. + #include "log_tcp.h"
  902. + /* Forward declarations. */
  903. + static void ptx_sink();
  904. + /* tli_host - determine TLI endpoint info, PTX version */
  905. + int     tli_host(client, fd)
  906. + struct client_info *client;
  907. + int     fd;
  908. + {
  909. +     static struct sockaddr_in rmt_sin;
  910. +     static struct sockaddr_in our_sin;
  911. +     int     ret;
  912. +     /*
  913. +      * Initialize the result with suitable defaults.
  914. +      */
  915. +     init_client(client);
  916. +     client->fd = fd;
  917. +     /*
  918. +      * getpeerinaddr() was suggested by someone at Sequent. It seems to work
  919. +      * with connection-oriented (TCP) services such as rlogind and telnetd,
  920. +      * but it returns 0.0.0.0 with datagram (UDP) services. No problem: UDP
  921. +      * needs special treatment anyway, in case we must refuse service.
  922. +      */
  923. +     if (getpeerinaddr(client->fd, &rmt_sin, sizeof(rmt_sin)) == 0
  924. +     && rmt_sin.sin_addr.s_addr != 0) {
  925. +     client->rmt_sin = &rmt_sin;
  926. +     if (getmyinaddr(client->fd, &our_sin, sizeof(our_sin)) == 0) {
  927. +         client->our_sin = &our_sin;
  928. +     } else {
  929. +         syslog(LOG_ERR, "getmyinaddr: %m");
  930. +     }
  931. +     return (sock_names(client));
  932. +     }
  933. +     /*
  934. +      * Another suggestion was to temporarily switch to the socket interface,
  935. +      * identify the client name/address with socket calls, then to switch
  936. +      * back to TLI. This seems to works OK with UDP services, but utterly
  937. +      * messes up rlogind and telnetd.
  938. +      */
  939. + #define SWAP_MODULE(f, old, new) (ioctl(f, I_POP, old), ioctl(f, I_PUSH, new))
  940. +     if (SWAP_MODULE(client->fd, "timod", "sockmod") != 0)
  941. +     syslog(LOG_ERR, "replace timod by sockmod: %m");
  942. +     ret = sock_host(client, client->fd);
  943. +     if (SWAP_MODULE(client->fd, "sockmod", "timod") != 0)
  944. +     syslog(LOG_ERR, "replace sockmod by timod: %m");
  945. +     if (client->sink != 0)
  946. +     client->sink = ptx_sink;
  947. +     return (ret);
  948. + }
  949. + /* ptx_sink - absorb unreceived IP datagram */
  950. + static void ptx_sink(fd)
  951. + int     fd;
  952. + {
  953. +     char    buf[BUFSIZ];
  954. +     struct sockaddr sa;
  955. +     int     size = sizeof(sa);
  956. +     /*
  957. +      * Eat up the not-yet received datagram. Where needed, switch to the
  958. +      * socket programming interface.
  959. +      */
  960. +     if (ioctl(fd, I_FIND, "timod") != 0)
  961. +     ioctl(fd, I_POP, "timod");
  962. +     if (ioctl(fd, I_FIND, "sockmod") == 0)
  963. +     ioctl(fd, I_PUSH, "sockmod");
  964. +     (void) recvfrom(fd, buf, sizeof(buf), 0, &sa, &size);
  965. + }
  966. + #endif /* PTX */
  967. *** ./socket.c-    Mon Dec 13 22:23:27 1993
  968. --- ./socket.c    Tue Feb  1 22:12:18 1994
  969. ***************
  970. *** 17,23 ****
  971.     */
  972.   
  973.   #ifndef lint
  974. ! static char sccsid[] = "@(#) socket.c 1.8 93/12/13 22:23:25";
  975.   #endif
  976.   
  977.   /* System libraries. */
  978. --- 17,23 ----
  979.     */
  980.   
  981.   #ifndef lint
  982. ! static char sccsid[] = "@(#) socket.c 1.9 94/02/01 22:12:16";
  983.   #endif
  984.   
  985.   /* System libraries. */
  986. ***************
  987. *** 29,35 ****
  988.   #include <netdb.h>
  989.   #include <stdio.h>
  990.   #include <syslog.h>
  991. - #include <errno.h>
  992.   
  993.   extern char *inet_ntoa();
  994.   extern char *strncpy();
  995. --- 29,34 ----
  996. ***************
  997. *** 60,65 ****
  998. --- 59,94 ----
  999.   
  1000.   static int sock_match_hostname();
  1001.   static void sock_sink();
  1002. + #ifdef APPEND_DOT
  1003. +  /*
  1004. +   * Speed up DNS lookups by terminating the host name with a dot. Should be
  1005. +   * done with care. The speedup can give problems with lookups from sources
  1006. +   * that lack DNS-style trailing dot magic, such as local files or NIS maps.
  1007. +   */
  1008. + static struct hostent *gethostbyname_dot(name)
  1009. + char   *name;
  1010. + {
  1011. +     char    dot_name[MAXHOSTNAMELEN + 1];
  1012. +     char   *strchr();
  1013. +     /*
  1014. +      * Don't append dots to unqualified names. Such names are likely to come
  1015. +      * from local hosts files or from NIS.
  1016. +      */
  1017. +     if (strchr(name, '.') == 0 || strlen(name) >= MAXHOSTNAMELEN - 1) {
  1018. +     return (gethostbyname(name));
  1019. +     } else {
  1020. +     sprintf(dot_name, "%s.", name);
  1021. +     return (gethostbyname(dot_name));
  1022. +     }
  1023. + }
  1024. + #define gethostbyname gethostbyname_dot
  1025. + #endif
  1026.   
  1027.   /* sock_host - determine endpoint info */
  1028.   
  1029. *** ./try.c-    Mon Dec 13 22:23:31 1993
  1030. --- ./try.c    Tue Feb  1 22:12:21 1994
  1031. ***************
  1032. *** 17,26 ****
  1033.     */
  1034.   
  1035.   #ifndef lint
  1036. ! static char sccsid[] = "@(#) try.c 1.9 93/12/13 22:23:29";
  1037.   #endif
  1038.   
  1039.   #include <sys/types.h>
  1040.   #include <netinet/in.h>
  1041.   #include <arpa/inet.h>
  1042.   #include <netdb.h>
  1043. --- 17,27 ----
  1044.     */
  1045.   
  1046.   #ifndef lint
  1047. ! static char sccsid[] = "@(#) try.c 1.10 94/02/01 22:12:19";
  1048.   #endif
  1049.   
  1050.   #include <sys/types.h>
  1051. + #include <sys/socket.h>
  1052.   #include <netinet/in.h>
  1053.   #include <arpa/inet.h>
  1054.   #include <netdb.h>
  1055. ***************
  1056. *** 173,178 ****
  1057. --- 174,190 ----
  1058.        */
  1059.       if ((hp = gethostbyname(host)) == 0) {
  1060.       fprintf(stderr, "host %s: address lookup failed\n", host);
  1061. +     return (1);
  1062. +     }
  1063. +     /*
  1064. +      * Use the hostname that gethostbyaddr() would give us. On systems with
  1065. +      * NIS this may be an unqualified name. We should use that even though a
  1066. +      * FQDN was given on the command line.
  1067. +      */
  1068. +     if ((hp = gethostbyaddr((char *) hp->h_addr_list[0],
  1069. +                 sizeof(struct in_addr), AF_INET)) == 0) {
  1070. +     fprintf(stderr, "host %s: address->name lookup failed\n", host);
  1071.       return (1);
  1072.       }
  1073.   
  1074. *** ./vfprintf.c-    Tue Feb  1 21:54:52 1994
  1075. --- ./vfprintf.c    Tue Feb  1 22:12:22 1994
  1076. ***************
  1077. *** 0 ****
  1078. --- 1,125 ----
  1079. +  /*
  1080. +   * vfprintf() and vprintf() clones. They will produce unexpected results
  1081. +   * when excessive dynamic ("*") field widths are specified. This code was
  1082. +   * adapted from my EXP programming language runtime system.
  1083. +   * 
  1084. +   * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
  1085. +   */
  1086. + #ifndef lint
  1087. + static char sccsid[] = "@(#) vfprintf.c 1.1 94/02/01 22:12:21";
  1088. + #endif
  1089. + #include <stdio.h>
  1090. + #include <ctype.h>
  1091. + #ifdef __STDC__
  1092. + #include <stdarg.h>
  1093. + #else
  1094. + #include <varargs.h>
  1095. + #endif
  1096. + /* vfprintf - print variable-length argument list to stream */
  1097. + int     vfprintf(fp, format, ap)
  1098. + FILE   *fp;
  1099. + char   *format;
  1100. + va_list ap;
  1101. + {
  1102. +     char    fmt[BUFSIZ];        /* format specifier */
  1103. +     register char *fmtp;
  1104. +     register char *cp;
  1105. +     int     count = 0;
  1106. +     /*
  1107. +      * Iterate over characters in the format string, picking up arguments
  1108. +      * when format specifiers are found.
  1109. +      */
  1110. +     for (cp = format; *cp; cp++) {
  1111. +     if (*cp != '%') {
  1112. +         putc(*cp, fp);            /* ordinary character */
  1113. +         count++;
  1114. +     } else {
  1115. +         /*
  1116. +          * Format specifiers are handled one at a time, since we can only
  1117. +          * deal with arguments one at a time. Try to determine the end of
  1118. +          * the format specifier. We do not attempt to fully parse format
  1119. +          * strings, since we are ging to let fprintf() do the hard work.
  1120. +          * In regular expression notation, we recognize:
  1121. +          * 
  1122. +          * %-?0?([0-9]*|\*)\.?([0-9]*|\*)l?[a-z]
  1123. +          * 
  1124. +          * which includes some combinations that do not make sense.
  1125. +          */
  1126. +         fmtp = fmt;
  1127. +         *fmtp++ = *cp++;
  1128. +         if (*cp == '-')            /* left-adjusted field? */
  1129. +         *fmtp++ = *cp++;
  1130. +         if (*cp == '0')            /* zero-padded field? */
  1131. +         *fmtp++ = *cp++;
  1132. +         if (*cp == '*') {            /* dynamic field witdh */
  1133. +         sprintf(fmtp, "%d", va_arg(ap, int));
  1134. +         fmtp += strlen(fmtp);
  1135. +         cp++;
  1136. +         } else {
  1137. +         while (isdigit(*cp))        /* hard-coded field width */
  1138. +             *fmtp++ = *cp++;
  1139. +         }
  1140. +         if (*cp == '.')            /* width/precision separator */
  1141. +         *fmtp++ = *cp++;
  1142. +         if (*cp == '*') {            /* dynamic precision */
  1143. +         sprintf(fmtp, "%d", va_arg(ap, int));
  1144. +         fmtp += strlen(fmtp);
  1145. +         cp++;
  1146. +         } else {
  1147. +         while (isdigit(*cp))        /* hard-coded precision */
  1148. +             *fmtp++ = *cp++;
  1149. +         }
  1150. +         if (*cp == 'l')            /* long whatever */
  1151. +         *fmtp++ = *cp++;
  1152. +         if (*cp == 0)            /* premature end, punt */
  1153. +         break;
  1154. +         *fmtp++ = *cp;            /* type (checked below) */
  1155. +         *fmtp = 0;
  1156. +         /* Execute the format string - let fprintf() do the hard work. */
  1157. +         switch (fmtp[-1]) {
  1158. +         case 's':                /* string-valued argument */
  1159. +         count += fprintf(fp, fmt, va_arg(ap, char *));
  1160. +         break;
  1161. +         case 'c':                /* integral-valued argument */
  1162. +         case 'd':
  1163. +         case 'u':
  1164. +         case 'o':
  1165. +         case 'x':
  1166. +         if (fmtp[-2] == 'l')
  1167. +             count += fprintf(fp, fmt, va_arg(ap, long));
  1168. +         else
  1169. +             count += fprintf(fp, fmt, va_arg(ap, int));
  1170. +         break;
  1171. +         case 'e':                /* float-valued argument */
  1172. +         case 'f':
  1173. +         case 'g':
  1174. +         count += fprintf(fp, fmt, va_arg(ap, double));
  1175. +         break;
  1176. +         default:                /* anything else */
  1177. +         putc(fmtp[-1], fp);
  1178. +         count++;
  1179. +         break;
  1180. +         }
  1181. +     }
  1182. +     }
  1183. +     return (count);
  1184. + }
  1185. + /* vprintf - print variable-length argument list to stdout */
  1186. + vprintf(format, ap)
  1187. + char   *format;
  1188. + va_list ap;
  1189. + {
  1190. +     return (vfprintf(stdout, format, ap));
  1191. + }
  1192. *** ./workarounds.c-    Tue Sep 21 23:16:39 1993
  1193. --- ./workarounds.c    Tue Feb  1 22:12:24 1994
  1194. ***************
  1195. *** 8,14 ****
  1196.     */
  1197.   
  1198.   #ifndef lint
  1199. ! char    sccsid[] = "@(#) workarounds.c 1.1 93/09/21 23:16:38";
  1200.   #endif
  1201.   
  1202.   #include <sys/types.h>
  1203. --- 8,14 ----
  1204.     */
  1205.   
  1206.   #ifndef lint
  1207. ! char    sccsid[] = "@(#) workarounds.c 1.2 94/02/01 22:12:23";
  1208.   #endif
  1209.   
  1210.   #include <sys/types.h>
  1211. ***************
  1212. *** 20,28 ****
  1213. --- 20,47 ----
  1214.   #include <stdio.h>
  1215.   #include <syslog.h>
  1216.   
  1217. + extern int errno;
  1218.   #include "log_tcp.h"
  1219.   
  1220.    /*
  1221. +   * Some AIX versions advertise a too small MAXHOSTNAMELEN value (32).
  1222. +   * Result: long hostnames would be truncated, and connections would be
  1223. +   * dropped because of host name verification failures. Adrian van Bloois
  1224. +   * (A.vanBloois@info.nic.surfnet.nl) figured out what was the problem.
  1225. +   */
  1226. + #if (MAXHOSTNAMELEN < 64)
  1227. + #undef MAXHOSTNAMELEN
  1228. + #endif
  1229. + /* In case not defined in <sys/param.h>. */
  1230. + #ifndef MAXHOSTNAMELEN
  1231. + #define MAXHOSTNAMELEN  256             /* storage for host name */
  1232. + #endif
  1233. +  /*
  1234.     * Some DG/UX inet_addr() versions return a struct/union instead of a long.
  1235.     * You have this problem when the compiler complains about illegal lvalues
  1236.     * or something like that. The following code fixes this mutant behaviour.
  1237. ***************
  1238. *** 158,160 ****
  1239. --- 177,198 ----
  1240.   }
  1241.   
  1242.   #endif /* GETPEERNAME_BUG */
  1243. +  /*
  1244. +   * According to Karl Vogel (vogelke@c-17igp.wpafb.af.mil) some Pyramid
  1245. +   * versions have no yp_default_domain() function. We use getdomainname()
  1246. +   * instead.
  1247. +   */
  1248. + #ifdef USE_GETDOMAIN
  1249. + int     yp_get_default_domain(ptr)
  1250. + char  **ptr;
  1251. + {
  1252. +     static char mydomain[MAXHOSTNAMELEN];
  1253. +     *ptr = mydomain;
  1254. +     return (getdomainname(mydomain, MAXHOSTNAMELEN));
  1255. + }
  1256. + #endif /* USE_GETDOMAIN */
  1257.  
  1258. exit 0 # Just in case...
  1259.