home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / unix / volume26 / xinetd21 / part04 < prev    next >
Encoding:
Text File  |  1993-06-26  |  33.8 KB  |  1,273 lines

  1. Newsgroups: comp.sources.unix
  2. From: panos@cs.colorado.edu (Panos Tsirigotis)
  3. Subject: v26i248: xinetd-2.1.1 - inetd replacement with access control and logging, Part04/31
  4. Sender: unix-sources-moderator@gw.home.vix.com
  5. Approved: vixie@gw.home.vix.com
  6.  
  7. Submitted-By: panos@cs.colorado.edu (Panos Tsirigotis)
  8. Posting-Number: Volume 26, Issue 248
  9. Archive-Name: xinetd-2.1.1/part04
  10.  
  11. #! /bin/sh
  12. # This is a shell archive.  Remove anything before this line, then unpack
  13. # it by saving it into a file and typing "sh file".  To overwrite existing
  14. # files, type "sh file -c".  You can also feed this as standard input via
  15. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  16. # will see the following message at the end:
  17. #        "End of archive 4 (of 31)."
  18. # Contents:  libs/src/misc/ftwx.3 libs/src/misc/misc.3
  19. #   libs/src/pset/pset.c libs/src/sio/suite/Makefile
  20. #   libs/src/str/ss_kmp.c libs/src/str/ss_rk.c
  21. #   libs/src/timer/timemacros.3 xinetd/CHANGELOG xinetd/connection.h
  22. #   xinetd/nvlists.c xinetd/server.h
  23. # Wrapped by panos@mystique on Mon Jun 21 14:51:21 1993
  24. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  25. if test -f 'libs/src/misc/ftwx.3' -a "${1}" != "-c" ; then 
  26.   echo shar: Will not clobber existing file \"'libs/src/misc/ftwx.3'\"
  27. else
  28. echo shar: Extracting \"'libs/src/misc/ftwx.3'\" \(2552 characters\)
  29. sed "s/^X//" >'libs/src/misc/ftwx.3' <<'END_OF_FILE'
  30. X.\"(c) Copyright 1992 by Panagiotis Tsirigotis
  31. X.\"All rights reserved.  The file named COPYRIGHT specifies the terms 
  32. X.\"and conditions for redistribution.
  33. X.\"
  34. X.\" $Id: ftwx.3,v 2.2 1992/10/31 03:08:39 panos Exp $
  35. X.TH FTWX 3X "25 January 1992"
  36. X.SH NAME
  37. Xftwx -- file tree walk
  38. X.SH SYNOPSIS
  39. X.LP
  40. X.nf
  41. X.ft B
  42. X#include "ftwx.h"
  43. X.LP
  44. X.ft B
  45. X.ft B
  46. X.ft B
  47. Xint ftwx( path, func, depth, flags )
  48. Xchar *path ;
  49. Xint (*func)() ;
  50. Xint depth ;
  51. Xint flags ;
  52. X.SH DESCRIPTION
  53. X.LP
  54. X.B ftwx()
  55. Xis an extension to \fIftw(3)\fR that optionally follows symbolic
  56. Xlinks (the default is not to follow them). It recursively descends
  57. Xthe directory tree whose root is \fIpath\fR. For each object it finds
  58. X(an object is anything that is in the file system name space,
  59. Xlike a directory, a socket, a regular file, a device etc.)
  60. Xit invokes \fIfunc()\fR passing
  61. Xit a pointer to a string containing the object path name (the first
  62. Xcomponent of the path will be \fIpath\fR), a pointer to a \fIstat()\fR
  63. Xstructure that contains information about the object, and a flag (of
  64. Xtype \fIint\fR). The user function is never invoked for the directory 
  65. Xentries "." and "..".
  66. XPossible flag values are:
  67. X.TP 10
  68. X.SB FTW_D
  69. Xthe object is a directory
  70. X.TP
  71. X.SB FTW_DNR
  72. Xthe object is a directory that is not readable
  73. X.TP
  74. X.SB FTW_F
  75. Xthe object is not a directory
  76. X.TP
  77. X.SB FTW_NS
  78. Xthe \fIstat()\fR of the object failed. The value of the pointer passed
  79. Xto the user function is undefined. This flag value will be returned
  80. Xfor directory entries of a directory for which execute access is not
  81. Xpermitted.
  82. X.LP
  83. X\fBftwx\fR visits a directory before visiting any of the files in
  84. Xthe directory. The tree walk continues until the tree is exhausted,
  85. Xthe user function returns a negative value or some error occurs
  86. X(since -1 indicates an error in \fBftwx()\fR, the user function
  87. Xshould not return that value).
  88. XIf the user function returns a positive value for a directory, that
  89. Xdirectory is not traversed.
  90. XSymbolic links are followed if the \fIflag\fR is \fBFTWX_FOLLOW\fR.
  91. X.LP
  92. XThe \fBdepth\fR argument determines how deep in the tree to go. The
  93. Xoriginal \fIpath\fR is at depth 0. If \fIdepth\fR is \fBFTWX_ALL\fR,
  94. Xthere is no depth limit. However since \fBftwx()\fR uses a file
  95. Xdescriptor for each level of the tree, there is a limit to
  96. Xthe tree depth that it can process that depends on the number
  97. Xof available file descriptors.
  98. X.SH "RETURN VALUES"
  99. X.LP
  100. X\fBftwx()\fR
  101. Xreturns 0 if is successful, -1 if an error occurs (\fIerrno\fR is set)
  102. Xand the (negative) value returned by the user function if that occurs.
  103. X.SH "SEE ALSO"
  104. X.LP
  105. Xftw(3)
  106. END_OF_FILE
  107. if test 2552 -ne `wc -c <'libs/src/misc/ftwx.3'`; then
  108.     echo shar: \"'libs/src/misc/ftwx.3'\" unpacked with wrong size!
  109. fi
  110. # end of 'libs/src/misc/ftwx.3'
  111. fi
  112. if test -f 'libs/src/misc/misc.3' -a "${1}" != "-c" ; then 
  113.   echo shar: Will not clobber existing file \"'libs/src/misc/misc.3'\"
  114. else
  115. echo shar: Extracting \"'libs/src/misc/misc.3'\" \(2525 characters\)
  116. sed "s/^X//" >'libs/src/misc/misc.3' <<'END_OF_FILE'
  117. X.\"(c) Copyright 1992 by Panagiotis Tsirigotis
  118. X.\"All rights reserved.  The file named COPYRIGHT specifies the terms 
  119. X.\"and conditions for redistribution.
  120. X.\"
  121. X.\" $Id: misc.3,v 2.2 1992/10/31 03:08:54 panos Exp $
  122. X.TH MISC 3X "25 January 1992"
  123. X.SH NAME
  124. Xmake_string, make_pathname, argv_copy_and_clear, basename, dirname - miscellaneous functions
  125. X.SH SYNOPSIS
  126. X.LP
  127. X.nf
  128. X.ft B
  129. X#include "misc.h"
  130. X.LP
  131. X.ft B
  132. Xchar *make_string( count, ... )
  133. Xunsigned count ;
  134. X.LP
  135. X.ft B
  136. Xchar *make_pathname( count, ... )
  137. Xunsigned count ;
  138. X.LP
  139. X.ft B
  140. Xchar **argv_copy_and_clear( argv, start, count )
  141. Xchar **argv ;
  142. Xint start, count ;
  143. X.LP
  144. X.ft B
  145. Xchar *dirname( path )
  146. Xchar *path ;
  147. X.LP
  148. X.ft B
  149. Xchar *basename( path )
  150. Xchar *path ;
  151. X.SH DESCRIPTION
  152. X.LP
  153. XThis library contain miscellaneous functions, hence the name.
  154. X.LP
  155. X.B make_string()
  156. Xcreates a string by catenating the list of strings passed as arguments.
  157. X\fIcount\fR indicates how many strings there are.
  158. XStrings that are
  159. X.SM NULL
  160. Xpointers are ignored.
  161. X\fBmake_string()\fR returns malloc'ed memory.
  162. X.LP
  163. X.B make_pathname()
  164. Xcreates a pathname by catenating the list of pathname components passed
  165. Xas arguments and inserting slashes between them.
  166. X\fIcount\fR indicates how many components there are.
  167. X\fBmake_pathname()\fR returns malloc'ed memory.
  168. X.LP
  169. X.B argv_copy_and_clear()
  170. Xcreates a new argv array of size \fIcount\fR, and fills it with the
  171. Xcontents of \fIargv\fR from \fIstart\fR up to \fIstart+count-1\fR.
  172. XThe original \fIargv\fR entries in that range are cleared by filling
  173. Xthem with
  174. X.SM SPACEs.
  175. X.LP
  176. X.B dirname()
  177. Xreturns in a malloced string containing all but the last of 
  178. Xcomponent of \fIpath\fR. There are 2 special cases:
  179. Xfirst when the
  180. X\fIpath\fR is "/", \fBdirname()\fR will return "/", 
  181. Xand second, when the \fIpath\fR does not contain any '/',
  182. X\fBdirname()\fR will return ".".
  183. X.LP
  184. X.B basename()
  185. Xreturns a pointer to the last component of \fIpath\fR.
  186. X.SH "RETURN VALUES"
  187. X.LP
  188. X\fBmake_string()\fR returns a pointer to the new string.
  189. XIt returns
  190. X.SM NULL
  191. Xif \fIcount\fR is 0.
  192. X.LP
  193. X\fBmake_pathname()\fR returns a pointer to the new pathname.
  194. XIt returns
  195. X.SM NULL
  196. Xif \fIcount\fR is 0.
  197. X.LP
  198. X\fBargv_copy_and_clear()\fR returns the new argv array. It returns
  199. X.SM NULL
  200. Xif \fImalloc\fR fails to allocate more memory.
  201. X.LP
  202. X\fBdirname()\fR returns a new string or
  203. X.SM NULL
  204. Xif \fImalloc\fR fails to allocate more memory.
  205. X.LP
  206. X\fBbasename()\fR returns a pointer to the last component of \fIpath\fR.
  207. X.SH BUGS
  208. X.LP
  209. XThe behavior of \fBdirname()\fR and \fBbasename()\fR is undefined if
  210. Xthey are given a zero-length string.
  211. END_OF_FILE
  212. if test 2525 -ne `wc -c <'libs/src/misc/misc.3'`; then
  213.     echo shar: \"'libs/src/misc/misc.3'\" unpacked with wrong size!
  214. fi
  215. # end of 'libs/src/misc/misc.3'
  216. fi
  217. if test -f 'libs/src/pset/pset.c' -a "${1}" != "-c" ; then 
  218.   echo shar: Will not clobber existing file \"'libs/src/pset/pset.c'\"
  219. else
  220. echo shar: Extracting \"'libs/src/pset/pset.c'\" \(2244 characters\)
  221. sed "s/^X//" >'libs/src/pset/pset.c' <<'END_OF_FILE'
  222. X/*
  223. X * (c) Copyright 1992, 1993 by Panagiotis Tsirigotis
  224. X * All rights reserved.  The file named COPYRIGHT specifies the terms 
  225. X * and conditions for redistribution.
  226. X */
  227. X
  228. Xstatic char RCSid[] = "$Id: pset.c,v 3.1 1993/03/06 18:48:57 panos Exp $" ;
  229. Xstatic char version[] = VERSION ;
  230. X
  231. X#include "pset.h"
  232. X
  233. X#ifndef NULL
  234. X#define NULL                        0
  235. X#endif
  236. X
  237. X#define ALLOC_START                20
  238. X#define ALLOC_STEP                10
  239. X
  240. X#define POINTER                    __pset_pointer
  241. X
  242. Xchar *malloc(), *realloc() ;
  243. X
  244. X
  245. X/*
  246. X * Create a pointer set and return a handle to it.
  247. X * Some space is initially allocated for the set.
  248. X */
  249. Xpset_h pset_create( alloc_start, alloc_step )
  250. X    unsigned alloc_start, alloc_step ;
  251. X{
  252. X    pset_h pset ;
  253. X    unsigned start ;
  254. X
  255. X    pset = (pset_h) malloc( sizeof( struct __pset ) ) ;
  256. X    if ( pset == NULL )
  257. X        return( NULL ) ;
  258. X    
  259. X    start = ( alloc_start == 0 ) ? ALLOC_START : alloc_start ;
  260. X    pset->ptrs = (POINTER *) malloc( start * sizeof( POINTER ) ) ;
  261. X    if ( pset->ptrs == NULL )
  262. X    {
  263. X        free( (char *) pset ) ;
  264. X        return( NULL ) ;
  265. X    }
  266. X
  267. X    pset->max = start ;
  268. X    pset->count = 0 ;
  269. X    pset->alloc_step = ( alloc_step == 0 ) ? ALLOC_STEP : alloc_step ;
  270. X    return( pset ) ;
  271. X}
  272. X
  273. X
  274. X/*
  275. X * Destroy a pset
  276. X */
  277. Xvoid pset_destroy( pset )
  278. X    pset_h pset ;
  279. X{
  280. X    free( (char *) pset->ptrs ) ;
  281. X    free( (char *) pset ) ;
  282. X}
  283. X
  284. X
  285. X/*
  286. X * Insert a pointer to a pset
  287. X */
  288. XPOINTER pset_insert( pset, p )
  289. X    pset_h pset ;
  290. X    POINTER p ;
  291. X{
  292. X    if ( pset->count >= pset->max )
  293. X    {
  294. X        unsigned new_max = pset->max + pset->alloc_step ;
  295. X        POINTER *new_ptrs ;
  296. X
  297. X        new_ptrs = (POINTER *) realloc(
  298. X                                (char *)pset->ptrs, new_max * sizeof( POINTER ) ) ;
  299. X        if ( new_ptrs == NULL )
  300. X            return( NULL ) ;
  301. X        pset->max = new_max ;
  302. X        pset->ptrs = new_ptrs ;
  303. X    }
  304. X    return( pset->ptrs[ pset->count++ ] = p ) ;
  305. X}
  306. X
  307. X
  308. X/*
  309. X * Remove a pointer from a pset
  310. X */
  311. Xvoid pset_delete( pset, ptr )
  312. X    register pset_h pset ;
  313. X    register POINTER ptr ;
  314. X{
  315. X    register unsigned u = pset->count ;
  316. X
  317. X    if ( u == 0 )
  318. X        return ;
  319. X    
  320. X    do
  321. X    {
  322. X        u-- ;
  323. X        if ( pset->ptrs[ u ] == ptr )
  324. X        {
  325. X            pset->ptrs[ u ] = pset->ptrs[ --pset->count ] ;
  326. X            return ;
  327. X        }
  328. X    }
  329. X    while ( u ) ;
  330. X}
  331. X
  332. X
  333. X/*
  334. X * Create a pset iterator
  335. X */
  336. Xpsi_h psi_create( pset )
  337. X    pset_h pset ;
  338. X{
  339. X    psi_h iter = (psi_h) malloc( sizeof( struct __pset_iterator ) ) ;
  340. X
  341. X    if ( iter == NULL )
  342. X        return( NULL ) ;
  343. X    iter->pset = pset ;
  344. X    return( iter ) ;
  345. X}
  346. X
  347. X
  348. END_OF_FILE
  349. if test 2244 -ne `wc -c <'libs/src/pset/pset.c'`; then
  350.     echo shar: \"'libs/src/pset/pset.c'\" unpacked with wrong size!
  351. fi
  352. # end of 'libs/src/pset/pset.c'
  353. fi
  354. if test -f 'libs/src/sio/suite/Makefile' -a "${1}" != "-c" ; then 
  355.   echo shar: Will not clobber existing file \"'libs/src/sio/suite/Makefile'\"
  356. else
  357. echo shar: Extracting \"'libs/src/sio/suite/Makefile'\" \(2542 characters\)
  358. sed "s/^X//" >'libs/src/sio/suite/Makefile' <<'END_OF_FILE'
  359. X# (c) Copyright 1992, 1993 by Panagiotis Tsirigotis
  360. X# All rights reserved.  The file named COPYRIGHT specifies the terms 
  361. X# and conditions for redistribution.
  362. X
  363. X#
  364. X# $Id: Makefile,v 8.1 1993/03/13 01:27:40 panos Exp $
  365. X#
  366. X
  367. XCC                    = cc -I..
  368. X
  369. X#
  370. X# NOTE: When using the test scripts, CLFAGS is provided as an
  371. X#          argument to make, the setting of it here has no effect.
  372. X#
  373. XCFLAGS            = -g
  374. XLIBOBJS            = ../libsio.a
  375. X
  376. XDISTRIBUTION_FILES=copytest.c example.c print.c tietest.c buftest.c fdtest.c tester sprint_test testlib README
  377. X
  378. XALL=Sread Swrite Sputchar Sgetchar Srdline \
  379. X     Sgetc Sputc Sfetch Sflush Sundo switch \
  380. X     Sprint buftest tietest switch2 example fdtest evtest
  381. X
  382. Xevtest: evtest.c $(LIBOBJS)
  383. X    $(CC) $(CFLAGS) -o $@ evtest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
  384. X
  385. Xfdtest: fdtest.c $(LIBOBJS)
  386. X    $(CC) $(CFLAGS) -o $@ fdtest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
  387. X
  388. Xbuftest: buftest.c $(LIBOBJS)
  389. X    $(CC) $(CFLAGS) -o $@ buftest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
  390. X
  391. XSprint: print.c $(LIBOBJS)
  392. X    $(CC) $(CFLAGS) -o $@ print.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
  393. X
  394. XSputchar: copytest.c $(LIBOBJS)
  395. X    $(CC) $(CFLAGS) -o $@ copytest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
  396. X
  397. XSgetchar: copytest.c $(LIBOBJS)
  398. X    $(CC) $(CFLAGS) -o $@ copytest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
  399. X
  400. XSrdline: copytest.c $(LIBOBJS)
  401. X    $(CC) $(CFLAGS) -o $@ copytest.c $(LIBOBJS) || rm -f $@
  402. X
  403. XSread: copytest.c $(LIBOBJS)
  404. X    $(CC) $(CFLAGS) -o $@ copytest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
  405. X
  406. XSwrite: copytest.c $(LIBOBJS)
  407. X    $(CC) $(CFLAGS) -o $@ copytest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
  408. X
  409. XSgetc: copytest.c $(LIBOBJS)
  410. X    $(CC) $(CFLAGS) -o $@ copytest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
  411. X
  412. XSputc: copytest.c $(LIBOBJS)
  413. X    $(CC) $(CFLAGS) -o $@ copytest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
  414. X
  415. XSfetch: copytest.c $(LIBOBJS)
  416. X    $(CC) $(CFLAGS) -o $@ copytest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
  417. X
  418. XSflush: copytest.c $(LIBOBJS)
  419. X    $(CC) $(CFLAGS) -o $@ copytest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
  420. X
  421. XSundo: copytest.c $(LIBOBJS)
  422. X    $(CC) $(CFLAGS) -o $@ copytest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
  423. X
  424. Xswitch: copytest.c $(LIBOBJS)
  425. X    $(CC) $(CFLAGS) -o $@ copytest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
  426. X
  427. Xswitch2: copytest.c $(LIBOBJS)
  428. X    $(CC) $(CFLAGS) -o $@ copytest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
  429. X
  430. Xtietest: tietest.c $(LIBOBJS)
  431. X    $(CC) $(CFLAGS) -o $@ tietest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
  432. X
  433. Xexample: example.c $(LIBOBJS)
  434. X    $(CC) $(CFLAGS) -o $@ example.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
  435. X
  436. Xclean:
  437. X    rm -f $(ALL) core
  438. X
  439. Xcheckout: $(DISTRIBUTION_FILES)
  440. X
  441. X$(DISTRIBUTION_FILES):
  442. X    co $@
  443. X
  444. Xdist:
  445. X    -co -q $(DISTRIBUTION_FILES)
  446. END_OF_FILE
  447. if test 2542 -ne `wc -c <'libs/src/sio/suite/Makefile'`; then
  448.     echo shar: \"'libs/src/sio/suite/Makefile'\" unpacked with wrong size!
  449. fi
  450. # end of 'libs/src/sio/suite/Makefile'
  451. fi
  452. if test -f 'libs/src/str/ss_kmp.c' -a "${1}" != "-c" ; then 
  453.   echo shar: Will not clobber existing file \"'libs/src/str/ss_kmp.c'\"
  454. else
  455. echo shar: Extracting \"'libs/src/str/ss_kmp.c'\" \(2827 characters\)
  456. sed "s/^X//" >'libs/src/str/ss_kmp.c' <<'END_OF_FILE'
  457. X/*
  458. X * (c) Copyright 1992, 1993 by Panagiotis Tsirigotis
  459. X * All rights reserved.  The file named COPYRIGHT specifies the terms 
  460. X * and conditions for redistribution.
  461. X */
  462. X
  463. Xstatic char RCSid[] = "$Id: ss_kmp.c,v 3.1 1993/06/13 02:44:39 panos Exp $" ;
  464. X
  465. Xchar *malloc() ;
  466. X
  467. X#include "ss_impl.h"
  468. X
  469. XPRIVATE int kmp_setup() ;
  470. XPRIVATE char *kmp_match() ;
  471. XPRIVATE void kmp_done() ;
  472. X
  473. Xstruct ss_ops __strs_kmpops = { kmp_setup, kmp_match, kmp_done } ;
  474. X
  475. X
  476. XPRIVATE void compute_next( hp )
  477. X    header_s *hp ;
  478. X{
  479. X    char            *pattern = SS_PATTERN( hp ) ;
  480. X    int            patlen    = SS_PATLEN( hp ) ;
  481. X    next_int        *next        = KMP_HEADER( hp )->next ;
  482. X    int            q ;
  483. X    next_int     k ;
  484. X
  485. X    k = next[ 0 ] = -1 ;
  486. X
  487. X    for ( q = 0 ; q < patlen-1 ; )
  488. X    {
  489. X        /*
  490. X         * The invariant of the following loop is:
  491. X         * if k>=0, then
  492. X         *        pattern[ 0..k-1 ] SUFFIX pattern[ 0..q-1 ]  ( <==> next[ q ] = k )
  493. X         * This condition is true on entry to the loop.
  494. X         */
  495. X        while ( k >= 0 && pattern[ k ] != pattern[ q ] )
  496. X            k = next[ k ] ;
  497. X
  498. X        /*
  499. X         * Case 1: k == -1
  500. X         *        Setting next[ q+1 ] = 0 is ok since it implies that the next
  501. X         *        position in the pattern to check is position 0 (i.e. start
  502. X         *        from the beginning).
  503. X         *    Case 2: k >= 0.
  504. X         *        Since we exited the loop, pattern[ k ] == pattern[ q ].
  505. X         *        Therefore,
  506. X         *            pattern[ 0..k ] SUFFIX pattern[ 0..q ] ==> next[ q+1 ] = k+1
  507. X         */
  508. X        k++, q++ ;
  509. X#ifdef PATH_COMPRESSION
  510. X        if ( pattern[ k ] == pattern[ q ] )
  511. X            next[ q ] = next[ k ] ;
  512. X#endif
  513. X        next[ q ] = k ;
  514. X    }
  515. X}
  516. X
  517. X
  518. XPRIVATE int kmp_setup( hp )
  519. X    register header_s *hp ;
  520. X{
  521. X    register next_int *next ;
  522. X
  523. X    next = (next_int *) malloc( (unsigned)SS_PATLEN( hp )*sizeof( next_int ) ) ;
  524. X    if ( next == (next_int *)0 )
  525. X        return( SS_ERR ) ;
  526. X    
  527. X    KMP_HEADER( hp )->next = next ;
  528. X
  529. X    compute_next( hp ) ;
  530. X
  531. X    return( SS_OK ) ;
  532. X}
  533. X
  534. X
  535. XPRIVATE char *kmp_match( hp, str, len )
  536. X    header_s        *hp ;
  537. X    char            *str ;
  538. X    int            len ;
  539. X{
  540. X    register int            i ;
  541. X    register next_int     q ;
  542. X    next_int                    *next        = KMP_HEADER( hp )->next ;
  543. X    char                        *pattern = SS_PATTERN( hp ) ;
  544. X    register int            patlen    = SS_PATLEN( hp ) ;
  545. X
  546. X    /*
  547. X     * As a special case, we consider pattern[ -1..0 ] to be the empty string.
  548. X     */
  549. X    for ( q = 0, i = 0 ; i < len ; i++ )
  550. X    {
  551. X        register char current_char = SS_MAP( hp, str[ i ] ) ;
  552. X
  553. Xagain:
  554. X        /*
  555. X         * At this point:
  556. X         *        pattern[ 0..q-1 ] is a suffix of str[ 0..i-1 ]
  557. X         */
  558. X        if ( pattern[ q ] == current_char )
  559. X        {
  560. X            q++ ;
  561. X            if ( q == patlen )
  562. X                return( &str[ i - patlen + 1 ] ) ;
  563. X        }
  564. X        else
  565. X        {
  566. X            /*
  567. X             * Let q' = next[ q ]. If q' >= 0, then
  568. X             *        pattern[ 0..q'-1 ] SUFFIX pattern[ 0..q-1 ]
  569. X             *    which implies that
  570. X             *        pattern[ 0..q'-1 ] SUFFIX str[ 0..i-1 ]
  571. X             * Therefore, it is ok to set q = q'.
  572. X             */
  573. X            q = next[ q ] ;
  574. X            if ( q >= 0 )
  575. X                goto again ;
  576. X            q++ ;
  577. X        }
  578. X    }
  579. X
  580. X    return( CHAR_NULL ) ;
  581. X}
  582. X
  583. X
  584. XPRIVATE void kmp_done( hp )
  585. X    header_s *hp ;
  586. X{
  587. X    (void) free( (char *)KMP_HEADER( hp )->next ) ;
  588. X}
  589. X
  590. END_OF_FILE
  591. if test 2827 -ne `wc -c <'libs/src/str/ss_kmp.c'`; then
  592.     echo shar: \"'libs/src/str/ss_kmp.c'\" unpacked with wrong size!
  593. fi
  594. # end of 'libs/src/str/ss_kmp.c'
  595. fi
  596. if test -f 'libs/src/str/ss_rk.c' -a "${1}" != "-c" ; then 
  597.   echo shar: Will not clobber existing file \"'libs/src/str/ss_rk.c'\"
  598. else
  599. echo shar: Extracting \"'libs/src/str/ss_rk.c'\" \(2625 characters\)
  600. sed "s/^X//" >'libs/src/str/ss_rk.c' <<'END_OF_FILE'
  601. X/*
  602. X * (c) Copyright 1992, 1993 by Panagiotis Tsirigotis
  603. X * All rights reserved.  The file named COPYRIGHT specifies the terms 
  604. X * and conditions for redistribution.
  605. X */
  606. X
  607. Xstatic char RCSid[] = "$Id: ss_rk.c,v 3.1 1993/06/13 02:45:04 panos Exp $" ;
  608. X
  609. X#include "ss_impl.h"
  610. X
  611. X/*
  612. X * Multiply a number by the radix we are using
  613. X */
  614. X#define RADIX_MULT( n )                        ( (n) << NBIC )
  615. X
  616. X#define UCHAR( c )                            ((unsigned char)(c))
  617. X
  618. X
  619. XPRIVATE int rk_setup() ;
  620. XPRIVATE char *rk_match() ;
  621. XPRIVATE void rk_done() ;
  622. X
  623. Xstruct ss_ops __strs_rkops = { rk_setup, rk_match, rk_done } ;
  624. X
  625. X
  626. XPRIVATE int rk_setup( hp )
  627. X    register header_s *hp ;
  628. X{
  629. X    register int        i ;
  630. X    struct rk_header    *rkp        = RK_HEADER( hp ) ;
  631. X    u_wide_int            patval    = 0 ;
  632. X    u_wide_int            digit_1    = 1 ;
  633. X
  634. X    /*
  635. X     * Compute pattern value
  636. X     */
  637. X    for ( i = 0 ; i < SS_PATLEN( hp ) ; i++ )
  638. X        patval = ( RADIX_MULT( patval ) + UCHAR( SS_PATTERN( hp )[i] ) ) % PRIME ;
  639. X    
  640. X    for ( i = 0 ; i < SS_PATLEN( hp )-1 ; i++ )
  641. X        digit_1 = RADIX_MULT( digit_1 ) % PRIME ;
  642. X
  643. X    rkp->rk_patval = patval ;
  644. X    rkp->rk_digit1 = digit_1 ;
  645. X    return( SS_OK ) ;
  646. X}
  647. X
  648. X
  649. XPRIVATE void rk_done( hp ) 
  650. X    header_s *hp ;
  651. X{
  652. X#ifdef lint
  653. X    hp = hp ;
  654. X#endif
  655. X}
  656. X
  657. X
  658. XPRIVATE char *rk_match( hp, str, len )
  659. X    register header_s        *hp ;
  660. X    char                        *str ;
  661. X    int                        len ;
  662. X{
  663. X    register int                i ;
  664. X    register unsigned char    uc ;
  665. X    register u_wide_int        strval    = 0 ;
  666. X    register u_wide_int        patval    = RK_HEADER( hp )->rk_patval ;
  667. X    register u_wide_int        digit_1    = RK_HEADER( hp )->rk_digit1 ;
  668. X    int                            patlen    = SS_PATLEN( hp ) ;
  669. X    char                            *endpat    = &SS_PATTERN( hp )[ patlen ] ;
  670. X
  671. X    /*
  672. X     * Calculate initial value of 'str'
  673. X     * Note that we are guaranteed that len >= pattern length
  674. X     */
  675. X    for ( i = 0 ; i < patlen ; i++ )
  676. X    {
  677. X        uc = UCHAR( SS_MAP( hp, str[i] ) ) ;
  678. X        strval = ( RADIX_MULT( strval ) + uc ) % PRIME ;
  679. X    }
  680. X
  681. X    for ( i = 0 ;; i++ )
  682. X    {
  683. X        register u_wide_int t1 ;
  684. X
  685. X        if ( strval == patval )
  686. X        {
  687. X            char *pp, *sp ;
  688. X
  689. X            for ( pp = SS_PATTERN( hp ), sp = &str[i] ;; sp++, pp++ )
  690. X            {
  691. X                if ( pp == endpat )
  692. X                    return( &str[i] ) ;
  693. X                if ( *pp != SS_MAP( hp, *sp ) )
  694. X                    break ;
  695. X            }
  696. X        }
  697. X
  698. X        if ( i == len-patlen+1 )
  699. X            break ;
  700. X
  701. X        /*
  702. X         * The formula we evaluate is:
  703. X         *
  704. X         *    strval = ( RADIX_MULT( ( strval - UCHAR( str[i] )*digit_1 ) ) + 
  705. X         *                        UCHAR( str[i+patlen] ) ) % PRIME ;
  706. X         *
  707. X         * We have to make sure that the subtraction does not produce
  708. X         * a negative number since that causes strval to be wrong.
  709. X         */
  710. X        uc = UCHAR( SS_MAP( hp, str[i] ) ) ;
  711. X        t1 = ( uc * digit_1 ) % PRIME ;
  712. X        if ( t1 > strval )
  713. X            strval += PRIME ;
  714. X        uc = UCHAR( SS_MAP( hp, str[i+patlen] ) ) ;
  715. X        strval = ( RADIX_MULT( strval - t1 ) + uc ) % PRIME ;
  716. X    }
  717. X    return( NULL ) ;
  718. X}
  719. X
  720. X
  721. END_OF_FILE
  722. if test 2625 -ne `wc -c <'libs/src/str/ss_rk.c'`; then
  723.     echo shar: \"'libs/src/str/ss_rk.c'\" unpacked with wrong size!
  724. fi
  725. # end of 'libs/src/str/ss_rk.c'
  726. fi
  727. if test -f 'libs/src/timer/timemacros.3' -a "${1}" != "-c" ; then 
  728.   echo shar: Will not clobber existing file \"'libs/src/timer/timemacros.3'\"
  729. else
  730. echo shar: Extracting \"'libs/src/timer/timemacros.3'\" \(2100 characters\)
  731. sed "s/^X//" >'libs/src/timer/timemacros.3' <<'END_OF_FILE'
  732. X.\"(c) Copyright 1993 by Panagiotis Tsirigotis
  733. X.\"All rights reserved.  The file named COPYRIGHT specifies the terms 
  734. X.\"and conditions for redistribution.
  735. X.\"
  736. X.\" $Id: timemacros.3,v 4.1 1993/04/20 22:52:53 panos Exp $
  737. X.TH TIMEMACROS 3X "20 April 1993"
  738. X.SH NAME
  739. XTV_ADD, TV_SUB, TV_LT, TV_LE, TV_GT. TV_GE, TV_EQ, TV_NE, TV_ISZERO, TV_ZERO, TVP_ADD, TVP_SUB, TVP_LT, TVP_LE, TVP_GT, TVP_GE, TVP_EQ, TVP_NE, TVP_ISZERO, TVP_ZERO - macros for manipulating timeval structures
  740. X.SH SYNOPSIS
  741. X.LP
  742. X.nf
  743. X.ft B
  744. X#include "timemacros.h"
  745. X.LP
  746. X.ft B
  747. Xvoid TV_ADD( tv_res, tv1, tv2 )
  748. Xstruct timeval tv_res, tv1, tv2 ;
  749. X.LP
  750. X.ft B
  751. Xvoid TV_SUB( tv_res, tv1, tv2 )
  752. Xstruct timeval tv_res, tv1, tv2 ;
  753. X.LP
  754. X.ft B
  755. Xvoid TV_ZERO( tv )
  756. Xstruct timeval tv ;
  757. X.LP
  758. X.ft B
  759. Xint TV_LT( tv1, tv2 )
  760. Xstruct timeval tv1, tv2 ;
  761. X.LP
  762. X.ft B
  763. Xint TV_LE( tv1, tv2 )
  764. Xstruct timeval tv1, tv2 ;
  765. X.LP
  766. X.ft B
  767. Xint TV_GT( tv1, tv2 )
  768. Xstruct timeval tv1, tv2 ;
  769. X.LP
  770. X.ft B
  771. Xint TV_GE( tv1, tv2 )
  772. Xstruct timeval tv1, tv2 ;
  773. X.LP
  774. X.ft B
  775. Xint TV_EQ( tv1, tv2 )
  776. Xstruct timeval tv1, tv2 ;
  777. X.LP
  778. X.ft B
  779. Xint TV_NE( tv1, tv2 )
  780. Xstruct timeval tv1, tv2 ;
  781. X.LP
  782. X.ft B
  783. Xint TV_ISZERO( tv )
  784. Xstruct timeval tv ;
  785. X.SH DESCRIPTION
  786. XThere are 2 groups of macros: the
  787. X.I "TV_*"
  788. Xmacros expect arguments that are
  789. X.I "struct timeval's"
  790. Xwhile the
  791. X.I "TVP_*"
  792. Xmacros expect arguments that are pointers to
  793. X.I "struct timeval."
  794. XIn the following only the
  795. X.I "TV_*"
  796. Xmacros will be described.
  797. X.LP
  798. X.B "TV_ADD()"
  799. Xadds
  800. X.I tv1
  801. Xand
  802. X.I tv2
  803. Xand puts the result in
  804. X.I tv_res.
  805. XThe result is "normalized" if the number of microseconds in
  806. X.I tv_res
  807. Xexceeds 1 million.
  808. X.LP
  809. X.B "TV_SUB()"
  810. Xperforms the subtraction
  811. X.I "tv1-tv2"
  812. Xand places the result in
  813. X.I tv_res.
  814. XThe result is "normalized" if the number of microseconds in 
  815. X.I tv_res
  816. Xbecomes negative.
  817. X.LP
  818. X.B "TV_ZERO()"
  819. Xsets
  820. X.I tv
  821. Xto zero seconds and zero microseconds.
  822. X.LP
  823. X.B "TV_LT(),"
  824. X.B "TV_LE(),"
  825. X.B "TV_GT(),"
  826. X.B "TV_GE(),"
  827. X.B "TV_EQ(),"
  828. Xand
  829. X.B "TV_NE()"
  830. Xreturn
  831. X.SM TRUE 
  832. Xif
  833. X.I tv1
  834. Xis
  835. Xless than,
  836. Xless than or equal,
  837. Xgreater than,
  838. Xgreater than or equal,
  839. Xequal,
  840. Xor
  841. Xnot equal
  842. Xto
  843. X.I tv2,
  844. Xrespectively.
  845. X.LP
  846. X.B "TV_ISZERO()"
  847. Xreturns
  848. X.SM TRUE
  849. Xif
  850. X.I tv
  851. Xis equal to zero.
  852. END_OF_FILE
  853. if test 2100 -ne `wc -c <'libs/src/timer/timemacros.3'`; then
  854.     echo shar: \"'libs/src/timer/timemacros.3'\" unpacked with wrong size!
  855. fi
  856. # end of 'libs/src/timer/timemacros.3'
  857. fi
  858. if test -f 'xinetd/CHANGELOG' -a "${1}" != "-c" ; then 
  859.   echo shar: Will not clobber existing file \"'xinetd/CHANGELOG'\"
  860. else
  861. echo shar: Extracting \"'xinetd/CHANGELOG'\" \(2579 characters\)
  862. sed "s/^X//" >'xinetd/CHANGELOG' <<'END_OF_FILE'
  863. X
  864. XThis file describes the changes to xinetd. The base version is 2.0.0.
  865. X
  866. X2.0.0: (not released)
  867. X
  868. X2.0.1: (not released)
  869. X
  870. X2.0.2:
  871. X    Changes to the Makefile.
  872. X    Trivial mods to the usage() function
  873. X
  874. X2.0.3:
  875. X    Changes to the Makefile.
  876. X    Fixed a bug in the usage() function
  877. X
  878. X2.0.4:
  879. X    Distribution versions of the Makefile no longer contain any 
  880. X    references to options.opt
  881. X
  882. X2.0.5:
  883. X    1) Clarified what an "unlisted RPC service" is in the man page
  884. X    2) Fixed a bug in remote_address_check which caused access to be denied
  885. X        for all hosts if no_access was set and only_from was not set.
  886. X    3) Fixed a bug which caused arbitrary syslog levels if the log_type
  887. X        was specified as SYSLOG in the "defaults" entry
  888. X
  889. X2.0.6:
  890. X    bug fix in child.c: replaced strx_sprint with strx_print when naming
  891. X    interceptor processes
  892. X
  893. X
  894. X-------------------------------------------------------------------------------
  895. X
  896. X2.1.0: (not released)
  897. X    This was mostly a clean-up of 2.0
  898. X    List of changes:
  899. X
  900. X    A. The man page has been split into 3 parts:
  901. X            xinetd.man            :    man page describing the program
  902. X            xinetd.conf.man    :    man page describing the configuration file 
  903. X                                        This file now includes figures about the
  904. X                                        overhead of interception.
  905. X            xinetd.log.man        :    man page describing the log file
  906. X    B. New service attributes
  907. X            rpc_number            : to support unlisted RPC services
  908. X            nice                    : to set the nice value of forked servers
  909. X    C. The IDONLY service flag was added
  910. X    D. Now uses the timer library unless NO_TIMERS is defined. If NO_TIMERS
  911. X        is not defined, the following are also available:
  912. X            a) a new option, -cc, to do periodic consistency checks
  913. X            b) timeout for reconfiguration
  914. X    E.    Configuration file man page now mentions that access control is 
  915. X        based on IP-address instead of domain address.
  916. X    F.    The interception code now sets the TCP_NODELAY option.
  917. X    G. The timeout when contacting a remote identification server is
  918. X        configurable both when the service request has been accepted and 
  919. X        when the request is rejected. In the former case it defaults to
  920. X        infinity while in the latter it defaults to 30 sec.
  921. X    H. The log line ids are now constants in an include file.
  922. X    I. The fsma library is no longer used.
  923. X    J. Most structure fields were renamed; certain functions were renamed too.
  924. X        Access to structure fields is now via macros.
  925. X    K. A bug in not restoring the number of descriptors to the soft limit
  926. X        was fixed.
  927. X    L. The -pid option works
  928. X    M. New internal services:
  929. X            "servers"        : lists active servers
  930. X            "services"        : lists active services
  931. X
  932. X2.1.1:
  933. X    xinetd produces more meaningful messages if it can't start logging
  934. X
  935. END_OF_FILE
  936. if test 2579 -ne `wc -c <'xinetd/CHANGELOG'`; then
  937.     echo shar: \"'xinetd/CHANGELOG'\" unpacked with wrong size!
  938. fi
  939. # end of 'xinetd/CHANGELOG'
  940. fi
  941. if test -f 'xinetd/connection.h' -a "${1}" != "-c" ; then 
  942.   echo shar: Will not clobber existing file \"'xinetd/connection.h'\"
  943. else
  944. echo shar: Extracting \"'xinetd/connection.h'\" \(2232 characters\)
  945. sed "s/^X//" >'xinetd/connection.h' <<'END_OF_FILE'
  946. X/*
  947. X * (c) Copyright 1992 by Panagiotis Tsirigotis
  948. X * All rights reserved.  The file named COPYRIGHT specifies the terms 
  949. X * and conditions for redistribution.
  950. X */
  951. X
  952. X#ifndef CONNECTION_H
  953. X#define CONNECTION_H
  954. X
  955. X/*
  956. X * $Id: connection.h,v 6.3 1993/06/01 22:53:50 panos Exp $
  957. X */
  958. X
  959. X#include <sys/types.h>
  960. X#include <netinet/in.h>
  961. X
  962. X#include "mask.h"
  963. X#include "service.h"
  964. X
  965. X#define MAX_ALTERNATIVES                3
  966. X
  967. Xtypedef enum { CONN_CLOSED = 0, CONN_OPEN } conn_state_e ;
  968. X
  969. X#define COF_HAVE_ADDRESS                1
  970. X#define COF_SHUTDOWN                        2
  971. X#define COF_CLEANUP                        3
  972. X#define COF_NEW_DESCRIPTOR                4
  973. X
  974. Xstruct connection
  975. X{
  976. X    conn_state_e             co_state ;
  977. X    struct service         *co_sp ;
  978. X    int                         co_descriptor ;
  979. X    mask_t                     co_flags ;
  980. X    struct sockaddr_in    co_remote_address ;
  981. X    unsigned                 co_alternative_count ;
  982. X    unsigned                 co_next_alternative ;
  983. X    struct service         *co_alternatives[ MAX_ALTERNATIVES ] ;
  984. X} ;
  985. X
  986. Xtypedef struct connection connection_s ;
  987. X
  988. X#define COP( p )                            ((connection_s *)(p))
  989. X
  990. X#define CONN_NULL                            COP( NULL )
  991. X
  992. X/*
  993. X * Field access macros
  994. X */
  995. X#define CONN_DESCRIPTOR( cp )            (cp)->co_descriptor
  996. X#define CONN_SERVICE( cp )                (cp)->co_sp
  997. X
  998. X#define conn_set_flag( cp, flag )    M_SET( (cp)->co_flags, flag )
  999. X
  1000. X#define conn_shutdown( cp )            conn_set_flag( cp, COF_SHUTDOWN )
  1001. X#define conn_cleanup( cp )                conn_set_flag( cp, COF_CLEANUP )
  1002. X
  1003. X#define conn_setaddr( cp, sinp )                                                            \
  1004. X                            {                                                                        \
  1005. X                                conn_set_flag( cp, COF_HAVE_ADDRESS ) ;                \
  1006. X                                (cp)->co_remote_address = *(sinp) ;                        \
  1007. X                            }
  1008. X#define conn_set_descriptor( cp, fd )        (cp)->co_descriptor = (fd)
  1009. X
  1010. X#define conn_address( cp )                                                                    \
  1011. X                                    (                                                                \
  1012. X                                        M_IS_SET( (cp)->co_flags, COF_HAVE_ADDRESS )    \
  1013. X                                                    ? &(cp)->co_remote_address             \
  1014. X                                                    : SOCKADDRIN_NULL                            \
  1015. X                                    )
  1016. X
  1017. Xchar *inet_ntoa() ;
  1018. X
  1019. X#define conn_addrstr( cp )                                                                    \
  1020. X                                M_IS_SET( (cp)->co_flags, COF_HAVE_ADDRESS )            \
  1021. X                                    ? inet_ntoa( (cp)->co_remote_address.sin_addr )    \
  1022. X                                    : "<no address>"
  1023. X
  1024. Xstatus_e         conn_init() ;
  1025. Xconnection_s     *conn_new() ;
  1026. Xvoid                 conn_close() ;
  1027. Xvoid                 conn_free() ;
  1028. Xstatus_e         conn_add_alternative() ;
  1029. Xstatus_e         conn_start_alternative() ;
  1030. Xvoid                 conn_dump() ;
  1031. X
  1032. X#endif    /* CONNECTION_H */
  1033. X
  1034. END_OF_FILE
  1035. if test 2232 -ne `wc -c <'xinetd/connection.h'`; then
  1036.     echo shar: \"'xinetd/connection.h'\" unpacked with wrong size!
  1037. fi
  1038. # end of 'xinetd/connection.h'
  1039. fi
  1040. if test -f 'xinetd/nvlists.c' -a "${1}" != "-c" ; then 
  1041.   echo shar: Will not clobber existing file \"'xinetd/nvlists.c'\"
  1042. else
  1043. echo shar: Extracting \"'xinetd/nvlists.c'\" \(2285 characters\)
  1044. sed "s/^X//" >'xinetd/nvlists.c' <<'END_OF_FILE'
  1045. X/*
  1046. X * (c) Copyright 1992 by Panagiotis Tsirigotis
  1047. X * All rights reserved.  The file named COPYRIGHT specifies the terms 
  1048. X * and conditions for redistribution.
  1049. X */
  1050. X
  1051. Xstatic char RCSid[] = "$Id: nvlists.c,v 6.3 1993/06/13 01:43:55 panos Exp $" ;
  1052. X
  1053. X#include <sys/types.h>
  1054. X#include <sys/socket.h>
  1055. X#include <syslog.h>
  1056. X
  1057. X#include "defs.h"
  1058. X#include "sconf.h"
  1059. X
  1060. X/*
  1061. X * A NULL value for the name field marks the end of the table
  1062. X */
  1063. X
  1064. Xstruct name_value service_types[] =
  1065. X    {
  1066. X#ifndef NO_RPC
  1067. X        { "RPC",                    ST_RPC            },
  1068. X#endif
  1069. X        { "INTERNAL",            ST_INTERNAL        },
  1070. X        { "UNLISTED",            ST_UNLISTED        },
  1071. X        { "SPECIAL",            ST_SPECIAL        },
  1072. X        { CHAR_NULL,            0                    }
  1073. X    } ;
  1074. X
  1075. X
  1076. Xstruct name_value service_flags[] =
  1077. X    {
  1078. X        { "REUSE",                SF_REUSE            },
  1079. X        { "INTERCEPT",            SF_INTERCEPT    },
  1080. X        { "NORETRY",            SF_NORETRY        },
  1081. X        { "IDONLY",                SF_IDONLY        },
  1082. X        { CHAR_NULL,            0                    }
  1083. X    } ;
  1084. X
  1085. X
  1086. Xstruct name_value socket_types[] =
  1087. X    {
  1088. X        { "stream",                SOCK_STREAM            },
  1089. X        { "dgram",                SOCK_DGRAM            },
  1090. X        { "raw",                    SOCK_RAW                },
  1091. X        { "seqpacket",            SOCK_SEQPACKET        },
  1092. X        { CHAR_NULL,            1                        },
  1093. X        { "BAD SOCKET TYPE",    0                        }
  1094. X    } ;
  1095. X
  1096. X
  1097. Xstruct name_value success_log_options[] =
  1098. X    {
  1099. X        { "HOST",              LO_HOST            },
  1100. X        { "DURATION",          LO_DURATION        },
  1101. X        { "EXIT",              LO_EXIT            },
  1102. X        { "PID",                    LO_PID            },
  1103. X        { "USERID",                LO_USERID        },
  1104. X        { CHAR_NULL,            0                    }
  1105. X    } ;
  1106. X
  1107. X
  1108. Xstruct name_value failure_log_options[] = 
  1109. X    {
  1110. X        { "HOST",              LO_HOST            },
  1111. X        { "ATTEMPT",            LO_ATTEMPT        },
  1112. X        { "RECORD",                LO_RECORD        },
  1113. X        { "USERID",                LO_USERID        },
  1114. X        { CHAR_NULL,            0                    }
  1115. X    } ;
  1116. X
  1117. X
  1118. X
  1119. Xstruct name_value syslog_facilities[] =
  1120. X    {
  1121. X        { "daemon",                LOG_DAEMON    },
  1122. X        { "auth",                LOG_AUTH        },
  1123. X        { "user",                LOG_USER        },
  1124. X        { "local0",                LOG_LOCAL0    },
  1125. X        { "local1",                LOG_LOCAL1    },
  1126. X        { "local2",                LOG_LOCAL2    },
  1127. X        { "local3",                LOG_LOCAL3    },
  1128. X        { "local4",                LOG_LOCAL4    },
  1129. X        { "local5",                LOG_LOCAL5    },
  1130. X        { "local6",                LOG_LOCAL6    },
  1131. X        { "local7",                LOG_LOCAL7    },
  1132. X        { CHAR_NULL,             1                },
  1133. X        { "BAD FACILITY",        0                }
  1134. X    } ;
  1135. X
  1136. X
  1137. Xstruct name_value syslog_levels[] = 
  1138. X    {
  1139. X        { "emerg",                LOG_EMERG    },
  1140. X        { "alert",                LOG_ALERT    },
  1141. X        { "crit",                LOG_CRIT        },
  1142. X        { "err",                    LOG_ERR        },
  1143. X        { "warning",            LOG_WARNING    },
  1144. X        { "notice",                LOG_NOTICE    },
  1145. X        { "info",                LOG_INFO        },
  1146. X        { "debug",                LOG_DEBUG    },
  1147. X        { CHAR_NULL,            1                },
  1148. X        { "BAD LEVEL",            0                }
  1149. X    } ;
  1150. X
  1151. END_OF_FILE
  1152. if test 2285 -ne `wc -c <'xinetd/nvlists.c'`; then
  1153.     echo shar: \"'xinetd/nvlists.c'\" unpacked with wrong size!
  1154. fi
  1155. # end of 'xinetd/nvlists.c'
  1156. fi
  1157. if test -f 'xinetd/server.h' -a "${1}" != "-c" ; then 
  1158.   echo shar: Will not clobber existing file \"'xinetd/server.h'\"
  1159. else
  1160. echo shar: Extracting \"'xinetd/server.h'\" \(2576 characters\)
  1161. sed "s/^X//" >'xinetd/server.h' <<'END_OF_FILE'
  1162. X/*
  1163. X * (c) Copyright 1992 by Panagiotis Tsirigotis
  1164. X * All rights reserved.  The file named COPYRIGHT specifies the terms 
  1165. X * and conditions for redistribution.
  1166. X */
  1167. X
  1168. X#ifndef SERVER_H
  1169. X#define SERVER_H
  1170. X
  1171. X/*
  1172. X * $Id: server.h,v 6.7 1993/06/20 20:13:47 panos Exp $
  1173. X */
  1174. X
  1175. X#include <sys/types.h>
  1176. X#include <sys/wait.h>
  1177. X
  1178. X#include "defs.h"
  1179. X#include "service.h"
  1180. X#include "connection.h"
  1181. X
  1182. X#ifdef NO_POSIX_TYPES
  1183. Xtypedef int pid_t ;
  1184. X#endif
  1185. X
  1186. X
  1187. X/*
  1188. X * This struct describes running servers
  1189. X */
  1190. Xstruct server
  1191. X{
  1192. X    pid_t             svr_pid ;
  1193. X    time_t             svr_start_time ;
  1194. X    connection_s    *svr_conn ;
  1195. X    struct service *svr_sp ;                /* service that owns this server     */
  1196. X    int                 svr_fork_failures ;    /* number of fork(2) failures            */
  1197. X    int                 svr_exit_status ;
  1198. X    bool_int         svr_log_remote_user ;
  1199. X    bool_int         svr_writes_to_log ;    /* needed because a service may be    */
  1200. X                                                    /* reconfigured between server         */
  1201. X                                                    /*    forking and exit                        */
  1202. X} ;
  1203. X
  1204. X#define SERP( p )                        ((struct server *)(p))
  1205. X
  1206. X#define SERVER_SERVICE( serp )            (serp)->svr_sp
  1207. X#define SERVER_CONNECTION( serp)            (serp)->svr_conn
  1208. X#define SERVER_CONNSERVICE( serp )        CONN_SERVICE( SERVER_CONNECTION( serp ) )
  1209. X#define SERVER_FD( serp )                    CONN_DESCRIPTOR( (serp)->svr_conn )
  1210. X#define SERVER_PID( serp )                    (serp)->svr_pid
  1211. X#define SERVER_EXITSTATUS( serp )        (serp)->svr_exit_status
  1212. X#define SERVER_STARTTIME( serp )            (serp)->svr_start_time
  1213. X#define SERVER_LOGUSER( serp )            (serp)->svr_log_remote_user
  1214. X
  1215. X#define SERVER_FORKLIMIT( serp )            \
  1216. X                        ( (serp)->svr_fork_failures >= MAX_FORK_FAILURES )
  1217. X
  1218. X#define server_set_pid( serp, pid )        (serp)->svr_pid = (pid)
  1219. X#define server_set_exit_status( serp, status )    \
  1220. X                        (serp)->svr_exit_status = (status)
  1221. X
  1222. Xstatus_e         server_init() ;
  1223. Xvoid                server_release() ;
  1224. Xstatus_e            server_run() ;
  1225. Xstatus_e            server_start() ;
  1226. Xvoid                server_dump() ;
  1227. Xvoid                server_end() ;
  1228. Xstruct server    *server_lookup() ;
  1229. X
  1230. X
  1231. X/*
  1232. X * Macros for compatibility
  1233. X */
  1234. X#ifndef OLD_WAIT
  1235. X#define PROC_EXITED( s )         WIFEXITED( s )
  1236. X#define PROC_SIGNALED( s )       WIFSIGNALED( s )
  1237. X#define PROC_STOPPED( s )        WIFSTOPPED( s )
  1238. X#define PROC_EXITSTATUS( s )     WEXITSTATUS( s )
  1239. X#define PROC_TERMSIG( s )        WTERMSIG( s )
  1240. X#else
  1241. X#define PROC_EXITED( s )         WIFEXITED( *(union wait *)&(s) )
  1242. X#define PROC_SIGNALED( s )       WIFSIGNALED( *(union wait *)&(s) )
  1243. X#define PROC_STOPPED( s )        WIFSTOPPED( *(union wait *)&(s) )
  1244. X#define PROC_EXITSTATUS( s )     (((union wait *)&(s))->w_T.w_Retcode)
  1245. X#define PROC_TERMSIG( s )        (((union wait *)&(s))->w_T.w_Termsig)
  1246. X#endif   /* OLD_WAIT */
  1247. X
  1248. X#endif    /* SERVER_H */
  1249. X
  1250. END_OF_FILE
  1251. if test 2576 -ne `wc -c <'xinetd/server.h'`; then
  1252.     echo shar: \"'xinetd/server.h'\" unpacked with wrong size!
  1253. fi
  1254. # end of 'xinetd/server.h'
  1255. fi
  1256. echo shar: End of archive 4 \(of 31\).
  1257. cp /dev/null ark4isdone
  1258. MISSING=""
  1259. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ; do
  1260.     if test ! -f ark${I}isdone ; then
  1261.     MISSING="${MISSING} ${I}"
  1262.     fi
  1263. done
  1264. if test "${MISSING}" = "" ; then
  1265.     echo You have unpacked all 31 archives.
  1266.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1267. else
  1268.     echo You still need to unpack the following archives:
  1269.     echo "        " ${MISSING}
  1270. fi
  1271. ##  End of shell archive.
  1272. exit 0
  1273.