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

  1. Newsgroups: comp.sources.unix
  2. From: panos@cs.colorado.edu (Panos Tsirigotis)
  3. Subject: v26i257: xinetd-2.1.1 - inetd replacement with access control and logging, Part13/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 257
  9. Archive-Name: xinetd-2.1.1/part13
  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 13 (of 31)."
  18. # Contents:  libs/src/pq/hpq.c libs/src/pset/pset.3 libs/src/sio/impl.h
  19. #   xinetd/intcommon.c xinetd/service.h
  20. # Wrapped by panos@mystique on Mon Jun 21 14:51:24 1993
  21. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  22. if test -f 'libs/src/pq/hpq.c' -a "${1}" != "-c" ; then 
  23.   echo shar: Will not clobber existing file \"'libs/src/pq/hpq.c'\"
  24. else
  25. echo shar: Extracting \"'libs/src/pq/hpq.c'\" \(5510 characters\)
  26. sed "s/^X//" >'libs/src/pq/hpq.c' <<'END_OF_FILE'
  27. X/*
  28. X * (c) Copyright 1993 by Panagiotis Tsirigotis
  29. X * All rights reserved.  The file named COPYRIGHT specifies the terms 
  30. X * and conditions for redistribution.
  31. X */
  32. X
  33. Xstatic char RCSid[] = "$Id: hpq.c,v 1.3 1993/04/01 02:15:46 panos Exp $" ;
  34. Xstatic char version[] = VERSION ;
  35. X
  36. X#include "pq.h"
  37. X#include "hpqimpl.h"
  38. X
  39. X#define PRIVATE            static
  40. X
  41. X#ifndef NULL
  42. X#define NULL 0
  43. X#endif
  44. X
  45. X#define PARENT( i )        ( i >> 1 )
  46. X#define LEFT( i )            ( i << 1 )
  47. X#define RIGHT( i )        ( LEFT( i ) + 1 )
  48. X
  49. Xint pq_errno ;
  50. X
  51. X#define INITIAL_ARRAY_SIZE                100                /* entries */
  52. X
  53. X
  54. Xpq_h __hpq_create( func, flags, errnop )
  55. X    int (*func)() ;
  56. X    int flags ;
  57. X    int *errnop ;
  58. X{
  59. X    register header_s *hp ;
  60. X    int *errp = ( errnop == NULL ) ? &pq_errno : errnop ;
  61. X    char *malloc() ;
  62. X
  63. X    /*
  64. X     * Check if the user has provided the necessary comparison functions
  65. X     */
  66. X    if ( func == NULL )
  67. X        HANDLE_ERROR( flags, NULL, errp, PQ_ENOFUNC,
  68. X                "HPQ __hpq_create: missing object-object comparator\n" ) ;
  69. X
  70. X    hp = HHP( malloc( sizeof( header_s ) ) ) ;
  71. X    if ( hp == NULL )
  72. X        HANDLE_ERROR( flags, NULL, errp, PQ_ENOMEM,
  73. X                                                "HPQ __hpq_create: malloc failed\n" ) ;
  74. X    
  75. X    /*
  76. X     * Allocate object array
  77. X     */
  78. X    hp->objects = (pq_obj *) malloc( INITIAL_ARRAY_SIZE * sizeof( pq_obj ) ) ;
  79. X    if ( hp->objects == NULL )
  80. X    {
  81. X        free( (char *)hp ) ;
  82. X        HANDLE_ERROR( flags, NULL, errp, PQ_ENOMEM, 
  83. X                                                "HPQ __hpq_create: malloc failed\n" ) ;
  84. X    }
  85. X
  86. X    /*
  87. X     * Initialize the header
  88. X     */
  89. X    hp->is_better = func ;
  90. X    hp->errnop = errp ;
  91. X    hp->flags = flags ;
  92. X    hp->max_size = INITIAL_ARRAY_SIZE ;
  93. X    hp->cur_size = 0 ;
  94. X    return( (pq_h) hp ) ;
  95. X}
  96. X
  97. X
  98. Xvoid __hpq_destroy( handle )
  99. X    pq_h handle ;
  100. X{
  101. X    header_s *hp = HHP( handle ) ;
  102. X
  103. X    free( (char *) hp->objects ) ;
  104. X    free( (char *)hp ) ;
  105. X}
  106. X
  107. X
  108. Xint __hpq_insert( handle, object )
  109. X    pq_h handle ;
  110. X    pq_obj object ;
  111. X{
  112. X    register header_s *hp = HHP( handle ) ;
  113. X    register unsigned i, parent ;
  114. X
  115. X    if ( object == NULL )
  116. X        HANDLE_ERROR( hp->flags, PQ_ERR, hp->errnop, PQ_ENULLOBJECT,
  117. X                                            "HPQ __hpq_insert: NULL object\n" ) ;
  118. X
  119. X    /*
  120. X     * Make sure there is room to store the object
  121. X     */
  122. X    if ( hp->cur_size >= hp->max_size && grow( hp ) == PQ_ERR )
  123. X        return( PQ_ERR ) ;
  124. X
  125. X    i = hp->cur_size++ ;
  126. X    parent = PARENT( i ) ;
  127. X    while ( i > 0 && (*hp->is_better)( object, hp->objects[ parent ] ) )
  128. X    {
  129. X        hp->objects[ i ] = hp->objects[ parent ] ;
  130. X        i = parent ;
  131. X        parent = PARENT( i ) ;
  132. X    }
  133. X    hp->objects[ i ] = object ;
  134. X    return( PQ_OK ) ;
  135. X}
  136. X
  137. X
  138. X#define CUTOFF                                (INITIAL_ARRAY_SIZE * 128)
  139. X#define INCREMENT                            CUTOFF
  140. X
  141. X/*
  142. X * Grow the table.
  143. X * Algorithm:
  144. X *            while the table_size is less than CUTOFF, double the size.
  145. X *         if it grows greater than CUTOFF, increase the size by INCREMENT
  146. X *            (these number are in entries, not bytes)
  147. X */
  148. XPRIVATE int grow( hp )
  149. X    header_s *hp ;
  150. X{
  151. X    unsigned new_size ;
  152. X    char *new_objects ;
  153. X    char *realloc() ;
  154. X
  155. X    if ( hp->max_size < CUTOFF )
  156. X        new_size = hp->max_size * 2 ;
  157. X    else
  158. X        new_size = hp->max_size + INCREMENT ;
  159. X
  160. X    new_objects = realloc( (char *)hp->objects, new_size * sizeof( pq_obj ) ) ;
  161. X    if ( new_objects == NULL )
  162. X        HANDLE_ERROR( hp->flags, PQ_ERR, hp->errnop, PQ_ENOMEM,
  163. X                                        "HPQ grow: out of memory\n" ) ;
  164. X    
  165. X    hp->max_size = new_size ;
  166. X    hp->objects = (pq_obj *) new_objects ;
  167. X    return( PQ_OK ) ;
  168. X}
  169. X
  170. X
  171. Xpq_obj __hpq_extract_head( handle )
  172. X    pq_h handle ;
  173. X{
  174. X    register header_s *hp = HHP( handle ) ;
  175. X    pq_obj object ;
  176. X    void restore_heap() ;
  177. X
  178. X    if ( hp->cur_size == 0 )
  179. X        return( NULL ) ;
  180. X    
  181. X    object = hp->objects[ 0 ] ;
  182. X    hp->objects[ 0 ] = hp->objects[ --hp->cur_size ] ;
  183. X    restore_heap( hp, 0 ) ;
  184. X    return( object ) ;
  185. X}
  186. X
  187. X
  188. X#define EXISTS( hp, i )                ( i < hp->cur_size )
  189. X#define IS_BETTER( hp, i, j )        \
  190. X            ( (*hp->is_better)( hp->objects[ i ], hp->objects[ j ] ) )
  191. X#define SWAP( hp, i, j )                                \
  192. X        {                                                        \
  193. X            pq_obj t = hp->objects[ i ] ;                \
  194. X            hp->objects[ i ] = hp->objects[ j ] ;    \
  195. X            hp->objects[ j ] = t ;                        \
  196. X        }
  197. X
  198. XPRIVATE void restore_heap( hp, start )
  199. X    register header_s *hp ;
  200. X    unsigned start ;
  201. X{
  202. X    register unsigned current = start ;
  203. X    register unsigned better = current ;
  204. X
  205. X    for ( ;; )
  206. X    {
  207. X        register unsigned left = LEFT( current ) ;
  208. X        register unsigned right = RIGHT( current ) ;
  209. X
  210. X        /*
  211. X         * Meaning of variables:
  212. X         *
  213. X         *        current:        the current tree node
  214. X         *        left:            its left child
  215. X         *        right:        its right child
  216. X         *        better:         the best of current,left,right
  217. X         *
  218. X         * We start the loop with better == current
  219. X         *
  220. X         * The code takes advantage of the fact that the existence of
  221. X         * the right child implies the existence of the left child.
  222. X         * It works by finding the better of the two children (and puts
  223. X         * that in better) and comparing that against current.
  224. X         */
  225. X        if ( EXISTS( hp, right ) )
  226. X            better = IS_BETTER( hp, left, right ) ? left : right ;
  227. X        else if ( EXISTS( hp, left ) )
  228. X            better = left ;
  229. X
  230. X        if ( better == current || IS_BETTER( hp, current, better ) )
  231. X            break ;
  232. X        else 
  233. X        {
  234. X            SWAP( hp, current, better ) ;
  235. X            current = better ;
  236. X        }
  237. X    }
  238. X}
  239. X
  240. X
  241. Xint __hpq_delete( handle, object )
  242. X    pq_h handle ;
  243. X    register pq_obj object ;
  244. X{
  245. X    register header_s *hp = HHP( handle ) ;
  246. X    register unsigned i ;
  247. X
  248. X    if ( object == NULL )
  249. X        HANDLE_ERROR( hp->flags, PQ_ERR, hp->errnop, PQ_ENULLOBJECT,
  250. X                                            "HPQ __hpq_delete: NULL object\n" ) ;
  251. X
  252. X    /*
  253. X     * First find it
  254. X     */
  255. X    for ( i = 0 ;; i++ )
  256. X    {
  257. X        if ( i < hp->cur_size )
  258. X            if ( object == hp->objects[ i ] )
  259. X                break ;
  260. X            else
  261. X                continue ;
  262. X        else
  263. X            HANDLE_ERROR( hp->flags, PQ_ERR, hp->errnop, PQ_ENOTFOUND,
  264. X                    "HPQ __hpq_delete: object not found\n" ) ;
  265. X    }
  266. X
  267. X    hp->objects[ i ] = hp->objects[ --hp->cur_size ] ;
  268. X    restore_heap( hp, i ) ;
  269. X    return( PQ_OK ) ;
  270. X}
  271. X
  272. END_OF_FILE
  273. if test 5510 -ne `wc -c <'libs/src/pq/hpq.c'`; then
  274.     echo shar: \"'libs/src/pq/hpq.c'\" unpacked with wrong size!
  275. fi
  276. # end of 'libs/src/pq/hpq.c'
  277. fi
  278. if test -f 'libs/src/pset/pset.3' -a "${1}" != "-c" ; then 
  279.   echo shar: Will not clobber existing file \"'libs/src/pset/pset.3'\"
  280. else
  281. echo shar: Extracting \"'libs/src/pset/pset.3'\" \(5460 characters\)
  282. sed "s/^X//" >'libs/src/pset/pset.3' <<'END_OF_FILE'
  283. X.\"(c) Copyright 1992, 1993 by Panagiotis Tsirigotis
  284. X.\"All rights reserved.  The file named COPYRIGHT specifies the terms 
  285. X.\"and conditions for redistribution.
  286. X.\"
  287. X.\" $Id: pset.3,v 3.4 1993/04/23 18:16:50 panos Exp $
  288. X.TH PSET 3X "23 April 1993"
  289. X.SH NAME
  290. Xpset_create, pset_destroy, pset_add, pset_insert, pset_remove, pset_delete, pset_remove_index, pset_clear, pset_count, pset_pointer, pset_compact, pset_sort, pset_apply - routines that handle pointer sets
  291. X.SH SYNOPSIS
  292. X.LP
  293. X.nf
  294. X.ft B
  295. X#include "pset.h"
  296. X.LP
  297. X.ft B
  298. Xpset_h pset_create( alloc_start, alloc_step )
  299. Xunsigned alloc_start, alloc_step ;
  300. X.LP
  301. X.ft B
  302. Xvoid pset_destroy( pset )
  303. Xpset_h pset ;
  304. X.LP
  305. X.ft B
  306. XANY_TYPE *pset_add( pset, ptr )
  307. Xpset_h pset ;
  308. XANY_TYPE *ptr ;
  309. X.LP
  310. X.ft B
  311. Xvoid *pset_insert( pset, ptr )
  312. Xpset_h pset ;
  313. Xvoid *ptr ;
  314. X.LP
  315. X.ft B
  316. Xvoid pset_remove( pset, ptr )
  317. Xpset_h pset ;
  318. XANY_TYPE *ptr ;
  319. X.LP
  320. X.ft B
  321. Xvoid pset_delete( pset, ptr )
  322. Xpset_h pset ;
  323. Xvoid *ptr ;
  324. X.LP
  325. X.ft B
  326. Xvoid pset_remove_index( pset, index )
  327. Xpset_h pset ;
  328. Xunsigned index ;
  329. X.LP
  330. X.ft B
  331. Xvoid pset_clear( pset )
  332. Xpset_h pset ;
  333. X.LP
  334. X.ft B
  335. Xunsigned pset_count( pset )
  336. Xpset_h pset ;
  337. X.LP
  338. X.ft B
  339. Xvoid *pset_pointer( pset, index )
  340. Xpset_h pset ;
  341. Xunsigned index ;
  342. X.LP
  343. X.ft B
  344. Xvoid pset_compact( pset )
  345. Xpset_h pset ;
  346. X.LP
  347. X.ft B
  348. Xvoid pset_sort( pset, compfunc )
  349. Xpset_h pset ;
  350. Xint (*compfunc)() ;
  351. X.LP
  352. X.ft B
  353. Xvoid pset_apply( pset, func, arg )
  354. Xpset_h pset ;
  355. Xvoid (*func)() ;
  356. Xvoid *arg ;
  357. X.SH DESCRIPTION
  358. XThis library provides functions that handle sets of pointers. Pointers
  359. Xcan be inserted and deleted from sets and the sets can be enumerated.
  360. XPointers are inserted in sets in no particular order. However it is 
  361. Xguaranteed
  362. Xthat a sequence of insertions will result in a set which if enumerated
  363. Xwill provide the pointers in the same order in which they were inserted
  364. X(assuming no intervening deletions).
  365. X.LP
  366. X.B pset_create()
  367. Xcreates a pointer set.
  368. X.I alloc_start
  369. Xdetermines the initial table size, and
  370. X.I alloc_step
  371. Xdetermines the amount by which the set size is increased in case of
  372. Xoverflow. If any of these parameters is 0, a default value is used.
  373. X.LP
  374. X.B pset_destroy()
  375. Xdestroys the specified pointer set.
  376. X.LP
  377. X.B pset_add()
  378. Xis a macro that adds a pointer to the specified set.
  379. XThe pointer can be of any type.
  380. X.LP
  381. X.B pset_insert()
  382. Xinserts a pointer to the specified set.
  383. XThis is the same operation as
  384. X.B pset_add().
  385. X.LP
  386. X.B pset_remove()
  387. Xremoves a pointer from the specified set.
  388. X.LP
  389. X.B pset_delete()
  390. Xdeletes a pointer from the specified set.
  391. XThis is the same operation as
  392. X.B pset_remove().
  393. X.LP
  394. X.B pset_remove_index()
  395. Xremoves the pointer that is at position
  396. X.I index
  397. Xin the set.
  398. X.I index
  399. Xshould be in the range [0, \fBpset_count(pset)\fP) (but there is no
  400. Xcheck to enforce this).
  401. XAfter this operation, the
  402. X.I index
  403. Xposition will be occupied by another pointer.
  404. X.LP
  405. X.B pset_clear()
  406. Xremoves all pointers from the specified set.
  407. X.LP
  408. X.B pset_count()
  409. Xreturns the number of pointers in the specified set.
  410. X.LP
  411. X.B pset_pointer()
  412. Xreturns the pointer at position
  413. X.I index
  414. Xin the specified set.
  415. X.I index
  416. Xmust be between 0 and
  417. X.B "pset_count(pset)."
  418. X.B pset_pointer()
  419. Xis a macro and it can also be used in the left-hand side of assignments.
  420. X.LP
  421. X.B pset_compact()
  422. Xremoves all NULL pointers from
  423. X.I pset.
  424. X.LP
  425. X.B pset_sort()
  426. Xsorts the pointers in
  427. X.I pset
  428. Xusing the specified function.
  429. X.I compfunc
  430. Xis invoked with 2 arguments that are pointers pointing to pointers stored in 
  431. X.I pset.
  432. XFor example, if the pset holds pointers to objects of type T, then
  433. Xthe function F whose address is in
  434. X.I compfunc
  435. Xshould be defined as:
  436. XF( T **p1, T **p2 ).
  437. X.br
  438. X.I compfunc 
  439. Xshould return a negative, zero or positive value 
  440. Xif its first argument is less than, equal to, or greater than its
  441. Xsecond argument.
  442. X.LP
  443. X.B pset_apply()
  444. Xapplies
  445. X.I func
  446. Xto all pointers in
  447. X.I pset.
  448. XIf 
  449. X.I arg
  450. Xis not
  451. X.SM NULL
  452. Xthe function is invoked as:
  453. X.RS
  454. X(*func)( arg, p )
  455. X.RE
  456. Xwhere
  457. X.I p
  458. Xis a pset pointer.  If 
  459. X.I arg
  460. Xis
  461. X.SM NULL
  462. Xthe function is invoked as:
  463. X.RS
  464. X(*func)( p )
  465. X.RE
  466. X.SH EXAMPLE
  467. XThe following code fragment reads lines from standard input
  468. Xand places them in a pset. Then it sorts the pset, prints the
  469. Xsorted contents to standard output and then it eliminates duplicate
  470. Xlines (which it also prints to standard output).
  471. X.RS
  472. X.sp 1
  473. X.ft B
  474. X.nf
  475. Xpset_h ph ;
  476. Xchar buf[ 80 ] ;
  477. Xunsigned u ;
  478. Xint compstr() ;
  479. Xvoid printstr() ;
  480. X.sp 1
  481. Xph = pset_create( 0, 0 ) ;
  482. Xwhile ( gets( buf ) )
  483. X.RS
  484. Xpset_add( strcpy( malloc( strlen( buf ) + 1 ), buf ) ) ;
  485. X.RE
  486. Xpset_sort( ph, compstr ) ;
  487. Xfor ( u = 0 ; u < pset_count( ph ) ; u++ )
  488. X.RS
  489. Xprintf( "%s\\n", (char *) pset_pointer( ph, u ) ) ;
  490. X.RE
  491. X.RE
  492. X.fi
  493. X.ft R
  494. X.LP
  495. XThe function
  496. X.I compstr()
  497. Xfollows:
  498. X.sp 1
  499. X.RS
  500. X.ft B
  501. X.nf
  502. Xint compstr( p1, p2 )
  503. X.RS
  504. Xchar **p1, **p2 ;
  505. X.RE
  506. X{
  507. X.RS
  508. Xreturn( strcmp( *p1, *p2 ) ) ;
  509. X.RE
  510. X}
  511. X.RE
  512. X.SH "RETURN VALUES"
  513. X.LP
  514. X.I pset_h
  515. Xis a pointer type. Functions that return
  516. X.I pset_h
  517. Xwill return
  518. X.SM NULL
  519. Xto indicate an error.
  520. X.LP
  521. X.B pset_create()
  522. Xreturns a pointer set handle or
  523. X.SM NULL
  524. Xif it fails.
  525. X.LP
  526. X.B pset_add()
  527. Xreturns its second argument if successful or
  528. X.SM NULL
  529. Xif it fails.
  530. X.LP
  531. X.B pset_insert()
  532. Xreturns its second argument if successful or
  533. X.SM NULL
  534. Xif it fails.
  535. X.LP
  536. X.B pset_count()
  537. Xalways returns the number of pointers in the set.
  538. X.LP
  539. X.B pset_pointer()
  540. Xalways returns a pointer. There is no check if the specified index is within
  541. Xrange.
  542. X.SH BUGS
  543. X.LP
  544. X.B pset_add(),
  545. X.B pset_remove(),
  546. X.B pset_remove_index(),
  547. X.B pset_count(),
  548. X.B pset_clear(),
  549. X.B pset_pointer()
  550. Xand 
  551. X.B pset_sort()
  552. Xare macros, therefore the \fI&\fR operator cannot be applied to them.
  553. END_OF_FILE
  554. if test 5460 -ne `wc -c <'libs/src/pset/pset.3'`; then
  555.     echo shar: \"'libs/src/pset/pset.3'\" unpacked with wrong size!
  556. fi
  557. # end of 'libs/src/pset/pset.3'
  558. fi
  559. if test -f 'libs/src/sio/impl.h' -a "${1}" != "-c" ; then 
  560.   echo shar: Will not clobber existing file \"'libs/src/sio/impl.h'\"
  561. else
  562. echo shar: Extracting \"'libs/src/sio/impl.h'\" \(5528 characters\)
  563. sed "s/^X//" >'libs/src/sio/impl.h' <<'END_OF_FILE'
  564. X/*
  565. X * (c) Copyright 1992, 1993 by Panagiotis Tsirigotis
  566. X * All rights reserved.  The file named COPYRIGHT specifies the terms 
  567. X * and conditions for redistribution.
  568. X */
  569. X
  570. X/*
  571. X * $Id: impl.h,v 8.1 1993/03/13 01:15:06 panos Exp $
  572. X */
  573. X
  574. X#ifndef SIO_BUFFER_SIZE
  575. X
  576. X#include "sioconf.h"
  577. X
  578. X#ifdef HAS_MMAP
  579. X#include <sys/types.h>
  580. X
  581. X
  582. X/*
  583. X * A struct map_unit describes a memory mapped area of a file.
  584. X *
  585. X * addr is the address where the file is mapped. If addr is NULL
  586. X * the other fields are meaningless.
  587. X * valid_bytes indicates how many bytes are _valid_ in that unit
  588. X * mapped_bytes of a unit is how many bytes are mapped in that
  589. X * unit ( valid <= mapped ).
  590. X * Normally mapped_bytes will be equal to valid_bytes until
  591. X * we reach the end of the file. Then if the file size is not a multiple
  592. X * of the unit size, only the rest of the file will be mapped at the
  593. X * unit, leaving part of what was mapped at the unit before still
  594. X * visible (this happens because I chose not to unmap a unit before
  595. X * remapping it). In that case valid_bytes shows the size of the "new"
  596. X * mapping and mapped_bytes shows how many bytes are really mapped.
  597. X * mapped_bytes is used in Sdone() to unmap the units.
  598. X */
  599. Xstruct map_unit
  600. X{
  601. X    caddr_t addr ;
  602. X    size_t valid_bytes ;
  603. X    size_t mapped_bytes ;
  604. X} ;
  605. X
  606. X
  607. X/*
  608. X * Meaning of fields used when memory mapping:
  609. X *
  610. X *    file_offset:      it is the offset in the file where the next
  611. X *                      mapping should be done
  612. X *
  613. X *    file_size:        size of the file (obtained from stat(2))
  614. X */
  615. Xstruct mmap_descriptor
  616. X{
  617. X   off_t file_offset ;
  618. X   off_t file_size ;
  619. X    struct map_unit first_unit ;
  620. X    struct map_unit second_unit ;
  621. X} ;
  622. X
  623. Xtypedef struct mmap_descriptor mapd_s ;
  624. X
  625. X#endif /* HAS_MMAP */
  626. X
  627. Xtypedef enum { FAILURE, SUCCESS } status_e ;
  628. X
  629. X/*
  630. X * Descriptor management: convert a descriptor pointer to an input or
  631. X * output descriptor pointer
  632. X */
  633. X#define IDP( dp )                        (&(dp)->descriptor.input_descriptor)
  634. X#define ODP( dp )                        (&(dp)->descriptor.output_descriptor)
  635. X
  636. X#define DESCRIPTOR_INITIALIZED( dp )    ((dp)->initialized)
  637. X
  638. X/*
  639. X * Internal constants
  640. X */
  641. X#define SIO_BUFFER_SIZE           8192
  642. X#define SIO_NO_TIED_FD                (-1)
  643. X
  644. Xtypedef enum { NO = 0, YES = 1 } boolean_e ;
  645. X
  646. X#ifndef FALSE
  647. X#define FALSE            0
  648. X#define TRUE            1
  649. X#endif
  650. X
  651. X#ifndef NULL
  652. X#define NULL            0
  653. X#endif
  654. X
  655. X#ifdef MIN
  656. X#undef MIN
  657. X#endif
  658. X#define MIN( a, b )                    ( (a) < (b) ? (a) : (b) )
  659. X
  660. X#define NUL                                '\0'
  661. X
  662. X#define PRIVATE                        static
  663. X
  664. X#ifdef DEBUG
  665. X
  666. Xstatic char *itoa( num )
  667. X    unsigned num ;
  668. X{
  669. X#define NUMBUF_SIZE        15
  670. X    static char numbuf[ NUMBUF_SIZE ] ;
  671. X    register char *p = &numbuf[ NUMBUF_SIZE ] ;
  672. X
  673. X    *--p = '\0' ;
  674. X    do
  675. X    {
  676. X        *--p = num % 10 + '0' ;
  677. X        num /= 10 ;
  678. X    }
  679. X    while ( num ) ;
  680. X    return( p ) ;
  681. X}
  682. X
  683. X#    define ASSERT( expr )                                                        \
  684. X        if ( ! (expr) )                                                            \
  685. X        {                                                                                \
  686. X            char *s1 = "SIO assertion << expr >> failed: File: " ;    \
  687. X            char *s2 = __FILE__ ;                                                \
  688. X            char *s3 = ", line: " ;                                                \
  689. X            char *s4 = itoa( __LINE__ ) ;                                        \
  690. X            char *s5 = "\n" ;                                                        \
  691. X            (void) write( 2, s1, strlen( s1 ) ) ;                            \
  692. X            (void) write( 2, s2, strlen( s2 ) ) ;                            \
  693. X            (void) write( 2, s3, strlen( s3 ) ) ;                            \
  694. X            (void) write( 2, s4, strlen( s4 ) ) ;                            \
  695. X            (void) write( 2, s5, strlen( s5 ) ) ;                            \
  696. X            exit ( 1 ) ;                                                            \
  697. X        }
  698. X#else
  699. X#    define ASSERT( expr )
  700. X#endif
  701. X
  702. X
  703. X#include <errno.h>
  704. Xextern int errno ;
  705. X
  706. X/*
  707. X * IO_SETUP initializes a descriptor if it is not already initialized.
  708. X * It checks if the stream is of the right type (input or output).
  709. X * CONTROL_SETUP checks if the descriptor is initialized and if the
  710. X * stream is of the right type (input or output). 
  711. X *
  712. X *     fd: file descriptor
  713. X *     dp: descriptor pointer
  714. X *     op: operation
  715. X *     ev: error value (if __sio_init fails; __sio_init should set errno) 
  716. X *
  717. X * IO_SETUP will call __sio_init if the descriptor is not initialized.
  718. X * Possible errors:
  719. X *        1. Using CONTROL_SETUP on an uninitialized descriptor.
  720. X *        2. The operation is not appropriate for the descriptor (e.g.
  721. X *            a read operation on an descriptor used for writing). 
  722. X * Both errors set errno to EBADF.
  723. X */
  724. X#define CONTROL_SETUP( dp, type, ev )                                                        \
  725. X            {                                                                                            \
  726. X                if ( ! DESCRIPTOR_INITIALIZED( dp ) || dp->stream_type != type )    \
  727. X                {                                                                                        \
  728. X                    errno = EBADF ;                                                                \
  729. X                    return( ev ) ;                                                                    \
  730. X                }                                                                                        \
  731. X            }
  732. X
  733. X
  734. X#define IO_SETUP( fd, dp, type, ev )                                                        \
  735. X            {                                                                                            \
  736. X                if ( DESCRIPTOR_INITIALIZED( dp ) )                                         \
  737. X                {                                                                                        \
  738. X                    if ( dp->stream_type != type )                                            \
  739. X                    {                                                                                    \
  740. X                        errno = EBADF ;                                                            \
  741. X                        return( ev ) ;                                                                \
  742. X                    }                                                                                    \
  743. X                }                                                                                        \
  744. X                else if ( __sio_init( dp, fd, type ) == SIO_ERR )                        \
  745. X                    return( ev ) ;                                                                    \
  746. X            }
  747. X
  748. X
  749. X/*
  750. X * Internal functions that are visible
  751. X */
  752. Xint __sio_readf(), __sio_writef(), __sio_pwritef() ;
  753. Xint __sio_extend_buffer(), __sio_init(), __sio_converter(), __sio_more() ;
  754. Xstatus_e __sio_switch() ;
  755. X
  756. X
  757. X#ifdef HAS_MEMOPS
  758. X#include <memory.h>
  759. X#define sio_memcopy( from, to, nbytes )       (void) memcpy( to, from, nbytes )
  760. X#define sio_memscan( from, nbytes, ch )      memchr( from, ch, nbytes )
  761. X#endif
  762. X
  763. X#ifdef HAS_BCOPY
  764. X#define sio_memcopy( from, to, nbytes )      (void) bcopy( from, to, nbytes )
  765. X#endif
  766. X
  767. X#ifndef sio_memcopy
  768. X#define sio_memcopy        __sio_memcopy
  769. X#define NEED_MEMCOPY
  770. Xvoid __sio_memcopy() ;
  771. X#endif
  772. X
  773. X#ifndef sio_memscan
  774. Xchar *sio_memscan() ;
  775. X#endif
  776. X
  777. X#endif /* SIO_BUFFER_SIZE */
  778. X
  779. END_OF_FILE
  780. if test 5528 -ne `wc -c <'libs/src/sio/impl.h'`; then
  781.     echo shar: \"'libs/src/sio/impl.h'\" unpacked with wrong size!
  782. fi
  783. # end of 'libs/src/sio/impl.h'
  784. fi
  785. if test -f 'xinetd/intcommon.c' -a "${1}" != "-c" ; then 
  786.   echo shar: Will not clobber existing file \"'xinetd/intcommon.c'\"
  787. else
  788. echo shar: Extracting \"'xinetd/intcommon.c'\" \(5511 characters\)
  789. sed "s/^X//" >'xinetd/intcommon.c' <<'END_OF_FILE'
  790. X/*
  791. X * (c) Copyright 1992 by Panagiotis Tsirigotis
  792. X * All rights reserved.  The file named COPYRIGHT specifies the terms 
  793. X * and conditions for redistribution.
  794. X */
  795. X
  796. Xstatic char RCSid[] = "$Id: intcommon.c,v 6.6 1993/06/06 00:14:25 panos Exp $" ;
  797. X
  798. X#include <sys/types.h>
  799. X#include <sys/time.h>
  800. X#include <sys/socket.h>
  801. X#include <signal.h>
  802. X#include <syslog.h>
  803. X#include <errno.h>
  804. X
  805. Xvoid exit() ;
  806. X
  807. X#include "int.h"
  808. X#include "defs.h"
  809. X#include "service.h"
  810. X#include "server.h"
  811. X#include "config.h"
  812. X#include "state.h"
  813. X
  814. Xvoid msg() ;
  815. X
  816. X
  817. Xvoid int_fail( ip, syscall )
  818. X    struct intercept *ip ;
  819. X    char *syscall ;
  820. X{
  821. X    msg( LOG_ERR, "fail", "%s failed: %m", syscall ) ;
  822. X    (*ip->int_ops->exit)() ;
  823. X    /* NOTREACHED */
  824. X}
  825. X
  826. X
  827. X/*
  828. X * Returns either a positive number or -1
  829. X */
  830. Xint int_select( max, read_mask )
  831. X    int max ;
  832. X    fd_set *read_mask ;
  833. X{
  834. X    char *func = "int_select" ;
  835. X
  836. X    for ( ;; )
  837. X    {
  838. X        int n_ready ;
  839. X
  840. X        n_ready = select( max+1, read_mask,
  841. X                                            FD_SET_NULL, FD_SET_NULL, TIMEVAL_NULL ) ;
  842. X        if ( n_ready > 0 )
  843. X            return( n_ready ) ;
  844. X        else if ( n_ready == -1 )
  845. X            if ( errno == EINTR )
  846. X                continue ;
  847. X            else
  848. X            {
  849. X                msg( LOG_ERR, func, "select: %m" ) ;
  850. X                return( -1 ) ;
  851. X            }
  852. X    }
  853. X}
  854. X
  855. X
  856. Xvoid int_exit( ip )
  857. X    struct intercept *ip ;
  858. X{
  859. X    int status = SERVER_EXITSTATUS( INT_SERVER( ip ) ) ;
  860. X    char *func = "int_exit" ;
  861. X    char *sig_name() ;
  862. X
  863. X    if ( debug.on )
  864. X    {
  865. X        if ( PROC_EXITED( status ) )
  866. X            msg( LOG_DEBUG, func, "intercepted server died" ) ;
  867. X        else if ( PROC_SIGNALED( status ) )
  868. X            msg( LOG_DEBUG, func, "intercepted server received signal %s",
  869. X                    sig_name( (int) PROC_TERMSIG( status ) ) ) ;
  870. X    }
  871. X    _exit( (int) PROC_EXITSTATUS( status ) ) ;
  872. X}
  873. X
  874. X
  875. X/*
  876. X * The ops vector must be installed before invoking this function
  877. X */
  878. Xvoid int_init( ip, serp )
  879. X    struct intercept *ip ;
  880. X    struct server *serp ;
  881. X{
  882. X    register unsigned u ;
  883. X    char *func = "int_init" ;
  884. X    void int_sighandler() ;
  885. X
  886. X    /*
  887. X     * Sanity test
  888. X     */
  889. X    if ( SERVER_SERVICE( serp ) != SERVER_CONNSERVICE( serp ) )
  890. X    {
  891. X        msg( LOG_ERR, "server service (%s) != connection service (%s)",
  892. X                                    SVC_ID( SERVER_SERVICE( serp ) ),
  893. X                                        SVC_ID( SERVER_CONNSERVICE( serp ) ) ) ;
  894. X        exit( 1 ) ;
  895. X    }
  896. X
  897. X   /*
  898. X    * Close all unneeded descriptors
  899. X    */
  900. X   for ( u = 0 ; u < pset_count( SERVICES( ps ) ) ; u++ )
  901. X   {
  902. X      struct service *sp = SP( pset_pointer( SERVICES( ps ), u ) ) ;
  903. X
  904. X      if ( sp == SERVER_SERVICE( serp ) )
  905. X         continue ;
  906. X      if ( log_get_type( SC_LOG( SVC_CONF( sp ) ) ) == L_FILE )
  907. X         xlog_destroy( sp->svc_log ) ;
  908. X      (void) close( SVC_FD( sp ) ) ;
  909. X   }
  910. X
  911. X    /*
  912. X     * Setup signal handling
  913. X     */
  914. X    if ( (int) signal( SERVER_EXIT_SIG, int_sighandler ) == -1 )
  915. X        int_fail( ip, "signal" ) ;
  916. X    if ( (int) signal( INTERCEPT_SIG, int_sighandler ) == -1 )
  917. X        int_fail( ip, "signal" ) ;
  918. X    if ( (int) signal( SIGTERM, int_sighandler ) == -1 )
  919. X        int_fail( ip, "signal" ) ;
  920. X    
  921. X    /*
  922. X     * Initialize state
  923. X     */
  924. X    INTERCEPT( ip ) = TRUE ;
  925. X    *INT_SERVER( ip ) = *serp ;
  926. X    INT_REMOTE( ip ) = SERVER_FD( serp ) ;
  927. X
  928. X    INT_CONNECTIONS( ip ) = pset_create( 0, 0 ) ;
  929. X    if ( INT_CONNECTIONS( ip ) == NULL )
  930. X    {
  931. X        msg( LOG_ERR, func, ES_NOMEM ) ;
  932. X        (*ip->int_ops->exit)() ;
  933. X    }
  934. X}
  935. X
  936. X
  937. X
  938. X/*
  939. X * Make a new connection to the local server
  940. X */
  941. Xchannel_s *int_newconn( ip, sinp, remote_socket )
  942. X    struct intercept        *ip ;
  943. X    struct sockaddr_in    *sinp ;
  944. X    int                        remote_socket ;
  945. X{
  946. X    struct service            *sp            = SERVER_SERVICE( INT_SERVER( ip ) ) ;
  947. X    int                        socket_type = SVC_SOCKET_TYPE( sp ) ;
  948. X    struct sockaddr_in    *local        = INT_LOCALADDR( ip ) ;
  949. X    char                         *sid            = SVC_ID( sp ) ;
  950. X   channel_s                *chp ;
  951. X   int                        sd ;
  952. X   char                        *func = "int_newconn" ;
  953. X
  954. X   /*
  955. X    * Get a socket and connect it to the local address
  956. X     *
  957. X     * XXX:    should we use SC_PROTOVAL to explicitly specify the protocol ?
  958. X    */
  959. X   if ( ( sd = socket( AF_INET, socket_type, 0 ) ) == -1 )
  960. X   {
  961. X      msg( LOG_ERR, func,"(intercepting %s) socket creation failed: %m", sid ) ;
  962. X      return( CHANNEL_NULL ) ;
  963. X   }
  964. X
  965. X   if ( connect( sd, SA( local ), sizeof( *local ) ) == -1 )
  966. X   {
  967. X      msg( LOG_ERR, func, "(intercepting %s) connect failed: %m", sid ) ;
  968. X      (void) close( sd ) ;
  969. X      return( CHANNEL_NULL ) ;
  970. X   }
  971. X
  972. X    chp = NEW_CHANNEL() ;
  973. X   if ( chp == CHANNEL_NULL )
  974. X   {
  975. X      msg( LOG_ERR, func, ES_NOMEM ) ;
  976. X      (void) close( sd ) ;
  977. X      return( CHANNEL_NULL ) ;
  978. X   }
  979. X
  980. X   if ( pset_add( INT_CONNECTIONS( ip ), chp ) == NULL )
  981. X   {
  982. X      msg( LOG_ERR, func, ES_NOMEM ) ;
  983. X        FREE_CHANNEL( chp ) ;
  984. X      (void) close( sd ) ;
  985. X      return( CHANNEL_NULL ) ;
  986. X   }
  987. X
  988. X    chp->ch_state = GOOD_CHANNEL ;
  989. X    chp->ch_from = *sinp ;
  990. X   chp->ch_local_socket = sd ;
  991. X    chp->ch_remote_socket = remote_socket ;
  992. X   return( chp ) ;
  993. X}
  994. X
  995. X
  996. X
  997. X/*
  998. X * Check if the (address,port) in sinp is already in the connection table.
  999. X * Return value:
  1000. X *    a connection pointer if the address is found
  1001. X *    NULL if the address if not found
  1002. X *
  1003. X * *addr_checked is set to TRUE of FALSE depending on whether there
  1004. X * is already a connection from the same IP address in the table.
  1005. X */
  1006. Xchannel_s *int_lookupconn( ip, sinp, addr_checked )
  1007. X    struct intercept        *ip ;
  1008. X   struct sockaddr_in    *sinp ;
  1009. X   bool_int                    *addr_checked ;
  1010. X{
  1011. X   register unsigned        u ;
  1012. X    register pset_h        conntab = INT_CONNECTIONS( ip ) ;
  1013. X
  1014. X   *addr_checked = FALSE ;
  1015. X
  1016. X   for ( u = 0 ; u < pset_count( conntab ) ; u++ )
  1017. X   {
  1018. X      register channel_s *chp = CHP( pset_pointer( conntab, u ) ) ;
  1019. X
  1020. X      if ( chp->ch_from.sin_addr.s_addr == sinp->sin_addr.s_addr )
  1021. X      {
  1022. X         *addr_checked = TRUE ;
  1023. X         if ( chp->ch_from.sin_port == sinp->sin_port )
  1024. X            return( chp ) ;
  1025. X      }
  1026. X   }
  1027. X   return( CHANNEL_NULL ) ;
  1028. X}
  1029. X
  1030. END_OF_FILE
  1031. if test 5511 -ne `wc -c <'xinetd/intcommon.c'`; then
  1032.     echo shar: \"'xinetd/intcommon.c'\" unpacked with wrong size!
  1033. fi
  1034. # end of 'xinetd/intcommon.c'
  1035. fi
  1036. if test -f 'xinetd/service.h' -a "${1}" != "-c" ; then 
  1037.   echo shar: Will not clobber existing file \"'xinetd/service.h'\"
  1038. else
  1039. echo shar: Extracting \"'xinetd/service.h'\" \(5412 characters\)
  1040. sed "s/^X//" >'xinetd/service.h' <<'END_OF_FILE'
  1041. X/*
  1042. X * (c) Copyright 1992 by Panagiotis Tsirigotis
  1043. X * All rights reserved.  The file named COPYRIGHT specifies the terms 
  1044. X * and conditions for redistribution.
  1045. X */
  1046. X
  1047. X#ifndef SERVICE_H
  1048. X#define SERVICE_H
  1049. X
  1050. X#include <sys/types.h>
  1051. X#include <netinet/in.h>
  1052. X
  1053. X/*
  1054. X * $Id: service.h,v 6.4 1993/06/06 00:12:45 panos Exp $
  1055. X */
  1056. X
  1057. X#include "xlog.h"
  1058. X
  1059. X#include "defs.h"
  1060. X#include "sconf.h"
  1061. X
  1062. X
  1063. X/*
  1064. X * NOTE: A service can be disabled but not deleted if it has any servers
  1065. X *       running
  1066. X */
  1067. Xtypedef enum                     /* service states */
  1068. X   {
  1069. X      SVC_NOT_STARTED = 0,       /* no attempt to start it yet       */
  1070. X      SVC_ACTIVE,                /* service is available             */
  1071. X        SVC_SUSPENDED,                    /* service is suspended                    */
  1072. X      SVC_DISABLED               /* service disabled                 */
  1073. X   } state_e ;
  1074. X
  1075. X
  1076. X/*
  1077. X * NOTE: Clearing the structure will give all its fields their default values
  1078. X */
  1079. Xstruct service
  1080. X{
  1081. X    state_e        svc_state ;
  1082. X
  1083. X    int             svc_ref_count ;            /* number of pointers to this struct */
  1084. X
  1085. X    struct service_config *svc_conf ;    /* service configuration                 */
  1086. X
  1087. X    int            svc_fd ;
  1088. X
  1089. X    unsigned     svc_running_servers ;
  1090. X    unsigned     svc_retry_servers ;
  1091. X
  1092. X    unsigned     svc_attempts ;            /* # of attempts to start a server     */
  1093. X    time_t        svc_start_time ;        /* since this time                            */
  1094. X
  1095. X    /*
  1096. X     *     svc_shutdown:        invoked to playback the protocol and get information
  1097. X     *                                from the other end. It also sets up the connection
  1098. X     *                                for an orderly close.
  1099. X     *        svc_handler:        invoked to handle new requests
  1100. X     */
  1101. X    voidfunc        svc_shutdown_func ;    /* ARGS: int sd, char **msgp           */
  1102. X    statfunc        svc_handler_func ;    /* ARGS: service *, connection *       */
  1103. X
  1104. X    /*
  1105. X     * These fields are used for access control; they either point to the
  1106. X     * service access control lists or to the default access control lists
  1107. X     */
  1108. X    pset_h        svc_no_access ;
  1109. X    pset_h        svc_only_from ;
  1110. X
  1111. X    /*
  1112. X     * These fields are used to avoid generating too many messages when
  1113. X     * receiving datagrams from a bad address.
  1114. X     */
  1115. X    struct sockaddr_in    svc_last_dgram_addr ;
  1116. X    time_t                    svc_last_dgram_time ;
  1117. X
  1118. X    xlog_h        svc_log ;
  1119. X} ;
  1120. X
  1121. X#define SP( p )                        ( (struct service *) (p) )
  1122. X
  1123. X/*
  1124. X * Field access macros
  1125. X */
  1126. X#define SVC_CONF( sp )                ( (sp)->svc_conf )
  1127. X#define SVC_FD( sp )                    ( (sp)->svc_fd )
  1128. X#define SVC_RUNNING_SERVERS( sp )    (sp)->svc_running_servers
  1129. X#define SVC_RETRIES( sp )            (sp)->svc_retry_servers
  1130. X#define SVC_LOG( sp )                (sp)->svc_log
  1131. X#define SVC_REFCOUNT( sp )            (sp)->svc_ref_count
  1132. X#define SVC_ID( sp )                    SC_ID( SVC_CONF( sp ) )
  1133. X#define SVC_SOCKET_TYPE( sp )        SC_SOCKET_TYPE( SVC_CONF( sp ) )
  1134. X
  1135. X#define SVC_IS_ACTIVE( sp )        ( (sp)->svc_state == SVC_ACTIVE )
  1136. X#define SVC_IS_SUSPENDED( sp )    ( (sp)->svc_state == SVC_SUSPENDED )
  1137. X#define SVC_IS_AVAILABLE( sp )    ( SVC_IS_ACTIVE(sp) || SVC_IS_SUSPENDED(sp) )
  1138. X#define SVC_IS_DISABLED( sp )        ( (sp)->svc_state == SVC_DISABLED )
  1139. X
  1140. X/*
  1141. X * Predicate checking macros
  1142. X */
  1143. X#define SVC_LOGUSER( sp )            SC_LOGUSER( SVC_CONF( sp ) )
  1144. X#define SVC_FORKS( sp )                SC_FORKS( SVC_CONF( sp ) )
  1145. X#define SVC_RETRY( sp )                SC_RETRY( SVC_CONF( sp ) )
  1146. X#define SVC_WAITS( sp )                SC_WAITS( SVC_CONF( sp ) )
  1147. X#define SVC_IS_INTERCEPTED( sp )    SC_IS_INTERCEPTED( SVC_CONF( sp ) )
  1148. X#define SVC_ACCEPTS_CONNECTIONS( sp )    \
  1149. X                                            SC_ACCEPTS_CONNECTIONS( SVC_CONF( sp ) )
  1150. X
  1151. X#define SVC_IS_LOGGING( sp )        ( (sp)->svc_log != NULL )
  1152. X#define SVC_LOGS_ON_SUCCESS( sp )            \
  1153. X        ( SVC_IS_LOGGING( sp ) && SC_LOGS_ON_SUCCESS( SVC_CONF( sp ) ) )
  1154. X#define SVC_LOGS_ON_FAILURE( sp )            \
  1155. X        ( SVC_IS_LOGGING( sp ) && SC_LOGS_ON_FAILURE( SVC_CONF( sp ) ) )
  1156. X#define SVC_LOGS_ON_EXIT( sp )                \
  1157. X        ( SVC_IS_LOGGING( sp ) && SC_LOGS_ON_EXIT( SVC_CONF( sp ) ) )
  1158. X#define SVC_LOGS_USERID_ON_SUCCESS( sp )    \
  1159. X        ( SVC_IS_LOGGING( sp ) && SC_LOGS_USERID_ON_SUCCESS( SVC_CONF( sp ) ) )
  1160. X#define SVC_LOGS_USERID_ON_FAILURE( sp )    \
  1161. X        ( SVC_IS_LOGGING( sp ) && SC_LOGS_USERID_ON_FAILURE( SVC_CONF( sp ) ) )
  1162. X#define SVC_RECORDS( sp )                        \
  1163. X        ( SVC_IS_LOGGING( sp ) && SC_RECORDS( SVC_CONF( sp ) ) )
  1164. X
  1165. X/*
  1166. X * Reference counting macros
  1167. X */
  1168. X#define SVC_HOLD( sp )                (sp)->svc_ref_count++
  1169. X#define SVC_RELE( sp )    \
  1170. X    ( ( (sp)->svc_ref_count <= 1 ) ? svc_release( sp ) : --(sp)->svc_ref_count )
  1171. X
  1172. X
  1173. X#define svc_handle( sp, cp )            (*(sp)->svc_handler_func)( sp, cp )
  1174. X#define svc_internal( sp, serp )        sc_internal( SVC_CONF( sp ), serp )
  1175. X#define svc_make_external( sp )        sc_make_external( SVC_CONF( sp ) )
  1176. X
  1177. X#define svc_dec_running_servers( sp )                                                        \
  1178. X    {                                                                                                    \
  1179. X        if ( SVC_RUNNING_SERVERS( sp ) > 0 )                                                \
  1180. X            (sp)->svc_running_servers-- ;                                                        \
  1181. X        else                                                                                            \
  1182. X            msg( LOG_ERR, func,                                                                    \
  1183. X                "Service %s: server exit with 0 running servers", SVC_ID( sp ) ) ;\
  1184. X    }
  1185. X
  1186. X#define svc_inc_running_servers( sp )        (sp)->svc_running_servers++
  1187. X
  1188. X#define svc_inc_retries( sp )                    (sp)->svc_retry_servers++
  1189. X#define svc_dec_retries( sp )                    (sp)->svc_retry_servers--
  1190. X
  1191. Xstatus_e             svc_init() ;
  1192. Xstruct service        *svc_new() ;
  1193. Xstruct service        *svc_make_special() ;
  1194. Xvoid                    svc_free() ;
  1195. Xstatus_e                svc_activate() ;
  1196. Xvoid                    svc_setup_address_control() ;
  1197. Xvoid                    svc_deactivate() ;
  1198. Xvoid                    svc_suspend() ;
  1199. Xvoid                    svc_resume() ;
  1200. Xint                    svc_release() ;
  1201. Xvoid                    svc_dump() ;
  1202. Xvoid                    svc_request() ;
  1203. Xstatus_e                svc_access_control() ;
  1204. Xvoid                    svc_shutdown() ;
  1205. Xvoid                    svc_log_success() ;
  1206. Xvoid                    svc_log_failure() ;
  1207. Xvoid                    svc_log_exit() ;
  1208. Xvoid                    svc_logprint() ;
  1209. Xvoid                    svc_postmortem() ;
  1210. X
  1211. X#endif    /* SERVICE_H */
  1212. END_OF_FILE
  1213. if test 5412 -ne `wc -c <'xinetd/service.h'`; then
  1214.     echo shar: \"'xinetd/service.h'\" unpacked with wrong size!
  1215. fi
  1216. # end of 'xinetd/service.h'
  1217. fi
  1218. echo shar: End of archive 13 \(of 31\).
  1219. cp /dev/null ark13isdone
  1220. MISSING=""
  1221. 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
  1222.     if test ! -f ark${I}isdone ; then
  1223.     MISSING="${MISSING} ${I}"
  1224.     fi
  1225. done
  1226. if test "${MISSING}" = "" ; then
  1227.     echo You have unpacked all 31 archives.
  1228.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1229. else
  1230.     echo You still need to unpack the following archives:
  1231.     echo "        " ${MISSING}
  1232. fi
  1233. ##  End of shell archive.
  1234. exit 0
  1235.