home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume41 / tcp_wrappers / patch01 next >
Encoding:
Text File  |  1994-01-25  |  55.7 KB  |  1,808 lines

  1. Newsgroups: comp.sources.misc
  2. From: wietse@wzv.win.tue.nl (Wietse Venema)
  3. Subject: v41i108:  tcp_wrappers - TCP/IP daemon wrappers v6.0, Patch01
  4. Message-ID: <1994Jan25.213939.5513@sparky.sterling.com>
  5. X-Md4-Signature: 171188239b2fc5a648179492e789a730
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Eindhoven University of Technology, The Netherlands
  8. Date: Tue, 25 Jan 1994 21:39:39 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: wietse@wzv.win.tue.nl (Wietse Venema)
  12. Posting-number: Volume 41, Issue 108
  13. Archive-name: tcp_wrappers/patch01
  14. Environment: UNIX, INET
  15. Patch-To: tcp_wrappers: Volume 39, Issue 110-113
  16.  
  17. This is a patch to the 6.0 version of the TCP/IP daemon wrapper
  18. package that appeared in comp.sources.misc Volume 39, Issue 110.
  19. A fully-patched source kit can be found in the usual places: 
  20.  
  21.     ftp.win.tue.nl:/pub/security/tcp_wrappers_6.1.shar.Z
  22.     cert.org:/pub/tools/tcp_wrappers
  23.  
  24. With these programs you can monitor and control who connects to your
  25. TFTP, EXEC, FTP, RSH, TELNET, RLOGIN, FINGER, and SYSTAT network
  26. services, and many others.
  27.  
  28. The programs can be installed without any changes to existing software
  29. or configuration files. By default, they just log the remote host name
  30. and do some sanity checks on the origin of the request. No information
  31. is exchanged with the remote client process.
  32.  
  33. Release 6.1 deals with portability issues: new ready-to-build Makefile
  34. rule sets for Dynix, Convex, SCO, EP/IX and others; workarounds for
  35. strangeness in NeXT, Dynix/PTX (still incomplete), and DG/UX.  If the
  36. 6.0 release works for you, there is no need to install 6.1.
  37.  
  38. There is a small change in internal interfaces; older applications must
  39. be recompiled before they can be linked to the new wrapper library.
  40.  
  41.     Wietse Venema (wietse@wzv.win.tue.nl),
  42.     Department of Mathematics and Computing Science,
  43.     Eindhoven University of Technology,
  44.     The Netherlands.
  45.  
  46. diff -c ../6.0/BLURB ./BLURB
  47. *** ../6.0/BLURB    Tue Dec 21 21:37:57 1993
  48. --- ./BLURB    Tue Dec 21 21:37:16 1993
  49. ***************
  50. *** 1,6 ****
  51. ! @(#) BLURB 1.14 93/09/28 23:03:27
  52.   
  53. ! This is the 6.0 version of the TCP/IP daemon wrapper package.
  54.   
  55.   With these programs you can monitor and control who connects to your
  56.   TFTP, EXEC, FTP, RSH, TELNET, RLOGIN, FINGER, and SYSTAT network
  57. --- 1,6 ----
  58. ! @(#) BLURB 1.15 93/12/13 22:22:51
  59.   
  60. ! This is the 6.1 version of the TCP/IP daemon wrapper package.
  61.   
  62.   With these programs you can monitor and control who connects to your
  63.   TFTP, EXEC, FTP, RSH, TELNET, RLOGIN, FINGER, and SYSTAT network
  64. ***************
  65. *** 11,41 ****
  66.   and do some sanity checks on the origin of the request. No information
  67.   is exchanged with the remote client process.
  68.   
  69. ! Significant differences with respect to the previous release:
  70.   
  71. !     - Easier to install: ready-to-use build procedures for many common
  72. !     UNIX implementations (sun, ultrix, hp-ux, irix, aix, ...).
  73. !     - Support for the System V.4 TLI network programming interface
  74. !     (Solaris, DG/UX etc.).  In case of TLI applications on top of
  75. !     TCP/IP, the wrappers provide the same functionality as with
  76. !     socket-based applications.
  77. !     - A more secure finger tool for automatic reverse finger probes.
  78. !     - New extension language keywords:  "severity", to adjust the log
  79. !     noise level; "allow" and "deny", to keep all access-control rules
  80. !     within a single file.
  81. !     - More support for selective remote username lookups.
  82. !     - More workarounds for System V bugs: IRIX username lookups, and
  83. !     SCO problems with UDP.
  84. ! The default mode of operation (no TLI support) should be backwards
  85. ! compatible with earlier versions. The library interface has changed,
  86. ! though, and programs that depend on the libwrap.a library will have to
  87. ! be recompiled before they can be relinked.
  88.   
  89.       Wietse Venema (wietse@wzv.win.tue.nl),
  90.       Department of Mathematics and Computing Science,
  91. --- 11,23 ----
  92.   and do some sanity checks on the origin of the request. No information
  93.   is exchanged with the remote client process.
  94.   
  95. ! Release 6.1 deals with portability issues: new ready-to-build Makefile
  96. ! rule sets for Dynix, Convex, SCO, EP/IX and others; workarounds for
  97. ! strangeness in NeXT, Dynix/PTX (still incomplete), and DG/UX.  If the
  98. ! 6.0 release works for you, there is no need to install 6.1.
  99.   
  100. ! There is a small change in internal interfaces; older applications must
  101. ! be recompiled before they can be linked to the new wrapper library.
  102.   
  103.       Wietse Venema (wietse@wzv.win.tue.nl),
  104.       Department of Mathematics and Computing Science,
  105. diff -c ../6.0/CHANGES ./CHANGES
  106. *** ../6.0/CHANGES    Tue Dec 21 21:38:06 1993
  107. --- ./CHANGES    Tue Dec 21 21:37:25 1993
  108. ***************
  109. *** 1,3 ****
  110. --- 1,43 ----
  111. + Changes per release 6.1.
  112. + ========================
  113. + - Re-implemented all environment access routines. Most systems have
  114. + putenv() but no setenv(), some systems have setenv() but no putenv(),
  115. + and there are even systems that have neither setenv() nor putenv(). The
  116. + benefit of all this is that more systems can now be treated in the same
  117. + way. File:  environ.c.
  118. + - Workaround for a weird problem with DG/UX when the wrapper is run as
  119. + nobody (i.e. fingerd). For some reason the ioctl(fd, I_FIND, "sockmod")
  120. + call fails even with socket-based applications. The "fix" is to always
  121. + assume sockets when the ioctl(fd, I_FIND, "timod") call fails. File:
  122. + fromhost.c. Thanks to Paul de Vries (vries@dutentb.et.tudelft.nl) for
  123. + helping me to figure out this one.
  124. + - Implemented a workaround for Dynix/PTX and other systems with TLI
  125. + that lack some essential support routines. Thanks to Bugs Brouillard
  126. + (brouill@hsuseq.humboldt.edu) for the hospitality to try things out.
  127. + The trick is to temporarily switch to the socket API to identify the
  128. + client, and to switch back to TLI when done.  It still does not work
  129. + right for basic network services such as telnet. File: fromhost.c.
  130. + - Easy-to-build procedures for SCO UNIX, ConvexOS with UltraNet, EP/IX,
  131. + Dynix 3.2, Dynix/PTX. File: Makefile.
  132. + - Variable rfc931 timeout. Files: rfc931.c, options.c, log_tcp.h, try.c.
  133. + - Further simplification of the rfc931 code. File: rfc931.c.
  134. + - The fromhost() interface stinks: I cannot change that, but at least
  135. + the from_sock() and from_tli() functions now accept a file descriptor
  136. + argument.
  137. + - Fixed a buglet: fromhost() would pass a garbage file descriptor to
  138. + the isastream() call.
  139. + - On some systems the finger client program lives in /usr/bsd. File:
  140. + safe_finger.c.
  141.   Changes per release 6.0.
  142.   ========================
  143.   
  144. diff -c ../6.0/Makefile ./Makefile
  145. *** ../6.0/Makefile    Tue Dec 21 21:37:56 1993
  146. --- ./Makefile    Tue Dec 21 21:37:14 1993
  147. ***************
  148. *** 1,22 ****
  149. ! # @(#) Makefile 1.9 93/09/28 23:39:55
  150.   
  151.   what:
  152.       @echo
  153.       @echo "Usage: edit the REAL_DAEMON_DIR definition in the Makefile then:"
  154.       @echo
  155. !     @echo "    make type-of-system"
  156.       @echo
  157.       @echo "If you are in a hurry you can try instead:"
  158.       @echo
  159. !     @echo "    make REAL_DAEMON_DIR=/some/where type-of-system"
  160.       @echo
  161. !     @echo "This Makefile knows about the following types of systems:"
  162.       @echo
  163. !     @echo "    sunos4 sunos5 next irix hpux ultrix aix alpha osf"
  164. !     @echo "    sunos40 {386,net,free}bsd linux sysv4 esix dgux"
  165.       @echo
  166.       @echo "If none of these match your environment, edit the system"
  167. !     @echo "dependencies section in the Makefile and do a 'make other'."
  168.       @echo
  169.   
  170.   #######################################################
  171. --- 1,29 ----
  172. ! # @(#) Makefile 1.10 93/12/13 22:22:56
  173.   
  174.   what:
  175.       @echo
  176.       @echo "Usage: edit the REAL_DAEMON_DIR definition in the Makefile then:"
  177.       @echo
  178. !     @echo "    make sys-type"
  179.       @echo
  180.       @echo "If you are in a hurry you can try instead:"
  181.       @echo
  182. !     @echo "    make REAL_DAEMON_DIR=/foo/bar sys-type"
  183.       @echo
  184. !     @echo "And for a version with language extensions enabled:"
  185.       @echo
  186. !     @echo "    make REAL_DAEMON_DIR=/foo/bar STYLE=-DPROCESS_OPTIONS sys-type"
  187.       @echo
  188. +     @echo "This Makefile knows about the following sys-types:"
  189. +     @echo
  190. +     @echo "    generic (most bsd-ish systems with sys5 compatibility)"
  191. +     @echo "    386bsd aix alpha apollo convex-ultranet dgux dynix"
  192. +     @echo "    dynix-ptx epix esix freebsd hpux irix isc(untested)"
  193. +     @echo "    linux mips(untested) netbsd next osf sco-nis sco-od2"
  194. +     @echo "    sunos4 sunos40 sunos5 sysv4 ultrix unicos(untested)"
  195. +     @echo
  196.       @echo "If none of these match your environment, edit the system"
  197. !     @echo "dependencies sections in the Makefile and do a 'make other'."
  198.       @echo
  199.   
  200.   #######################################################
  201. ***************
  202. *** 31,37 ****
  203.   # 
  204.   # Uncomment the appropriate line if you are going to edit inetd.conf.
  205.   #
  206. ! # Ultrix 4.x SunOS 4.x
  207.   #REAL_DAEMON_DIR=/usr/etc
  208.   #
  209.   # SysV.4 Solaris 2.x OSF AIX
  210. --- 38,44 ----
  211.   # 
  212.   # Uncomment the appropriate line if you are going to edit inetd.conf.
  213.   #
  214. ! # Ultrix 4.x SunOS 4.x ConvexOS 10.x
  215.   #REAL_DAEMON_DIR=/usr/etc
  216.   #
  217.   # SysV.4 Solaris 2.x OSF AIX
  218. ***************
  219. *** 40,46 ****
  220.   # BSD 4.4
  221.   #REAL_DAEMON_DIR=/usr/libexec
  222.   #
  223. ! # HP-UX
  224.   #REAL_DAEMON_DIR=/etc
  225.   
  226.   # Easy installation: vendor-provided network daemons are moved to "some
  227. --- 47,53 ----
  228.   # BSD 4.4
  229.   #REAL_DAEMON_DIR=/usr/libexec
  230.   #
  231. ! # HP-UX SCO
  232.   #REAL_DAEMON_DIR=/etc
  233.   
  234.   # Easy installation: vendor-provided network daemons are moved to "some
  235. ***************
  236. *** 51,57 ****
  237.   # 
  238.   # Uncomment the appropriate line if you are going to move your daemons.
  239.   #
  240. ! # Ultrix 4.x SunOS 4.x
  241.   #REAL_DAEMON_DIR=/usr/etc/...
  242.   #
  243.   # SysV.4 Solaris 2.x OSF AIX
  244. --- 58,64 ----
  245.   # 
  246.   # Uncomment the appropriate line if you are going to move your daemons.
  247.   #
  248. ! # Ultrix 4.x SunOS 4.x ConvexOS 10.x
  249.   #REAL_DAEMON_DIR=/usr/etc/...
  250.   #
  251.   # SysV.4 Solaris 2.x OSF AIX
  252. ***************
  253. *** 60,78 ****
  254.   # BSD 4.4
  255.   #REAL_DAEMON_DIR=/usr/libexec/...
  256.   #
  257. ! # HP-UX
  258.   #REAL_DAEMON_DIR=/etc/...
  259.   
  260.   # End of mandatory section
  261.   ##########################
  262.   
  263. ! ##############################################
  264. ! # System dependencies: ready-to-use templates.
  265.   #
  266. ! # Ready-to-use templates are available for sunos 4.x, sunos 5.x (sysv4),
  267. ! # ultrix, hp-ux, irix 4.x and others. These templates take care of all system
  268. ! # dependencies: after editing the REAL_DAEMON_DIR definition above, just do
  269. ! # a "make sunos4" (or whatever system type is appropriate).
  270.   #
  271.   # If your system is not listed (or something that comes close enough), you
  272.   # will have to edit the system depencies section below and do a "make other".  
  273. --- 67,85 ----
  274.   # BSD 4.4
  275.   #REAL_DAEMON_DIR=/usr/libexec/...
  276.   #
  277. ! # HP-UX SCO
  278.   #REAL_DAEMON_DIR=/etc/...
  279.   
  280.   # End of mandatory section
  281.   ##########################
  282.   
  283. ! ##########################################
  284. ! # Ready-to-use system-dependent templates.
  285.   #
  286. ! # Ready-to-use templates are available for many systems (see the "echo"
  287. ! # commands at the start of this Makefile).  The templates take care of
  288. ! # all system dependencies: after editing the REAL_DAEMON_DIR definition
  289. ! # above, do a "make sunos4" (or whatever system type is appropriate).
  290.   #
  291.   # If your system is not listed (or something that comes close enough), you
  292.   # will have to edit the system depencies section below and do a "make other".  
  293. ***************
  294. *** 80,145 ****
  295.   # Send templates for other UNIX versions to wietse@wzv.win.tue.nl.
  296.   
  297.   # This is good for many BSD+SYSV hybrids with NIS (formerly YP).
  298. ! sunos4 next aix osf alpha:
  299. !     @make LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ=setenv.o \
  300.       NETGROUP=-DNETGROUP TLI= all
  301.   
  302. ! # SunOS stopped at release 4.0.x for the 386.
  303.   sunos40:
  304. !     @make LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ="setenv.o strcasecmp.o" \
  305.       NETGROUP=-DNETGROUP TLI= all
  306.   
  307. ! # Ultrix is like sunos4, next, etc., but has miscd, too.
  308.   ultrix:
  309. !     @make LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ=setenv.o \
  310.       NETGROUP=-DNETGROUP TLI= all miscd
  311.   
  312. ! # Free bsd and linux have no NIS.
  313.   386bsd netbsd freebsd:
  314. !     @make LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ= NETGROUP= TLI= all
  315.   
  316.   linux:
  317. !     @make LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ=setenv.o \
  318.       NETGROUP= TLI= EXTRA_CFLAGS="-DBROKEN_SO_LINGER" all
  319.   
  320.   # This is good for many SYSV+BSD hybrids with NIS, probably also for HP-UX 7.x.
  321.   hpux hpux8 hpux9:
  322. !     @make LIBS= RANLIB=echo ARFLAGS=rv AUX_OBJ=setenv.o \
  323.       NETGROUP=-DNETGROUP TLI= all
  324.   
  325.   # IRIX 4.0.x has a special ar(1) flag.
  326.   irix:
  327. !     @make LIBS=-lsun RANLIB=echo ARFLAGS=rvs AUX_OBJ=setenv.o \
  328.       NETGROUP=-DNETGROUP TLI= all
  329.   
  330.   # SunOS 5.x is close enough to generic System V.4
  331.   sunos5 esix sysv4:
  332. !     @make LIBS="-lsocket -lnsl" RANLIB=echo ARFLAGS=rv \
  333. !     NETGROUP=-DNETGROUP AUX_OBJ=setenv.o TLI=-DTLI all
  334.   
  335.   # DG/UX 5.4.1 is like SYSV.4 but slightly different.
  336.   dgux:
  337. !     @make LIBS=-lnsl RANLIB=echo ARFLAGS=rv \
  338. !     NETGROUP=-DNETGROUP AUX_OBJ=setenv.o TLI=-DTLI \
  339.       BUGS="$(BUGS) -DINET_ADDR_BUG" all
  340.   
  341. ! # Untested templates. The wrapper is known to run on these systems, I just
  342. ! # don't have sufficient time+details to prepare complete makefile templates.
  343.   
  344. ! ptx:
  345. !     @echo "Warning: the AUX_OBJ and/or NETGROUP definitions may be wrong."
  346. !     make LIBS="-lsocket -linet -lnsl -lnfs" RANLIB=echo ARFLAGS=rv \
  347. !     AUX_OBJ="setenv.o strcasecmp.o" NETGROUP= TLI=-DTLI all
  348.   
  349.   isc:
  350. !     @echo "Warning: the AUX_OBJ and/or NETGROUP definitions may be wrong."
  351. !     make LIBS="-linet -lnsl_s -ldbm" RANLIB=echo ARFLAGS=rv \
  352. !     AUX_OBJ="setenv.o strcasecmp.o" NETGROUP= TLI= all
  353.   
  354.   unicos:
  355.       @echo "Warning: some definitions may be wrong."
  356. !     make LIBS=-lnet RANLIB=echo ARFLAGS=rv \
  357. !     AUX_OBJ="setenv.o strcasecmp.o" NETGROUP= TLI= all
  358.   
  359.   ###############################################################
  360.   # System dependencies: TLI (transport-level interface) support.
  361. --- 87,209 ----
  362.   # Send templates for other UNIX versions to wietse@wzv.win.tue.nl.
  363.   
  364.   # This is good for many BSD+SYSV hybrids with NIS (formerly YP).
  365. ! generic sunos4 aix osf alpha dynix:
  366. !     @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  367. !     LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ=environ.o \
  368.       NETGROUP=-DNETGROUP TLI= all
  369.   
  370. ! # The NeXT loader needs "-m" or it barfs on redefined library functions.
  371. ! next:
  372. !     @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  373. !     LIBS=-m RANLIB=ranlib ARFLAGS=rv AUX_OBJ=environ.o \
  374. !     NETGROUP=-DNETGROUP TLI= all
  375. ! # SunOS for the 386 was frozen at release 4.0.x.
  376.   sunos40:
  377. !     @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  378. !     LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ="environ.o strcasecmp.o" \
  379.       NETGROUP=-DNETGROUP TLI= all
  380.   
  381. ! # Ultrix is like sunos4, aix, next, etc., but has miscd, too.
  382.   ultrix:
  383. !     @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  384. !     LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ=environ.o \
  385.       NETGROUP=-DNETGROUP TLI= all miscd
  386.   
  387. ! # This works on EP/IX 1.4.3 and will likely work on Mips (reggers@julian.uwo.ca)
  388. ! epix:
  389. !     @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  390. !     LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ=environ.o \
  391. !     NETGROUP=-DNETGROUP TLI= SYSTYPE="-systype bsd43" all
  392. ! # Free bsd and linux by default have no NIS.
  393.   386bsd netbsd freebsd:
  394. !     @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  395. !     LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ= NETGROUP= TLI= all
  396.   
  397.   linux:
  398. !     @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  399. !     LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ=environ.o \
  400.       NETGROUP= TLI= EXTRA_CFLAGS="-DBROKEN_SO_LINGER" all
  401.   
  402.   # This is good for many SYSV+BSD hybrids with NIS, probably also for HP-UX 7.x.
  403.   hpux hpux8 hpux9:
  404. !     @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  405. !     LIBS= RANLIB=echo ARFLAGS=rv AUX_OBJ=environ.o \
  406.       NETGROUP=-DNETGROUP TLI= all
  407.   
  408. + # ConvexOS-10.x with UltraNet support (ukkonen@csc.fi).
  409. + convex-ultranet:
  410. +     @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  411. +     LIBS=-lulsock RANLIB=ranlib ARFLAGS=rv AUX_OBJ=environ.o \
  412. +     NETGROUP=-DNETGROUP TLI= all
  413. + # Dynix/PTX has TLI, but the support is not as complete as with SYSV4.
  414. + dynix-ptx:
  415. +     @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  416. +     LIBS="-lsocket -linet -lnsl" RANLIB=echo ARFLAGS=rv \
  417. +     AUX_OBJ="environ.o strcasecmp.o" NETGROUP= TLI=-DTLI_SOCKETS all
  418.   # IRIX 4.0.x has a special ar(1) flag.
  419.   irix:
  420. !     @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  421. !     LIBS=-lsun RANLIB=echo ARFLAGS=rvs AUX_OBJ=environ.o \
  422.       NETGROUP=-DNETGROUP TLI= all
  423.   
  424.   # SunOS 5.x is close enough to generic System V.4
  425.   sunos5 esix sysv4:
  426. !     @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  427. !     LIBS="-lsocket -lnsl" RANLIB=echo ARFLAGS=rv \
  428. !     NETGROUP=-DNETGROUP AUX_OBJ=environ.o TLI=-DTLI all
  429.   
  430.   # DG/UX 5.4.1 is like SYSV.4 but slightly different.
  431.   dgux:
  432. !     @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  433. !     LIBS=-lnsl RANLIB=echo ARFLAGS=rv \
  434. !     NETGROUP=-DNETGROUP AUX_OBJ=environ.o TLI=-DTLI \
  435.       BUGS="$(BUGS) -DINET_ADDR_BUG" all
  436.   
  437. ! # SCO OpenDesktop 2.0, release 3.2 (peter@midnight.com).
  438. ! sco-od2:
  439. !     @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  440. !     LIBS="-lrpcsvc -lrpc -lyp -lrpc -lrpcsvc -lsocket" \
  441. !     RANLIB=echo ARFLAGS=rv AUX_OBJ=environ.o \
  442. !     NETGROUP=-DNETGROUP TLI="" all
  443.   
  444. ! # SCO 3.2v4.2 with TCP/IP 1.2.1 (Eduard.Vopicka@vse.cz)
  445. ! sco-nis:
  446. !     @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  447. !     LIBS="-lyp -lrpc -lsocket -lyp -lc_s -lc" \
  448. !     RANLIB=echo ARFLAGS=rv AUX_OBJ=environ.o \
  449. !     NETGROUP=-DNETGROUP TLI= EXTRA_CFLAGS="-nointl" all
  450.   
  451. + # Domain SR10.4. Build under bsd, run under either sysv3 or bsd43.
  452. + apollo:
  453. +     @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  454. +     LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ=environ.o \
  455. +     NETGROUP=-DNETGROUP TLI= SYSTYPE="-A run,any -A sys,any" all
  456. + # Untested.
  457. + mips:
  458. +     @echo "Warning: some definitions may be wrong."
  459. +     make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  460. +     LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ=environ.o \
  461. +     NETGROUP=-DNETGROUP TLI= SYSTYPE="-sysname bsd43" all
  462. + # Untested.
  463.   isc:
  464. !     @echo "Warning: some definitions may be wrong."
  465. !     make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  466. !     LIBS="-linet -lnsl_s -ldbm" RANLIB=echo ARFLAGS=rv \
  467. !     AUX_OBJ="environ.o strcasecmp.o" NETGROUP= TLI= all
  468.   
  469. + # Untested. Borrow me a Cray?
  470.   unicos:
  471.       @echo "Warning: some definitions may be wrong."
  472. !     make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  473. !     LIBS=-lnet RANLIB=echo ARFLAGS=rv \
  474. !     AUX_OBJ="environ.o strcasecmp.o" NETGROUP= TLI= all
  475.   
  476.   ###############################################################
  477.   # System dependencies: TLI (transport-level interface) support.
  478. ***************
  479. *** 166,183 ****
  480.   #############################################################################
  481.   # System dependencies: routines that are not present in the system libraries.
  482.   # 
  483. ! # If your system library does not have setenv(), strcasecmp() or strtok(),
  484. ! # use the ones provided with this source distribution.
  485.   
  486. ! AUX_OBJ= setenv.o
  487. ! #AUX_OBJ= setenv.o strcasecmp.o
  488. ! #AUX_OBJ= setenv.o strcasecmp.o strtok.o
  489.   
  490.   # Uncomment the following if your C library does not provide the
  491.   # strchr/strrchr/memcmp routines, but comes with index/rindex/bcmp.  If
  492.   # that is the case, you probably also do not have strtok() (see above).
  493.   #
  494. ! #STRINGS= -Dstrchr=index -Dstrrchr=rindex -Dmemcmp=bcmp
  495.   
  496.   #################################################################
  497.   # System dependencies: selection of non-default object libraries.
  498. --- 230,248 ----
  499.   #############################################################################
  500.   # System dependencies: routines that are not present in the system libraries.
  501.   # 
  502. ! # If your system library does not have set/putenv(), strcasecmp() or strtok(),
  503. ! # use the ones provided with this source distribution. The environ.c module
  504. ! # implements setenv(), getenv(), and putenv().
  505.   
  506. ! AUX_OBJ= environ.o
  507. ! #AUX_OBJ= environ.o strcasecmp.o
  508. ! #AUX_OBJ= environ.o strcasecmp.o strtok.o
  509.   
  510.   # Uncomment the following if your C library does not provide the
  511.   # strchr/strrchr/memcmp routines, but comes with index/rindex/bcmp.  If
  512.   # that is the case, you probably also do not have strtok() (see above).
  513.   #
  514. ! #STRINGS= -Dstrchr=index -Dstrrchr=rindex -Dmemcmp=bcmp -Dno_memcpy
  515.   
  516.   #################################################################
  517.   # System dependencies: selection of non-default object libraries.
  518. ***************
  519. *** 400,406 ****
  520.   KIT    = README miscd.c tcpd.c fromhost.c hosts_access.c shell_cmd.c \
  521.       log_tcp.h try.c refuse.c Makefile hosts_access.5 strcasecmp.c \
  522.       BLURB rfc931.c tcpd.8 hosts_info.c hosts_access.3 hosts_ctl.c \
  523. !     percent_x.c options.c clean_exit.c setenv.c patchlevel.h strtok.c \
  524.       fix_options.c workarounds.c socket.c tli.c DISCLAIMER \
  525.       fakelog.c safe_finger.c hosts_options.5 options.h CHANGES \
  526.       try-from.c init_client.c 6compat.c
  527. --- 465,471 ----
  528.   KIT    = README miscd.c tcpd.c fromhost.c hosts_access.c shell_cmd.c \
  529.       log_tcp.h try.c refuse.c Makefile hosts_access.5 strcasecmp.c \
  530.       BLURB rfc931.c tcpd.8 hosts_info.c hosts_access.3 hosts_ctl.c \
  531. !     percent_x.c options.c clean_exit.c environ.c patchlevel.h strtok.c \
  532.       fix_options.c workarounds.c socket.c tli.c DISCLAIMER \
  533.       fakelog.c safe_finger.c hosts_options.5 options.h CHANGES \
  534.       try-from.c init_client.c 6compat.c
  535. ***************
  536. *** 410,422 ****
  537.   all other: config-check tcpd try try-from safe_finger
  538.   
  539.   config-check:
  540. !     @set +e; test -n "$(REAL_DAEMON_DIR)" || { \
  541. !      echo "" ; \
  542. !      echo "Please edit the Makefile to define the REAL_DAEMON_DIR macro,";\
  543. !      echo "or build with \`make REAL_DAEMON_DIR=/some/where ....'";\
  544. !      echo "" ; \
  545. !      exit 1; \
  546. !     }
  547.   
  548.   $(LIB):    $(LIB_OBJ)
  549.       rm -f $(LIB)
  550. --- 475,481 ----
  551.   all other: config-check tcpd try try-from safe_finger
  552.   
  553.   config-check:
  554. !     @set +e; test -n "$(REAL_DAEMON_DIR)" || { make; exit 1; }
  555.   
  556.   $(LIB):    $(LIB_OBJ)
  557.       rm -f $(LIB)
  558. ***************
  559. *** 430,436 ****
  560.       $(CC) $(CFLAGS) -o $@ miscd.o fromhost.o $(LIB) $(LIBS)
  561.   
  562.   safe_finger:
  563. !     $(CC) $(CFLAGS) -o $@ safe_finger.c
  564.   
  565.   try:    try.o fakelog.o $(LIB)
  566.       $(CC) $(CFLAGS) -o $@ try.o fakelog.o $(LIB) $(LIBS)
  567. --- 489,495 ----
  568.       $(CC) $(CFLAGS) -o $@ miscd.o fromhost.o $(LIB) $(LIBS)
  569.   
  570.   safe_finger:
  571. !     $(CC) $(CFLAGS) -o $@ safe_finger.c $(LIB) $(LIBS)
  572.   
  573.   try:    try.o fakelog.o $(LIB)
  574.       $(CC) $(CFLAGS) -o $@ try.o fakelog.o $(LIB) $(LIBS)
  575. ***************
  576. *** 462,468 ****
  577.       -DREAL_DAEMON_DIR=\"$(REAL_DAEMON_DIR)\" \
  578.       tcpd.c fromhost.c socket.c tli.c hosts_access.c shell_cmd.c \
  579.       refuse.c rfc931.c hosts_info.c percent_x.c clean_exit.c options.c \
  580. !     setenv.c fix_options.c workarounds.c init_client.c
  581.   
  582.   miscd_lint:
  583.       lint -DFACILITY=LOG_MAIL -DHOSTS_ACCESS -DPARANOID -DNETGROUP \
  584. --- 521,527 ----
  585.       -DREAL_DAEMON_DIR=\"$(REAL_DAEMON_DIR)\" \
  586.       tcpd.c fromhost.c socket.c tli.c hosts_access.c shell_cmd.c \
  587.       refuse.c rfc931.c hosts_info.c percent_x.c clean_exit.c options.c \
  588. !     environ.c fix_options.c workarounds.c init_client.c
  589.   
  590.   miscd_lint:
  591.       lint -DFACILITY=LOG_MAIL -DHOSTS_ACCESS -DPARANOID -DNETGROUP \
  592. ***************
  593. *** 472,482 ****
  594.       -DREAL_MISCD=\"$(REAL_DAEMON_DIR)/miscd\" \
  595.       miscd.c fromhost.c socket.c tli.c hosts_access.c shell_cmd.c \
  596.       refuse.c rfc931.c hosts_info.c percent_x.c clean_exit.c options.c \
  597. !     setenv.c fix_options.c workarounds.c init_client.c
  598.   
  599.   try_lint:
  600.       lint -DFACILITY=LOG_MAIL -DSEVERITY=$(SEVERITY) -DHOSTS_ACCESS \
  601. !     $(TABLES) -DNETGROUP -DPROCESS_OPTIONS \
  602.       try.c hosts_ctl.c hosts_access.c hosts_info.c percent_x.c options.c \
  603.       workarounds.c init_client.c
  604.   
  605. --- 531,541 ----
  606.       -DREAL_MISCD=\"$(REAL_DAEMON_DIR)/miscd\" \
  607.       miscd.c fromhost.c socket.c tli.c hosts_access.c shell_cmd.c \
  608.       refuse.c rfc931.c hosts_info.c percent_x.c clean_exit.c options.c \
  609. !     environ.c fix_options.c workarounds.c init_client.c
  610.   
  611.   try_lint:
  612.       lint -DFACILITY=LOG_MAIL -DSEVERITY=$(SEVERITY) -DHOSTS_ACCESS \
  613. !     $(TABLES) -DNETGROUP -DPROCESS_OPTIONS -DRFC931_TIMEOUT=10 \
  614.       try.c hosts_ctl.c hosts_access.c hosts_info.c percent_x.c options.c \
  615.       workarounds.c init_client.c
  616.   
  617. ***************
  618. *** 483,489 ****
  619.   printfck:
  620.       printfck -f printf.ck tcpd.c fromhost.c socket.c tli.c hosts_access.c shell_cmd.c \
  621.       refuse.c rfc931.c hosts_info.c percent_x.c clean_exit.c options.c \
  622. !     setenv.c fix_options.c workarounds.c init_client.c >aap.c
  623.       lint -DFACILITY=LOG_MAIL -DHOSTS_ACCESS -DPARANOID -DNETGROUP \
  624.       -DGETPEERNAME_BUG -DDAEMON_UMASK=022 -DSEVERITY=$(SEVERITY) \
  625.       $(TABLES) -DKILL_IP_OPTIONS -DPROCESS_OPTIONS \
  626. --- 542,548 ----
  627.   printfck:
  628.       printfck -f printf.ck tcpd.c fromhost.c socket.c tli.c hosts_access.c shell_cmd.c \
  629.       refuse.c rfc931.c hosts_info.c percent_x.c clean_exit.c options.c \
  630. !     environ.c fix_options.c workarounds.c init_client.c >aap.c
  631.       lint -DFACILITY=LOG_MAIL -DHOSTS_ACCESS -DPARANOID -DNETGROUP \
  632.       -DGETPEERNAME_BUG -DDAEMON_UMASK=022 -DSEVERITY=$(SEVERITY) \
  633.       $(TABLES) -DKILL_IP_OPTIONS -DPROCESS_OPTIONS \
  634. ***************
  635. *** 494,499 ****
  636. --- 553,559 ----
  637.   # Compilation dependencies.
  638.   
  639.   clean_exit.o: log_tcp.h Makefile
  640. + environ.o: Makefile
  641.   fix_options.o: log_tcp.h Makefile
  642.   fromhost.o: log_tcp.h Makefile
  643.   hosts_access.o: options.h log_tcp.h Makefile
  644. diff -c ../6.0/README ./README
  645. *** ../6.0/README    Tue Dec 21 21:37:51 1993
  646. --- ./README    Tue Dec 21 21:37:09 1993
  647. ***************
  648. *** 1,6 ****
  649. ! @(#) README 1.17 93/09/28 23:03:22
  650.   
  651. ! This is the 6.0 version of the TCP/IP daemon wrapper package.
  652.   
  653.   Table of contents
  654.   -----------------
  655. --- 1,6 ----
  656. ! @(#) README 1.18 93/12/13 22:22:59
  657.   
  658. ! This is the 6.1 version of the TCP/IP daemon wrapper package.
  659.   
  660.   Table of contents
  661.   -----------------
  662. ***************
  663. *** 57,63 ****
  664.   SunOS >= 3.4 and ISC 2.2. Later versions have been installed on a wide
  665.   variety of platforms such as SunOS 4.x and 5.x, Ultrix 3.x and 4.x, DEC
  666.   OSF/1 T1.2-2, HP-UX 8.x, AIX 3.1.5 up to 3.2.4, Apollo SR10.3.5, Sony,
  667. ! NeXT, SCO UNIX, DG/UX, Cray, and an unknown number of other ones.
  668.   
  669.   Requirements are that the network daemons are spawned by a super server
  670.   such as the inetd; a 4.3BSD-style socket programming interface and/or
  671. --- 57,63 ----
  672.   SunOS >= 3.4 and ISC 2.2. Later versions have been installed on a wide
  673.   variety of platforms such as SunOS 4.x and 5.x, Ultrix 3.x and 4.x, DEC
  674.   OSF/1 T1.2-2, HP-UX 8.x, AIX 3.1.5 up to 3.2.4, Apollo SR10.3.5, Sony,
  675. ! NeXT, SCO UNIX, DG/UX, Cray, Dynix, and an unknown number of other ones.
  676.   
  677.   Requirements are that the network daemons are spawned by a super server
  678.   such as the inetd; a 4.3BSD-style socket programming interface and/or
  679. ***************
  680. *** 469,474 ****
  681. --- 469,479 ----
  682.   remote host address (and hence, the name) in case of UDP requests.
  683.   A patch is available for ConvexOS 10.1; later releases should be OK.
  684.   
  685. + With early Solaris (SunOS 5) versions, the syslog daemon will leave
  686. + behind zombie process when writing to logged-in users.  Workaround:
  687. + increase the syslogd threshold for logging to users, or reduce the
  688. + wrapper's logging severity.
  689.   On some systems, the optional RFC 931 remote username lookups may
  690.   trigger a kernel bug.  When a client host connects to your system, and
  691.   the RFC 931 connection from your system to that client is rejected by a
  692. ***************
  693. *** 569,574 ****
  694. --- 574,584 ----
  695.   network daemons live in /usr/libexec, /usr/sbin or in /etc, or have no
  696.   "in." prefix to their names, but you get the idea.
  697.   
  698. + File protections: the wrapper, all files used by the wrapper, and all
  699. + directories in the path leading to those files, should be accessible
  700. + but not writable for unprivileged users (mode 755 or mode 555). Do not
  701. + install the wrapper set-uid.
  702.   Ultrix only:  If you want to monitor the SYSTAT service, move the
  703.   vendor-provided miscd daemon to the location specified by the
  704.   REAL_DAEMON_DIR macro in the Makefile, and install the miscd wrapper
  705. ***************
  706. *** 618,626 ****
  707.   
  708.   Install the tcpd command in a suitable place. Apollo UNIX users will
  709.   want to install it under a different name because the name "tcpd" is
  710. ! already taken; a suitable name for the wrapper program would be
  711. ! "frontd".  Then perform the following edits on the inetd configuration
  712. ! file (usually /etc/inetd.conf or /etc/inet/inetd.conf):
  713.   
  714.       finger  stream  tcp     nowait  nobody  /usr/etc/in.fingerd     in.fingerd
  715.                                               ^^^^^^^^^^^^^^^^^^^
  716. --- 628,642 ----
  717.   
  718.   Install the tcpd command in a suitable place. Apollo UNIX users will
  719.   want to install it under a different name because the name "tcpd" is
  720. ! already taken; a suitable name would be "frontd".  
  721. ! File protections: the wrapper, all files used by the wrapper, and all
  722. ! directories in the path leading to those files, should be accessible
  723. ! but not writable for unprivileged users (mode 755 or mode 555). Do not
  724. ! install the wrapper set-uid.
  725. ! Then perform the following edits on the inetd configuration file
  726. ! (usually /etc/inetd.conf or /etc/inet/inetd.conf):
  727.   
  728.       finger  stream  tcp     nowait  nobody  /usr/etc/in.fingerd     in.fingerd
  729.                                               ^^^^^^^^^^^^^^^^^^^
  730. diff -c ../6.0/environ.c ./environ.c
  731. *** ../6.0/environ.c    Tue Dec 21 21:39:12 1993
  732. --- ./environ.c    Tue Dec 21 21:37:20 1993
  733. ***************
  734. *** 0 ****
  735. --- 1,224 ----
  736. + /*
  737. +  * Many systems have putenv() but no setenv(). Other systems have setenv()
  738. +  * but no putenv() (MIPS). Still other systems have neither (NeXT). This is a
  739. +  * re-implementation that hopefully ends all problems.
  740. +  *
  741. +  * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
  742. +  */
  743. + #ifndef lint
  744. + static char sccsid[] = "@(#) environ.c 1.3 93/10/30 15:38:58";
  745. + #endif
  746. + /* System libraries. */
  747. + extern char **environ;
  748. + extern char *strchr();
  749. + extern char *strcpy();
  750. + extern char *strncpy();
  751. + extern char *malloc();
  752. + extern char *realloc();
  753. + extern int strncmp();
  754. + extern void free();
  755. + #ifdef no_memcpy
  756. + #define memcpy(d,s,l) bcopy(s,d,l)
  757. + #else
  758. + extern char *memcpy();
  759. + #endif
  760. + /* Local stuff. */
  761. + static int addenv();            /* append entry to environment */
  762. + static int allocated = 0;        /* environ is, or is not, allocated */
  763. + #define DO_CLOBBER    1
  764. + /* namelength - determine length of name in "name=whatever" */
  765. + static int namelength(name)
  766. + char   *name;
  767. + {
  768. +     char   *equal;
  769. +     equal = strchr(name, '=');
  770. +     return ((equal == 0) ? strlen(name) : (equal - name));
  771. + }
  772. + /* findenv - given name, locate name=value */
  773. + static char **findenv(name, len)
  774. + char   *name;
  775. + int     len;
  776. + {
  777. +     char  **envp;
  778. +     for (envp = environ; *envp; envp++)
  779. +     if (strncmp(name, *envp, len) == 0 && (*envp)[len] == '=')
  780. +         return (envp);
  781. +     return (0);
  782. + }
  783. + /* getenv - given name, locate value */
  784. + char   *getenv(name)
  785. + char   *name;
  786. + {
  787. +     int     len = namelength(name);
  788. +     char  **envp = findenv(name, len);
  789. +     return (envp ? *envp + len + 1 : 0);
  790. + }
  791. + /* putenv - update or append environment (name,value) pair */
  792. + int     putenv(nameval)
  793. + char   *nameval;
  794. + {
  795. +     char   *equal = strchr(nameval, '=');
  796. +     char   *value = (equal ? equal : "");
  797. +     return (setenv(nameval, value, DO_CLOBBER));
  798. + }
  799. + /* unsetenv - remove variable from environment */
  800. + void    unsetenv(name)
  801. + char   *name;
  802. + {
  803. +     char  **envp;
  804. +     if ((envp = findenv(name, namelength(name))) != 0)
  805. +     while (envp[0] = envp[1])
  806. +         envp++;
  807. + }
  808. + /* setenv - update or append environment (name,value) pair */
  809. + int     setenv(name, value, clobber)
  810. + char   *name;
  811. + char   *value;
  812. + int     clobber;
  813. + {
  814. +     char   *destination;
  815. +     char  **envp;
  816. +     int     l_name;            /* length of name part */
  817. +     int     l_nameval;            /* length of name=value */
  818. +     /* Permit name= and =value. */
  819. +     l_name = namelength(name);
  820. +     envp = findenv(name, l_name);
  821. +     if (envp != 0 && clobber == 0)
  822. +     return (0);
  823. +     if (*value == '=')
  824. +     value++;
  825. +     l_nameval = l_name + strlen(value) + 1;
  826. +     /*
  827. +      * Use available memory if the old value is long enough. Never free an
  828. +      * old name=value entry because it may not be allocated.
  829. +      */
  830. +     destination = (envp != 0 && strlen(*envp) >= l_nameval) ?
  831. +     *envp : malloc(l_nameval + 1);
  832. +     if (destination == 0)
  833. +     return (-1);
  834. +     strncpy(destination, name, l_name);
  835. +     destination[l_name] = '=';
  836. +     strcpy(destination + l_name + 1, value);
  837. +     return ((envp == 0) ? addenv(destination) : (*envp = destination, 0));
  838. + }
  839. + /* cmalloc - malloc and copy block of memory */
  840. + static char *cmalloc(new_len, old, old_len)
  841. + char   *old;
  842. + int     old_len;
  843. + {
  844. +     char   *new = malloc(new_len);
  845. +     if (new != 0)
  846. +     memcpy(new, old, old_len);
  847. +     return (new);
  848. + }
  849. + /* addenv - append environment entry */
  850. + static int addenv(nameval)
  851. + char   *nameval;
  852. + {
  853. +     char  **envp;
  854. +     int     n_used;            /* number of environment entries */
  855. +     int     l_used;            /* bytes used excl. terminator */
  856. +     int     l_need;            /* bytes needed incl. terminator */
  857. +     for (envp = environ; *envp; envp++)
  858. +      /* void */ ;
  859. +     n_used = envp - environ;
  860. +     l_used = n_used * sizeof(*envp);
  861. +     l_need = l_used + 2 * sizeof(*envp);
  862. +     envp = allocated ?
  863. +     (char **) realloc((char *) environ, l_need) :
  864. +     (char **) cmalloc(l_need, (char *) environ, l_used);
  865. +     if (envp == 0) {
  866. +     return (-1);
  867. +     } else {
  868. +     allocated = 1;
  869. +     environ = envp;
  870. +     environ[n_used++] = nameval;        /* add new entry */
  871. +     environ[n_used] = 0;            /* terminate list */
  872. +     return (0);
  873. +     }
  874. + }
  875. + #ifdef TEST
  876. +  /*
  877. +   * Stand-alone program for test purposes.
  878. +   */
  879. + /* printenv - display environment */
  880. + static void printenv()
  881. + {
  882. +     char  **envp;
  883. +     for (envp = environ; *envp; envp++)
  884. +     printf("%s\n", *envp);
  885. + }
  886. + int     main(argc, argv)
  887. + int     argc;
  888. + char  **argv;
  889. + {
  890. +     char   *cp;
  891. +     int     changed = 0;
  892. +     if (argc < 2) {
  893. +     printf("usage: %s name[=value]...\n", argv[0]);
  894. +     return (1);
  895. +     }
  896. +     while (--argc && *++argv) {
  897. +     if (argv[0][0] == '-') {        /* unsetenv() test */
  898. +         unsetenv(argv[0] + 1);
  899. +         changed = 1;
  900. +     } else if (strchr(argv[0], '=') == 0) {    /* getenv() test */
  901. +         cp = getenv(argv[0]);
  902. +         printf("%s: %s\n", argv[0], cp ? cp : "not found");
  903. +     } else {                /* putenv() test */
  904. +         if (putenv(argv[0])) {
  905. +         perror("putenv");
  906. +         return (1);
  907. +         }
  908. +         changed = 1;
  909. +     }
  910. +     }
  911. +     if (changed)
  912. +     printenv();
  913. +     return (0);
  914. + }
  915. + #endif /* TEST */
  916. diff -c ../6.0/fromhost.c ./fromhost.c
  917. *** ../6.0/fromhost.c    Tue Dec 21 21:37:53 1993
  918. --- ./fromhost.c    Tue Dec 21 21:37:11 1993
  919. ***************
  920. *** 23,29 ****
  921.     */
  922.   
  923.   #ifndef lint
  924. ! static char sccsid[] = "@(#) fromhost.c 1.13 93/09/24 19:16:08";
  925.   #endif
  926.   
  927.   /* System libraries. */
  928. --- 23,29 ----
  929.     */
  930.   
  931.   #ifndef lint
  932. ! static char sccsid[] = "@(#) fromhost.c 1.14 93/12/13 22:23:05";
  933.   #endif
  934.   
  935.   /* System libraries. */
  936. ***************
  937. *** 32,38 ****
  938.   #include <stdio.h>
  939.   #include <syslog.h>
  940.   
  941. ! #ifdef TLI
  942.   #include <sys/tiuser.h>
  943.   #include <stropts.h>
  944.   #endif
  945. --- 32,38 ----
  946.   #include <stdio.h>
  947.   #include <syslog.h>
  948.   
  949. ! #if defined(TLI) || defined(TLI_SOCKETS)
  950.   #include <sys/tiuser.h>
  951.   #include <stropts.h>
  952.   #endif
  953. ***************
  954. *** 41,46 ****
  955. --- 41,60 ----
  956.   
  957.   #include "log_tcp.h"
  958.   
  959. + #if !defined(TLI) && !defined(TLI_SOCKETS)
  960. + /* fromhost - compatibility wrapper for socket-only systems */
  961. + int     fromhost(client)
  962. + struct client_info *client;
  963. + {
  964. +     int     client_fd = 0;        /* XXX compatibility */
  965. +     return (sock_host(client, client_fd));
  966. + }
  967. + #endif /* !defined(TLI) && !defined(TLI_SOCKETS) */
  968.   #ifdef TLI
  969.   
  970.   /* fromhost - find out what network API we should use */
  971. ***************
  972. *** 48,53 ****
  973. --- 62,68 ----
  974.   int     fromhost(client)
  975.   struct client_info *client;
  976.   {
  977. +     int     client_fd = 0;        /* XXX compatibility */
  978.   
  979.       /*
  980.        * On systems with streams support the IP network protocol family may
  981. ***************
  982. *** 58,71 ****
  983.        * so if stdin is not a stream we assume sockets.
  984.        */
  985.   
  986. !     if (!isastream(client->fd))
  987. !     return (sock_host(client));
  988. !     if (ioctl(0, I_FIND, "timod") > 0)
  989. !     return (tli_host(client));
  990. !     if (ioctl(0, I_FIND, "sockmod") > 0)
  991. !     return (sock_host(client));
  992. !     syslog(LOG_ERR, "wrapper: cannot establish type of transport interface");
  993. !     return (0);
  994.   }
  995.   
  996.   #endif /* TLI */
  997. --- 73,116 ----
  998.        * so if stdin is not a stream we assume sockets.
  999.        */
  1000.   
  1001. !     if (ioctl(client_fd, I_FIND, "timod") > 0) {
  1002. !     return (tli_host(client, client_fd));
  1003. !     } else {
  1004. !     return (sock_host(client, client_fd));
  1005. !     }
  1006.   }
  1007.   
  1008.   #endif /* TLI */
  1009. + #ifdef TLI_SOCKETS
  1010. + /* fromhost - use socket primitives even with TLI */
  1011. + int     fromhost(client)
  1012. + struct client_info *client;
  1013. + {
  1014. +     int     client_fd = 0;        /* XXX compatibility */
  1015. +     int     ret;
  1016. +     /*
  1017. +      * Some System V.3 based systems have TLI but the supporting libraries
  1018. +      * are not as complete as with System V.4. Dynix/PTX is an example. The
  1019. +      * workaround is to temporarily switch to the socket interface, identify
  1020. +      * the client name/address with socket calls, then to switch back to TLI.
  1021. +      */
  1022. + #define SWAP_MODULE(f, old, new) (ioctl(f, I_POP, old), ioctl(f, I_PUSH, new))
  1023. +     if (ioctl(client_fd, I_FIND, "timod") > 0) {
  1024. +     if (SWAP_MODULE(client_fd, "timod", "sockmod") != 0)
  1025. +         syslog(LOG_ERR, "swap timod for sockmod: %m");
  1026. +     ret = sock_host(client, client_fd);
  1027. +     if (SWAP_MODULE(client_fd, "sockmod", "timod") != 0)
  1028. +         syslog(LOG_ERR, "swap sockmod for timod: %m");
  1029. +     return (ret);
  1030. +     } else {
  1031. +     return (sock_host(client, client_fd));
  1032. +     }
  1033. + }
  1034. + #endif /* TLI_SOCKETS */
  1035. diff -c ../6.0/hosts_access.3 ./hosts_access.3
  1036. *** ../6.0/hosts_access.3    Tue Dec 21 21:37:59 1993
  1037. --- ./hosts_access.3    Tue Dec 21 21:37:17 1993
  1038. ***************
  1039. *** 1,5 ****
  1040.   .TH HOSTS_ACCESS 3
  1041. ! .SH
  1042.   hosts_access, hosts_ctl \- access control library
  1043.   .SH SYNOPSIS
  1044.   .nf
  1045. --- 1,5 ----
  1046.   .TH HOSTS_ACCESS 3
  1047. ! .SH NAME
  1048.   hosts_access, hosts_ctl \- access control library
  1049.   .SH SYNOPSIS
  1050.   .nf
  1051. ***************
  1052. *** 63,66 ****
  1053.   Department of Mathematics and Computing Science
  1054.   Eindhoven University of Technology
  1055.   Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
  1056. ! \" @(#) hosts_access.3 1.4 93/09/27 18:59:08
  1057. --- 63,66 ----
  1058.   Department of Mathematics and Computing Science
  1059.   Eindhoven University of Technology
  1060.   Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
  1061. ! \" @(#) hosts_access.3 1.5 93/12/13 22:23:07
  1062. diff -c ../6.0/hosts_options.5 ./hosts_options.5
  1063. *** ../6.0/hosts_options.5    Tue Dec 21 21:38:05 1993
  1064. --- ./hosts_options.5    Tue Dec 21 21:37:24 1993
  1065. ***************
  1066. *** 117,127 ****
  1067.   .sp
  1068.   Warning: many network daemons reset their environment before spawning a
  1069.   login or shell process.
  1070. ! .IP rfc931
  1071.   Look up the remote user name with the RFC 931 protocol.  This option is
  1072.   silently ignored in case of services based on transports other than
  1073.   TCP.  Requires that the remote system runs an RFC 931-compliant daemon,
  1074.   and may cause noticeable delays with connections from non-UNIX hosts.
  1075.   .SH DIAGNOSTICS
  1076.   An error is reported when a syntax error is found in a host access
  1077.   control rule; further options will be ignored, and service is denied.
  1078. --- 117,129 ----
  1079.   .sp
  1080.   Warning: many network daemons reset their environment before spawning a
  1081.   login or shell process.
  1082. ! .IP "rfc931 [= timeout]"
  1083.   Look up the remote user name with the RFC 931 protocol.  This option is
  1084.   silently ignored in case of services based on transports other than
  1085.   TCP.  Requires that the remote system runs an RFC 931-compliant daemon,
  1086.   and may cause noticeable delays with connections from non-UNIX hosts.
  1087. + The timeout period (in seconds) is optional. If no timeout is specified
  1088. + a default value is taken.
  1089.   .SH DIAGNOSTICS
  1090.   An error is reported when a syntax error is found in a host access
  1091.   control rule; further options will be ignored, and service is denied.
  1092. ***************
  1093. *** 134,137 ****
  1094.   Department of Mathematics and Computing Science
  1095.   Eindhoven University of Technology
  1096.   Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
  1097. ! \" @(#) hosts_options.5 1.7 93/09/27 23:42:15
  1098. --- 136,139 ----
  1099.   Department of Mathematics and Computing Science
  1100.   Eindhoven University of Technology
  1101.   Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
  1102. ! \" @(#) hosts_options.5 1.8 93/12/13 22:23:09
  1103. diff -c ../6.0/log_tcp.h ./log_tcp.h
  1104. *** ../6.0/log_tcp.h    Tue Dec 21 21:37:54 1993
  1105. --- ./log_tcp.h    Tue Dec 21 21:37:13 1993
  1106. ***************
  1107. *** 1,4 ****
  1108. ! /* @(#) log_tcp.h 1.10 93/09/27 18:59:13 */
  1109.   
  1110.   /* Structure filled in by the fromhost() routine. */
  1111.   
  1112. --- 1,4 ----
  1113. ! /* @(#) log_tcp.h 1.11 93/12/13 22:23:12 */
  1114.   
  1115.   /* Structure filled in by the fromhost() routine. */
  1116.   
  1117. ***************
  1118. *** 26,35 ****
  1119.   
  1120.   /* Global functions. */
  1121.   
  1122. - #ifndef TLI
  1123. - #define fromhost sock_host
  1124. - #endif
  1125.   extern int fromhost();            /* get/validate remote host info */
  1126.   extern int hosts_access();        /* access control */
  1127.   extern void refuse();            /* refuse request */
  1128. --- 26,31 ----
  1129. ***************
  1130. *** 50,55 ****
  1131. --- 46,52 ----
  1132.   extern char *hosts_deny_table;        /* for verification mode redirection */
  1133.   extern char *hosts_access_file;        /* for diagnostics */
  1134.   extern int hosts_access_line;        /* for diagnostics */
  1135. + extern int rfc931_timeout;        /* username lookup period */
  1136.   
  1137.   /* Bug workarounds. */
  1138.   
  1139. diff -c ../6.0/options.c ./options.c
  1140. *** ../6.0/options.c    Tue Dec 21 21:38:00 1993
  1141. --- ./options.c    Tue Dec 21 21:37:19 1993
  1142. ***************
  1143. *** 78,85 ****
  1144. --- 78,87 ----
  1145.   
  1146.   #define NEED_ARG    (1<<1)        /* option requires argument */
  1147.   #define USE_LAST    (1<<2)        /* option must be last */
  1148. + #define OPT_ARG        (1<<3)        /* option has optional argument */
  1149.   
  1150.   #define need_arg(o)    ((o)->flags & NEED_ARG)
  1151. + #define opt_arg(o)    ((o)->flags & OPT_ARG)
  1152.   #define use_last(o)    ((o)->flags & USE_LAST)
  1153.   
  1154.   /* List of known keywords. Add yours here. */
  1155. ***************
  1156. *** 91,97 ****
  1157.       "linger", linger_option, NEED_ARG,    /* change socket linger time */
  1158.       "spawn", spawn_option, NEED_ARG,    /* spawn shell command */
  1159.       "twist", twist_option, NEED_ARG | USE_LAST,    /* replace current process */
  1160. !     "rfc931", rfc931_option, 0,        /* do RFC 931 lookup */
  1161.       "setenv", setenv_option, NEED_ARG,    /* update environment */
  1162.       "severity", severity_option, NEED_ARG,    /* adjust logging level */
  1163.       "allow", allow_option, USE_LAST,    /* grant access */
  1164. --- 93,99 ----
  1165.       "linger", linger_option, NEED_ARG,    /* change socket linger time */
  1166.       "spawn", spawn_option, NEED_ARG,    /* spawn shell command */
  1167.       "twist", twist_option, NEED_ARG | USE_LAST,    /* replace current process */
  1168. !     "rfc931", rfc931_option, OPT_ARG,    /* do RFC 931 lookup */
  1169.       "setenv", setenv_option, NEED_ARG,    /* update environment */
  1170.       "severity", severity_option, NEED_ARG,    /* adjust logging level */
  1171.       "allow", allow_option, USE_LAST,    /* grant access */
  1172. ***************
  1173. *** 160,166 ****
  1174.           syslog(LOG_ERR, "error: %s, line %d: option \"%s\" requires value",
  1175.              hosts_access_file, hosts_access_line, key);
  1176.           longjmp(options_buf, OPT_DENY);
  1177. !     } else if (value && !need_arg(op)) {
  1178.           syslog(LOG_ERR, "error: %s, line %d: option \"%s\" cannot have value",
  1179.              hosts_access_file, hosts_access_line, key);
  1180.           longjmp(options_buf, OPT_DENY);
  1181. --- 162,168 ----
  1182.           syslog(LOG_ERR, "error: %s, line %d: option \"%s\" requires value",
  1183.              hosts_access_file, hosts_access_line, key);
  1184.           longjmp(options_buf, OPT_DENY);
  1185. !     } else if (value && !need_arg(op) && !opt_arg(op)) {
  1186.           syslog(LOG_ERR, "error: %s, line %d: option \"%s\" cannot have value",
  1187.              hosts_access_file, hosts_access_line, key);
  1188.           longjmp(options_buf, OPT_DENY);
  1189. ***************
  1190. *** 399,406 ****
  1191.   char   *daemon;
  1192.   struct client_info *client;
  1193.   {
  1194.       if (dry_run) {
  1195. !     syslog(LOG_DEBUG, "option: rfc931");
  1196.       return;
  1197.       }
  1198.       if (client->user[0] == 0 && RFC931_POSSIBLE(client))
  1199. --- 401,418 ----
  1200.   char   *daemon;
  1201.   struct client_info *client;
  1202.   {
  1203. +     int     timeout;
  1204. +     char    junk;
  1205. +     if (value) {
  1206. +     if (sscanf(value, "%d%c", &timeout, &junk) != 1 || timeout <= 0) {
  1207. +         syslog(LOG_ERR, "error: rfc931_option: bad timeout: \"%s\"", value);
  1208. +         longjmp(options_buf, OPT_DENY);
  1209. +     }
  1210. +     rfc931_timeout = timeout;
  1211. +     }
  1212.       if (dry_run) {
  1213. !     syslog(LOG_DEBUG, "option: rfc931 = %d", rfc931_timeout);
  1214.       return;
  1215.       }
  1216.       if (client->user[0] == 0 && RFC931_POSSIBLE(client))
  1217. diff -c ../6.0/patchlevel.h ./patchlevel.h
  1218. *** ../6.0/patchlevel.h    Tue Dec 21 21:38:01 1993
  1219. --- ./patchlevel.h    Tue Dec 21 21:37:20 1993
  1220. ***************
  1221. *** 1,3 ****
  1222.   #ifndef lint
  1223. ! static char patchlevel[] = "@(#) patchlevel 6.0";
  1224.   #endif
  1225. --- 1,3 ----
  1226.   #ifndef lint
  1227. ! static char patchlevel[] = "@(#) patchlevel 6.1";
  1228.   #endif
  1229. diff -c ../6.0/rfc931.c ./rfc931.c
  1230. *** ../6.0/rfc931.c    Tue Dec 21 21:37:58 1993
  1231. --- ./rfc931.c    Tue Dec 21 21:37:16 1993
  1232. ***************
  1233. *** 10,16 ****
  1234.     */
  1235.   
  1236.   #ifndef lint
  1237. ! static char sccsid[] = "@(#) rfc931.c 1.7 93/09/11 20:45:30";
  1238.   #endif
  1239.   
  1240.   /* System libraries. */
  1241. --- 10,16 ----
  1242.     */
  1243.   
  1244.   #ifndef lint
  1245. ! static char sccsid[] = "@(#) rfc931.c 1.8 93/12/13 22:23:20";
  1246.   #endif
  1247.   
  1248.   /* System libraries. */
  1249. ***************
  1250. *** 33,111 ****
  1251.   #define    RFC931_PORT    113        /* Semi-well-known port */
  1252.   #define    ANY_PORT    0        /* Any old port will do */
  1253.   
  1254.   static jmp_buf timebuf;
  1255.   
  1256. - typedef struct {
  1257. -     FILE   *ifp;
  1258. -     FILE   *ofp;
  1259. - } FILE_PAIR;
  1260. - /* fdup - duplicate a stdio stream */
  1261. - static FILE *fdup(stream, mode)
  1262. - FILE   *stream;
  1263. - char   *mode;
  1264. - {
  1265. -     int     fd;
  1266. -     FILE   *fp = 0;
  1267. -     if ((fd = dup(fileno(stream))) < 0) {
  1268. -     syslog(LOG_ERR, "dup: %m");
  1269. -     } else if ((fp = fdopen(fd, mode)) == 0) {
  1270. -     syslog(LOG_ERR, "fdopen: %m");
  1271. -     close(fd);
  1272. -     }
  1273. -     return (fp);
  1274. - }
  1275.   /* fsocket - open stdio stream on top of socket */
  1276.   
  1277. ! static FILE *fsocket(domain, type, protocol, mode)
  1278.   int     domain;
  1279.   int     type;
  1280.   int     protocol;
  1281. - char   *mode;
  1282.   {
  1283.       int     s;
  1284. !     FILE   *fp = 0;
  1285.   
  1286.       if ((s = socket(domain, type, protocol)) < 0) {
  1287.       syslog(LOG_ERR, "socket: %m");
  1288. !     } else if ((fp = fdopen(s, mode)) == 0) {
  1289. !     syslog(LOG_ERR, "fdopen: %m");
  1290. !     close(s);
  1291.       }
  1292. -     return (fp);
  1293.   }
  1294.   
  1295. - /* ffsocket - open stdio stream pair on top of socket */
  1296. - static FILE_PAIR *ffsocket(domain, type, protocol)
  1297. - int     domain;
  1298. - int     type;
  1299. - int     protocol;
  1300. - {
  1301. -     static FILE_PAIR ffp;
  1302. -     if ((ffp.ifp = fsocket(domain, type, protocol, "r")) != 0) {
  1303. -     if ((ffp.ofp = fdup(ffp.ifp, "w")) != 0)
  1304. -         return (&ffp);
  1305. -     fclose(ffp.ifp);
  1306. -     }
  1307. -     return (0);
  1308. - }
  1309. - /* ffclose - close stdio stream pair */
  1310. - static int ffclose(ffp)
  1311. - FILE_PAIR *ffp;
  1312. - {
  1313. -     int     ret;
  1314. -     ret = fclose(ffp->ifp);
  1315. -     return (fclose(ffp->ofp) || ret);
  1316. - }
  1317.   /* bind_connect - bind both ends of a socket */
  1318.   
  1319.   int     bind_connect(s, local, remote, length)
  1320. --- 33,64 ----
  1321.   #define    RFC931_PORT    113        /* Semi-well-known port */
  1322.   #define    ANY_PORT    0        /* Any old port will do */
  1323.   
  1324. + int     rfc931_timeout = RFC931_TIMEOUT;/* Global so it can be changed */
  1325.   static jmp_buf timebuf;
  1326.   
  1327.   /* fsocket - open stdio stream on top of socket */
  1328.   
  1329. ! static FILE *fsocket(domain, type, protocol)
  1330.   int     domain;
  1331.   int     type;
  1332.   int     protocol;
  1333.   {
  1334.       int     s;
  1335. !     FILE   *fp;
  1336.   
  1337.       if ((s = socket(domain, type, protocol)) < 0) {
  1338.       syslog(LOG_ERR, "socket: %m");
  1339. !     return (0);
  1340. !     } else {
  1341. !     if ((fp = fdopen(s, "r+")) == 0) {
  1342. !         syslog(LOG_ERR, "fdopen: %m");
  1343. !         close(s);
  1344. !     }
  1345. !     return (fp);
  1346.       }
  1347.   }
  1348.   
  1349.   /* bind_connect - bind both ends of a socket */
  1350.   
  1351.   int     bind_connect(s, local, remote, length)
  1352. ***************
  1353. *** 144,161 ****
  1354.       char    buffer[512];        /* XXX */
  1355.       char   *cp;
  1356.       char   *result = FROM_UNKNOWN;    /* XXX */
  1357. !     FILE_PAIR *ffp;
  1358.   
  1359.       /*
  1360. !      * Use separate stdio streams for writing to and for reading from the
  1361. !      * RFC931 etc. server. This is done because of a bug in the SunOS 4.1.x
  1362. !      * stdio library. The bug may live in other stdio implementations, too.
  1363. !      * When we use a single bidirectional stdio stream ("r+" or "w+" mode) we
  1364. !      * read our own output. Such behaviour would make sense with resources
  1365. !      * that support random-access operations, but not with sockets.
  1366.        */
  1367.   
  1368. !     if ((ffp = ffsocket(AF_INET, SOCK_STREAM, 0)) != 0) {
  1369.   
  1370.       /*
  1371.        * Set up a timer so we won't get stuck while waiting for the server.
  1372. --- 97,116 ----
  1373.       char    buffer[512];        /* XXX */
  1374.       char   *cp;
  1375.       char   *result = FROM_UNKNOWN;    /* XXX */
  1376. !     FILE   *fp;
  1377.   
  1378.       /*
  1379. !      * Use one unbuffered stdio stream for writing to and for reading from
  1380. !      * the RFC931 etc. server. This is done because of a bug in the SunOS
  1381. !      * 4.1.x stdio library. The bug may live in other stdio implementations,
  1382. !      * too. When we use a single, buffered, bidirectional stdio stream ("r+"
  1383. !      * or "w+" mode) we read our own output. Such behaviour would make sense
  1384. !      * with resources that support random-access operations, but not with
  1385. !      * sockets.
  1386.        */
  1387.   
  1388. !     if ((fp = fsocket(AF_INET, SOCK_STREAM, 0)) != 0) {
  1389. !     setbuf(fp, (char *) 0);
  1390.   
  1391.       /*
  1392.        * Set up a timer so we won't get stuck while waiting for the server.
  1393. ***************
  1394. *** 163,169 ****
  1395.   
  1396.       if (setjmp(timebuf) == 0) {
  1397.           signal(SIGALRM, timeout);
  1398. !         alarm(RFC931_TIMEOUT);
  1399.   
  1400.           /*
  1401.            * Bind the local and remote ends of the query socket to the same
  1402. --- 118,124 ----
  1403.   
  1404.       if (setjmp(timebuf) == 0) {
  1405.           signal(SIGALRM, timeout);
  1406. !         alarm(rfc931_timeout);
  1407.   
  1408.           /*
  1409.            * Bind the local and remote ends of the query socket to the same
  1410. ***************
  1411. *** 179,185 ****
  1412.           rmt_query_sin = *rmt_sin;
  1413.           rmt_query_sin.sin_port = htons(RFC931_PORT);
  1414.   
  1415. !         if (bind_connect(fileno(ffp->ifp),
  1416.                    (struct sockaddr *) & our_query_sin,
  1417.                    (struct sockaddr *) & rmt_query_sin,
  1418.                    sizeof(our_query_sin)) >= 0) {
  1419. --- 134,140 ----
  1420.           rmt_query_sin = *rmt_sin;
  1421.           rmt_query_sin.sin_port = htons(RFC931_PORT);
  1422.   
  1423. !         if (bind_connect(fileno(fp),
  1424.                    (struct sockaddr *) & our_query_sin,
  1425.                    (struct sockaddr *) & rmt_query_sin,
  1426.                    sizeof(our_query_sin)) >= 0) {
  1427. ***************
  1428. *** 190,199 ****
  1429.            * cause trouble with buggy System V stdio libraries.
  1430.            */
  1431.   
  1432. !         fprintf(ffp->ofp, "%u,%u\r\n",
  1433.               ntohs(rmt_sin->sin_port),
  1434.               ntohs(our_sin->sin_port));
  1435. !         fflush(ffp->ofp);
  1436.   
  1437.           /*
  1438.            * Read response from server. Use fgets()/sscanf() so we can
  1439. --- 145,154 ----
  1440.            * cause trouble with buggy System V stdio libraries.
  1441.            */
  1442.   
  1443. !         fprintf(fp, "%u,%u\r\n",
  1444.               ntohs(rmt_sin->sin_port),
  1445.               ntohs(our_sin->sin_port));
  1446. !         fflush(fp);
  1447.   
  1448.           /*
  1449.            * Read response from server. Use fgets()/sscanf() so we can
  1450. ***************
  1451. *** 202,209 ****
  1452.            * requested.
  1453.            */
  1454.   
  1455. !         if (fgets(buffer, sizeof(buffer), ffp->ifp) != 0
  1456. !             && ferror(ffp->ifp) == 0 && feof(ffp->ifp) == 0
  1457.               && sscanf(buffer, "%u , %u : USERID :%*[^:]:%255s",
  1458.                     &rmt_port, &our_port, user) == 3
  1459.               && ntohs(rmt_sin->sin_port) == rmt_port
  1460. --- 157,164 ----
  1461.            * requested.
  1462.            */
  1463.   
  1464. !         if (fgets(buffer, sizeof(buffer), fp) != 0
  1465. !             && ferror(fp) == 0 && feof(fp) == 0
  1466.               && sscanf(buffer, "%u , %u : USERID :%*[^:]:%255s",
  1467.                     &rmt_port, &our_port, user) == 3
  1468.               && ntohs(rmt_sin->sin_port) == rmt_port
  1469. ***************
  1470. *** 221,227 ****
  1471.           }
  1472.           alarm(0);
  1473.       }
  1474. !     ffclose(ffp);
  1475.       }
  1476.       return (result);
  1477.   }
  1478. --- 176,182 ----
  1479.           }
  1480.           alarm(0);
  1481.       }
  1482. !     fclose(fp);
  1483.       }
  1484.       return (result);
  1485.   }
  1486. diff -c ../6.0/safe_finger.c ./safe_finger.c
  1487. *** ../6.0/safe_finger.c    Tue Dec 21 21:38:05 1993
  1488. --- ./safe_finger.c    Tue Dec 21 21:37:24 1993
  1489. ***************
  1490. *** 15,21 ****
  1491.     */
  1492.   
  1493.   #ifndef lint
  1494. ! static char sccsid[] = "@(#) safe_finger.c 1.2 93/08/26 23:49:40";
  1495.   #endif
  1496.   
  1497.   /* System libraries */
  1498. --- 15,21 ----
  1499.     */
  1500.   
  1501.   #ifndef lint
  1502. ! static char sccsid[] = "@(#) safe_finger.c 1.3 93/12/13 22:23:23";
  1503.   #endif
  1504.   
  1505.   /* System libraries */
  1506. ***************
  1507. *** 30,36 ****
  1508.   
  1509.   /* Local stuff */
  1510.   
  1511. ! char    path[] = "PATH=/bin:/usr/bin:/usr/ucb:/etc:/usr/etc:/usr/sbin";
  1512.   
  1513.   #define    INPUT_LENGTH    100000        /* Do not keep listinging forever */
  1514.   #define    LINE_LENGTH    128        /* Editors can choke on long lines */
  1515. --- 30,36 ----
  1516.   
  1517.   /* Local stuff */
  1518.   
  1519. ! char    path[] = "PATH=/bin:/usr/bin:/usr/ucb:/usr/bsd:/etc:/usr/etc:/usr/sbin";
  1520.   
  1521.   #define    INPUT_LENGTH    100000        /* Do not keep listinging forever */
  1522.   #define    LINE_LENGTH    128        /* Editors can choke on long lines */
  1523. ***************
  1524. *** 67,73 ****
  1525.        * Redirect our standard input through the raw finger command.
  1526.        */
  1527.       if (putenv(path)) {
  1528. !     fprintf(stderr, "putenv: out of memory");
  1529.       exit(1);
  1530.       }
  1531.       argv[0] = FINGER_PROGRAM;
  1532. --- 67,73 ----
  1533.        * Redirect our standard input through the raw finger command.
  1534.        */
  1535.       if (putenv(path)) {
  1536. !     fprintf(stderr, "%s: putenv: out of memory", argv[0]);
  1537.       exit(1);
  1538.       }
  1539.       argv[0] = FINGER_PROGRAM;
  1540. diff -c ../6.0/socket.c ./socket.c
  1541. *** ../6.0/socket.c    Tue Dec 21 21:38:03 1993
  1542. --- ./socket.c    Tue Dec 21 21:37:22 1993
  1543. ***************
  1544. *** 17,23 ****
  1545.     */
  1546.   
  1547.   #ifndef lint
  1548. ! static char sccsid[] = "@(#) socket.c 1.7 93/09/27 18:59:20";
  1549.   #endif
  1550.   
  1551.   /* System libraries. */
  1552. --- 17,23 ----
  1553.     */
  1554.   
  1555.   #ifndef lint
  1556. ! static char sccsid[] = "@(#) socket.c 1.8 93/12/13 22:23:25";
  1557.   #endif
  1558.   
  1559.   /* System libraries. */
  1560. ***************
  1561. *** 63,70 ****
  1562.   
  1563.   /* sock_host - determine endpoint info */
  1564.   
  1565. ! int     sock_host(client)
  1566.   struct client_info *client;
  1567.   {
  1568.       static struct sockaddr rmt_sa;
  1569.       static struct sockaddr our_sa;
  1570. --- 63,71 ----
  1571.   
  1572.   /* sock_host - determine endpoint info */
  1573.   
  1574. ! int     sock_host(client, fd)
  1575.   struct client_info *client;
  1576. + int     fd;
  1577.   {
  1578.       static struct sockaddr rmt_sa;
  1579.       static struct sockaddr our_sa;
  1580. ***************
  1581. *** 76,81 ****
  1582. --- 77,83 ----
  1583.        */
  1584.   
  1585.       init_client(client);
  1586. +     client->fd = fd;
  1587.   
  1588.       /*
  1589.        * Look up the remote host address. Hal R. Brand <BRAND@addvax.llnl.gov>
  1590. diff -c ../6.0/tli.c ./tli.c
  1591. *** ../6.0/tli.c    Tue Dec 21 21:38:04 1993
  1592. --- ./tli.c    Tue Dec 21 21:37:22 1993
  1593. ***************
  1594. *** 17,23 ****
  1595.     */
  1596.   
  1597.   #ifndef lint
  1598. ! static char sccsid[] = "@(#) tli.c 1.7 93/09/27 18:59:25";
  1599.   #endif
  1600.   
  1601.   #ifdef TLI
  1602. --- 17,23 ----
  1603.     */
  1604.   
  1605.   #ifndef lint
  1606. ! static char sccsid[] = "@(#) tli.c 1.8 93/12/13 22:23:27";
  1607.   #endif
  1608.   
  1609.   #ifdef TLI
  1610. ***************
  1611. *** 75,82 ****
  1612.   
  1613.   /* tli_host - determine endpoint info */
  1614.   
  1615. ! int     tli_host(client)
  1616.   struct client_info *client;
  1617.   {
  1618.       struct netconfig *config;
  1619.       struct t_unitdata *rmt_unit;
  1620. --- 75,83 ----
  1621.   
  1622.   /* tli_host - determine endpoint info */
  1623.   
  1624. ! int     tli_host(client, fd)
  1625.   struct client_info *client;
  1626. + int     fd;
  1627.   {
  1628.       struct netconfig *config;
  1629.       struct t_unitdata *rmt_unit;
  1630. ***************
  1631. *** 90,95 ****
  1632. --- 91,97 ----
  1633.        */
  1634.   
  1635.       init_client(client);
  1636. +     client->fd = fd;
  1637.   
  1638.       /*
  1639.        * Find out the client address, find out what type of transport is hidden
  1640. diff -c ../6.0/try.c ./try.c
  1641. *** ../6.0/try.c    Tue Dec 21 21:37:55 1993
  1642. --- ./try.c    Tue Dec 21 21:37:13 1993
  1643. ***************
  1644. *** 17,23 ****
  1645.     */
  1646.   
  1647.   #ifndef lint
  1648. ! static char sccsid[] = "@(#) try.c 1.8 93/09/27 18:59:28";
  1649.   #endif
  1650.   
  1651.   #include <sys/types.h>
  1652. --- 17,23 ----
  1653.     */
  1654.   
  1655.   #ifndef lint
  1656. ! static char sccsid[] = "@(#) try.c 1.9 93/12/13 22:23:29";
  1657.   #endif
  1658.   
  1659.   #include <sys/types.h>
  1660. ***************
  1661. *** 50,55 ****
  1662. --- 50,56 ----
  1663.   
  1664.   int     allow_severity = SEVERITY;    /* run-time adjustable */
  1665.   int     deny_severity = LOG_WARNING;    /* ditto */
  1666. + int     rfc931_timeout = RFC931_TIMEOUT;/* ditto */
  1667.   
  1668.   /* usage - explain */
  1669.   
  1670. ***************
  1671. *** 84,89 ****
  1672. --- 85,96 ----
  1673.   
  1674.       dry_run = 1;
  1675.   
  1676. +     /* Reset other stuff that might be changed by options handlers. */
  1677. +     rfc931_timeout = RFC931_TIMEOUT;
  1678. +     allow_severity = SEVERITY;
  1679. +     deny_severity = LOG_WARNING;
  1680.       printf(" Daemon:   %s\n", daemon);
  1681.       printf(" Hostname: %s\n", name);
  1682.       printf(" Address:  %s\n", addr);
  1683. ***************
  1684. *** 174,183 ****
  1685.        * if different addresses for the same host have different permissions,
  1686.        * something that we probably do not want.
  1687.        */
  1688. !     while (hp->h_addr_list[0])
  1689.       try(server, hp->h_name,
  1690.           inet_ntoa(*(struct in_addr *) * hp->h_addr_list++), user);
  1691.       return (0);
  1692.   }
  1693.   
  1694. --- 181,192 ----
  1695.        * if different addresses for the same host have different permissions,
  1696.        * something that we probably do not want.
  1697.        */
  1698. !     while (hp->h_addr_list[0]) {
  1699.       try(server, hp->h_name,
  1700.           inet_ntoa(*(struct in_addr *) * hp->h_addr_list++), user);
  1701. !     if (hp->h_addr_list[0])
  1702. !         putchar('\n');
  1703. !     }
  1704.       return (0);
  1705.   }
  1706.   
  1707.  
  1708. exit 0 # Just in case...
  1709.