home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-06-26 | 33.8 KB | 1,273 lines |
- Newsgroups: comp.sources.unix
- From: panos@cs.colorado.edu (Panos Tsirigotis)
- Subject: v26i248: xinetd-2.1.1 - inetd replacement with access control and logging, Part04/31
- Sender: unix-sources-moderator@gw.home.vix.com
- Approved: vixie@gw.home.vix.com
-
- Submitted-By: panos@cs.colorado.edu (Panos Tsirigotis)
- Posting-Number: Volume 26, Issue 248
- Archive-Name: xinetd-2.1.1/part04
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 4 (of 31)."
- # Contents: libs/src/misc/ftwx.3 libs/src/misc/misc.3
- # libs/src/pset/pset.c libs/src/sio/suite/Makefile
- # libs/src/str/ss_kmp.c libs/src/str/ss_rk.c
- # libs/src/timer/timemacros.3 xinetd/CHANGELOG xinetd/connection.h
- # xinetd/nvlists.c xinetd/server.h
- # Wrapped by panos@mystique on Mon Jun 21 14:51:21 1993
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'libs/src/misc/ftwx.3' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libs/src/misc/ftwx.3'\"
- else
- echo shar: Extracting \"'libs/src/misc/ftwx.3'\" \(2552 characters\)
- sed "s/^X//" >'libs/src/misc/ftwx.3' <<'END_OF_FILE'
- X.\"(c) Copyright 1992 by Panagiotis Tsirigotis
- X.\"All rights reserved. The file named COPYRIGHT specifies the terms
- X.\"and conditions for redistribution.
- X.\"
- X.\" $Id: ftwx.3,v 2.2 1992/10/31 03:08:39 panos Exp $
- X.TH FTWX 3X "25 January 1992"
- X.SH NAME
- Xftwx -- file tree walk
- X.SH SYNOPSIS
- X.LP
- X.nf
- X.ft B
- X#include "ftwx.h"
- X.LP
- X.ft B
- X.ft B
- X.ft B
- Xint ftwx( path, func, depth, flags )
- Xchar *path ;
- Xint (*func)() ;
- Xint depth ;
- Xint flags ;
- X.SH DESCRIPTION
- X.LP
- X.B ftwx()
- Xis an extension to \fIftw(3)\fR that optionally follows symbolic
- Xlinks (the default is not to follow them). It recursively descends
- Xthe directory tree whose root is \fIpath\fR. For each object it finds
- X(an object is anything that is in the file system name space,
- Xlike a directory, a socket, a regular file, a device etc.)
- Xit invokes \fIfunc()\fR passing
- Xit a pointer to a string containing the object path name (the first
- Xcomponent of the path will be \fIpath\fR), a pointer to a \fIstat()\fR
- Xstructure that contains information about the object, and a flag (of
- Xtype \fIint\fR). The user function is never invoked for the directory
- Xentries "." and "..".
- XPossible flag values are:
- X.TP 10
- X.SB FTW_D
- Xthe object is a directory
- X.TP
- X.SB FTW_DNR
- Xthe object is a directory that is not readable
- X.TP
- X.SB FTW_F
- Xthe object is not a directory
- X.TP
- X.SB FTW_NS
- Xthe \fIstat()\fR of the object failed. The value of the pointer passed
- Xto the user function is undefined. This flag value will be returned
- Xfor directory entries of a directory for which execute access is not
- Xpermitted.
- X.LP
- X\fBftwx\fR visits a directory before visiting any of the files in
- Xthe directory. The tree walk continues until the tree is exhausted,
- Xthe user function returns a negative value or some error occurs
- X(since -1 indicates an error in \fBftwx()\fR, the user function
- Xshould not return that value).
- XIf the user function returns a positive value for a directory, that
- Xdirectory is not traversed.
- XSymbolic links are followed if the \fIflag\fR is \fBFTWX_FOLLOW\fR.
- X.LP
- XThe \fBdepth\fR argument determines how deep in the tree to go. The
- Xoriginal \fIpath\fR is at depth 0. If \fIdepth\fR is \fBFTWX_ALL\fR,
- Xthere is no depth limit. However since \fBftwx()\fR uses a file
- Xdescriptor for each level of the tree, there is a limit to
- Xthe tree depth that it can process that depends on the number
- Xof available file descriptors.
- X.SH "RETURN VALUES"
- X.LP
- X\fBftwx()\fR
- Xreturns 0 if is successful, -1 if an error occurs (\fIerrno\fR is set)
- Xand the (negative) value returned by the user function if that occurs.
- X.SH "SEE ALSO"
- X.LP
- Xftw(3)
- END_OF_FILE
- if test 2552 -ne `wc -c <'libs/src/misc/ftwx.3'`; then
- echo shar: \"'libs/src/misc/ftwx.3'\" unpacked with wrong size!
- fi
- # end of 'libs/src/misc/ftwx.3'
- fi
- if test -f 'libs/src/misc/misc.3' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libs/src/misc/misc.3'\"
- else
- echo shar: Extracting \"'libs/src/misc/misc.3'\" \(2525 characters\)
- sed "s/^X//" >'libs/src/misc/misc.3' <<'END_OF_FILE'
- X.\"(c) Copyright 1992 by Panagiotis Tsirigotis
- X.\"All rights reserved. The file named COPYRIGHT specifies the terms
- X.\"and conditions for redistribution.
- X.\"
- X.\" $Id: misc.3,v 2.2 1992/10/31 03:08:54 panos Exp $
- X.TH MISC 3X "25 January 1992"
- X.SH NAME
- Xmake_string, make_pathname, argv_copy_and_clear, basename, dirname - miscellaneous functions
- X.SH SYNOPSIS
- X.LP
- X.nf
- X.ft B
- X#include "misc.h"
- X.LP
- X.ft B
- Xchar *make_string( count, ... )
- Xunsigned count ;
- X.LP
- X.ft B
- Xchar *make_pathname( count, ... )
- Xunsigned count ;
- X.LP
- X.ft B
- Xchar **argv_copy_and_clear( argv, start, count )
- Xchar **argv ;
- Xint start, count ;
- X.LP
- X.ft B
- Xchar *dirname( path )
- Xchar *path ;
- X.LP
- X.ft B
- Xchar *basename( path )
- Xchar *path ;
- X.SH DESCRIPTION
- X.LP
- XThis library contain miscellaneous functions, hence the name.
- X.LP
- X.B make_string()
- Xcreates a string by catenating the list of strings passed as arguments.
- X\fIcount\fR indicates how many strings there are.
- XStrings that are
- X.SM NULL
- Xpointers are ignored.
- X\fBmake_string()\fR returns malloc'ed memory.
- X.LP
- X.B make_pathname()
- Xcreates a pathname by catenating the list of pathname components passed
- Xas arguments and inserting slashes between them.
- X\fIcount\fR indicates how many components there are.
- X\fBmake_pathname()\fR returns malloc'ed memory.
- X.LP
- X.B argv_copy_and_clear()
- Xcreates a new argv array of size \fIcount\fR, and fills it with the
- Xcontents of \fIargv\fR from \fIstart\fR up to \fIstart+count-1\fR.
- XThe original \fIargv\fR entries in that range are cleared by filling
- Xthem with
- X.SM SPACEs.
- X.LP
- X.B dirname()
- Xreturns in a malloced string containing all but the last of
- Xcomponent of \fIpath\fR. There are 2 special cases:
- Xfirst when the
- X\fIpath\fR is "/", \fBdirname()\fR will return "/",
- Xand second, when the \fIpath\fR does not contain any '/',
- X\fBdirname()\fR will return ".".
- X.LP
- X.B basename()
- Xreturns a pointer to the last component of \fIpath\fR.
- X.SH "RETURN VALUES"
- X.LP
- X\fBmake_string()\fR returns a pointer to the new string.
- XIt returns
- X.SM NULL
- Xif \fIcount\fR is 0.
- X.LP
- X\fBmake_pathname()\fR returns a pointer to the new pathname.
- XIt returns
- X.SM NULL
- Xif \fIcount\fR is 0.
- X.LP
- X\fBargv_copy_and_clear()\fR returns the new argv array. It returns
- X.SM NULL
- Xif \fImalloc\fR fails to allocate more memory.
- X.LP
- X\fBdirname()\fR returns a new string or
- X.SM NULL
- Xif \fImalloc\fR fails to allocate more memory.
- X.LP
- X\fBbasename()\fR returns a pointer to the last component of \fIpath\fR.
- X.SH BUGS
- X.LP
- XThe behavior of \fBdirname()\fR and \fBbasename()\fR is undefined if
- Xthey are given a zero-length string.
- END_OF_FILE
- if test 2525 -ne `wc -c <'libs/src/misc/misc.3'`; then
- echo shar: \"'libs/src/misc/misc.3'\" unpacked with wrong size!
- fi
- # end of 'libs/src/misc/misc.3'
- fi
- if test -f 'libs/src/pset/pset.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libs/src/pset/pset.c'\"
- else
- echo shar: Extracting \"'libs/src/pset/pset.c'\" \(2244 characters\)
- sed "s/^X//" >'libs/src/pset/pset.c' <<'END_OF_FILE'
- X/*
- X * (c) Copyright 1992, 1993 by Panagiotis Tsirigotis
- X * All rights reserved. The file named COPYRIGHT specifies the terms
- X * and conditions for redistribution.
- X */
- X
- Xstatic char RCSid[] = "$Id: pset.c,v 3.1 1993/03/06 18:48:57 panos Exp $" ;
- Xstatic char version[] = VERSION ;
- X
- X#include "pset.h"
- X
- X#ifndef NULL
- X#define NULL 0
- X#endif
- X
- X#define ALLOC_START 20
- X#define ALLOC_STEP 10
- X
- X#define POINTER __pset_pointer
- X
- Xchar *malloc(), *realloc() ;
- X
- X
- X/*
- X * Create a pointer set and return a handle to it.
- X * Some space is initially allocated for the set.
- X */
- Xpset_h pset_create( alloc_start, alloc_step )
- X unsigned alloc_start, alloc_step ;
- X{
- X pset_h pset ;
- X unsigned start ;
- X
- X pset = (pset_h) malloc( sizeof( struct __pset ) ) ;
- X if ( pset == NULL )
- X return( NULL ) ;
- X
- X start = ( alloc_start == 0 ) ? ALLOC_START : alloc_start ;
- X pset->ptrs = (POINTER *) malloc( start * sizeof( POINTER ) ) ;
- X if ( pset->ptrs == NULL )
- X {
- X free( (char *) pset ) ;
- X return( NULL ) ;
- X }
- X
- X pset->max = start ;
- X pset->count = 0 ;
- X pset->alloc_step = ( alloc_step == 0 ) ? ALLOC_STEP : alloc_step ;
- X return( pset ) ;
- X}
- X
- X
- X/*
- X * Destroy a pset
- X */
- Xvoid pset_destroy( pset )
- X pset_h pset ;
- X{
- X free( (char *) pset->ptrs ) ;
- X free( (char *) pset ) ;
- X}
- X
- X
- X/*
- X * Insert a pointer to a pset
- X */
- XPOINTER pset_insert( pset, p )
- X pset_h pset ;
- X POINTER p ;
- X{
- X if ( pset->count >= pset->max )
- X {
- X unsigned new_max = pset->max + pset->alloc_step ;
- X POINTER *new_ptrs ;
- X
- X new_ptrs = (POINTER *) realloc(
- X (char *)pset->ptrs, new_max * sizeof( POINTER ) ) ;
- X if ( new_ptrs == NULL )
- X return( NULL ) ;
- X pset->max = new_max ;
- X pset->ptrs = new_ptrs ;
- X }
- X return( pset->ptrs[ pset->count++ ] = p ) ;
- X}
- X
- X
- X/*
- X * Remove a pointer from a pset
- X */
- Xvoid pset_delete( pset, ptr )
- X register pset_h pset ;
- X register POINTER ptr ;
- X{
- X register unsigned u = pset->count ;
- X
- X if ( u == 0 )
- X return ;
- X
- X do
- X {
- X u-- ;
- X if ( pset->ptrs[ u ] == ptr )
- X {
- X pset->ptrs[ u ] = pset->ptrs[ --pset->count ] ;
- X return ;
- X }
- X }
- X while ( u ) ;
- X}
- X
- X
- X/*
- X * Create a pset iterator
- X */
- Xpsi_h psi_create( pset )
- X pset_h pset ;
- X{
- X psi_h iter = (psi_h) malloc( sizeof( struct __pset_iterator ) ) ;
- X
- X if ( iter == NULL )
- X return( NULL ) ;
- X iter->pset = pset ;
- X return( iter ) ;
- X}
- X
- X
- END_OF_FILE
- if test 2244 -ne `wc -c <'libs/src/pset/pset.c'`; then
- echo shar: \"'libs/src/pset/pset.c'\" unpacked with wrong size!
- fi
- # end of 'libs/src/pset/pset.c'
- fi
- if test -f 'libs/src/sio/suite/Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libs/src/sio/suite/Makefile'\"
- else
- echo shar: Extracting \"'libs/src/sio/suite/Makefile'\" \(2542 characters\)
- sed "s/^X//" >'libs/src/sio/suite/Makefile' <<'END_OF_FILE'
- X# (c) Copyright 1992, 1993 by Panagiotis Tsirigotis
- X# All rights reserved. The file named COPYRIGHT specifies the terms
- X# and conditions for redistribution.
- X
- X#
- X# $Id: Makefile,v 8.1 1993/03/13 01:27:40 panos Exp $
- X#
- X
- XCC = cc -I..
- X
- X#
- X# NOTE: When using the test scripts, CLFAGS is provided as an
- X# argument to make, the setting of it here has no effect.
- X#
- XCFLAGS = -g
- XLIBOBJS = ../libsio.a
- X
- XDISTRIBUTION_FILES=copytest.c example.c print.c tietest.c buftest.c fdtest.c tester sprint_test testlib README
- X
- XALL=Sread Swrite Sputchar Sgetchar Srdline \
- X Sgetc Sputc Sfetch Sflush Sundo switch \
- X Sprint buftest tietest switch2 example fdtest evtest
- X
- Xevtest: evtest.c $(LIBOBJS)
- X $(CC) $(CFLAGS) -o $@ evtest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
- X
- Xfdtest: fdtest.c $(LIBOBJS)
- X $(CC) $(CFLAGS) -o $@ fdtest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
- X
- Xbuftest: buftest.c $(LIBOBJS)
- X $(CC) $(CFLAGS) -o $@ buftest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
- X
- XSprint: print.c $(LIBOBJS)
- X $(CC) $(CFLAGS) -o $@ print.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
- X
- XSputchar: copytest.c $(LIBOBJS)
- X $(CC) $(CFLAGS) -o $@ copytest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
- X
- XSgetchar: copytest.c $(LIBOBJS)
- X $(CC) $(CFLAGS) -o $@ copytest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
- X
- XSrdline: copytest.c $(LIBOBJS)
- X $(CC) $(CFLAGS) -o $@ copytest.c $(LIBOBJS) || rm -f $@
- X
- XSread: copytest.c $(LIBOBJS)
- X $(CC) $(CFLAGS) -o $@ copytest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
- X
- XSwrite: copytest.c $(LIBOBJS)
- X $(CC) $(CFLAGS) -o $@ copytest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
- X
- XSgetc: copytest.c $(LIBOBJS)
- X $(CC) $(CFLAGS) -o $@ copytest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
- X
- XSputc: copytest.c $(LIBOBJS)
- X $(CC) $(CFLAGS) -o $@ copytest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
- X
- XSfetch: copytest.c $(LIBOBJS)
- X $(CC) $(CFLAGS) -o $@ copytest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
- X
- XSflush: copytest.c $(LIBOBJS)
- X $(CC) $(CFLAGS) -o $@ copytest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
- X
- XSundo: copytest.c $(LIBOBJS)
- X $(CC) $(CFLAGS) -o $@ copytest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
- X
- Xswitch: copytest.c $(LIBOBJS)
- X $(CC) $(CFLAGS) -o $@ copytest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
- X
- Xswitch2: copytest.c $(LIBOBJS)
- X $(CC) $(CFLAGS) -o $@ copytest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
- X
- Xtietest: tietest.c $(LIBOBJS)
- X $(CC) $(CFLAGS) -o $@ tietest.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
- X
- Xexample: example.c $(LIBOBJS)
- X $(CC) $(CFLAGS) -o $@ example.c $(LIBOBJS) $(LDFLAGS) || rm -f $@
- X
- Xclean:
- X rm -f $(ALL) core
- X
- Xcheckout: $(DISTRIBUTION_FILES)
- X
- X$(DISTRIBUTION_FILES):
- X co $@
- X
- Xdist:
- X -co -q $(DISTRIBUTION_FILES)
- END_OF_FILE
- if test 2542 -ne `wc -c <'libs/src/sio/suite/Makefile'`; then
- echo shar: \"'libs/src/sio/suite/Makefile'\" unpacked with wrong size!
- fi
- # end of 'libs/src/sio/suite/Makefile'
- fi
- if test -f 'libs/src/str/ss_kmp.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libs/src/str/ss_kmp.c'\"
- else
- echo shar: Extracting \"'libs/src/str/ss_kmp.c'\" \(2827 characters\)
- sed "s/^X//" >'libs/src/str/ss_kmp.c' <<'END_OF_FILE'
- X/*
- X * (c) Copyright 1992, 1993 by Panagiotis Tsirigotis
- X * All rights reserved. The file named COPYRIGHT specifies the terms
- X * and conditions for redistribution.
- X */
- X
- Xstatic char RCSid[] = "$Id: ss_kmp.c,v 3.1 1993/06/13 02:44:39 panos Exp $" ;
- X
- Xchar *malloc() ;
- X
- X#include "ss_impl.h"
- X
- XPRIVATE int kmp_setup() ;
- XPRIVATE char *kmp_match() ;
- XPRIVATE void kmp_done() ;
- X
- Xstruct ss_ops __strs_kmpops = { kmp_setup, kmp_match, kmp_done } ;
- X
- X
- XPRIVATE void compute_next( hp )
- X header_s *hp ;
- X{
- X char *pattern = SS_PATTERN( hp ) ;
- X int patlen = SS_PATLEN( hp ) ;
- X next_int *next = KMP_HEADER( hp )->next ;
- X int q ;
- X next_int k ;
- X
- X k = next[ 0 ] = -1 ;
- X
- X for ( q = 0 ; q < patlen-1 ; )
- X {
- X /*
- X * The invariant of the following loop is:
- X * if k>=0, then
- X * pattern[ 0..k-1 ] SUFFIX pattern[ 0..q-1 ] ( <==> next[ q ] = k )
- X * This condition is true on entry to the loop.
- X */
- X while ( k >= 0 && pattern[ k ] != pattern[ q ] )
- X k = next[ k ] ;
- X
- X /*
- X * Case 1: k == -1
- X * Setting next[ q+1 ] = 0 is ok since it implies that the next
- X * position in the pattern to check is position 0 (i.e. start
- X * from the beginning).
- X * Case 2: k >= 0.
- X * Since we exited the loop, pattern[ k ] == pattern[ q ].
- X * Therefore,
- X * pattern[ 0..k ] SUFFIX pattern[ 0..q ] ==> next[ q+1 ] = k+1
- X */
- X k++, q++ ;
- X#ifdef PATH_COMPRESSION
- X if ( pattern[ k ] == pattern[ q ] )
- X next[ q ] = next[ k ] ;
- X#endif
- X next[ q ] = k ;
- X }
- X}
- X
- X
- XPRIVATE int kmp_setup( hp )
- X register header_s *hp ;
- X{
- X register next_int *next ;
- X
- X next = (next_int *) malloc( (unsigned)SS_PATLEN( hp )*sizeof( next_int ) ) ;
- X if ( next == (next_int *)0 )
- X return( SS_ERR ) ;
- X
- X KMP_HEADER( hp )->next = next ;
- X
- X compute_next( hp ) ;
- X
- X return( SS_OK ) ;
- X}
- X
- X
- XPRIVATE char *kmp_match( hp, str, len )
- X header_s *hp ;
- X char *str ;
- X int len ;
- X{
- X register int i ;
- X register next_int q ;
- X next_int *next = KMP_HEADER( hp )->next ;
- X char *pattern = SS_PATTERN( hp ) ;
- X register int patlen = SS_PATLEN( hp ) ;
- X
- X /*
- X * As a special case, we consider pattern[ -1..0 ] to be the empty string.
- X */
- X for ( q = 0, i = 0 ; i < len ; i++ )
- X {
- X register char current_char = SS_MAP( hp, str[ i ] ) ;
- X
- Xagain:
- X /*
- X * At this point:
- X * pattern[ 0..q-1 ] is a suffix of str[ 0..i-1 ]
- X */
- X if ( pattern[ q ] == current_char )
- X {
- X q++ ;
- X if ( q == patlen )
- X return( &str[ i - patlen + 1 ] ) ;
- X }
- X else
- X {
- X /*
- X * Let q' = next[ q ]. If q' >= 0, then
- X * pattern[ 0..q'-1 ] SUFFIX pattern[ 0..q-1 ]
- X * which implies that
- X * pattern[ 0..q'-1 ] SUFFIX str[ 0..i-1 ]
- X * Therefore, it is ok to set q = q'.
- X */
- X q = next[ q ] ;
- X if ( q >= 0 )
- X goto again ;
- X q++ ;
- X }
- X }
- X
- X return( CHAR_NULL ) ;
- X}
- X
- X
- XPRIVATE void kmp_done( hp )
- X header_s *hp ;
- X{
- X (void) free( (char *)KMP_HEADER( hp )->next ) ;
- X}
- X
- END_OF_FILE
- if test 2827 -ne `wc -c <'libs/src/str/ss_kmp.c'`; then
- echo shar: \"'libs/src/str/ss_kmp.c'\" unpacked with wrong size!
- fi
- # end of 'libs/src/str/ss_kmp.c'
- fi
- if test -f 'libs/src/str/ss_rk.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libs/src/str/ss_rk.c'\"
- else
- echo shar: Extracting \"'libs/src/str/ss_rk.c'\" \(2625 characters\)
- sed "s/^X//" >'libs/src/str/ss_rk.c' <<'END_OF_FILE'
- X/*
- X * (c) Copyright 1992, 1993 by Panagiotis Tsirigotis
- X * All rights reserved. The file named COPYRIGHT specifies the terms
- X * and conditions for redistribution.
- X */
- X
- Xstatic char RCSid[] = "$Id: ss_rk.c,v 3.1 1993/06/13 02:45:04 panos Exp $" ;
- X
- X#include "ss_impl.h"
- X
- X/*
- X * Multiply a number by the radix we are using
- X */
- X#define RADIX_MULT( n ) ( (n) << NBIC )
- X
- X#define UCHAR( c ) ((unsigned char)(c))
- X
- X
- XPRIVATE int rk_setup() ;
- XPRIVATE char *rk_match() ;
- XPRIVATE void rk_done() ;
- X
- Xstruct ss_ops __strs_rkops = { rk_setup, rk_match, rk_done } ;
- X
- X
- XPRIVATE int rk_setup( hp )
- X register header_s *hp ;
- X{
- X register int i ;
- X struct rk_header *rkp = RK_HEADER( hp ) ;
- X u_wide_int patval = 0 ;
- X u_wide_int digit_1 = 1 ;
- X
- X /*
- X * Compute pattern value
- X */
- X for ( i = 0 ; i < SS_PATLEN( hp ) ; i++ )
- X patval = ( RADIX_MULT( patval ) + UCHAR( SS_PATTERN( hp )[i] ) ) % PRIME ;
- X
- X for ( i = 0 ; i < SS_PATLEN( hp )-1 ; i++ )
- X digit_1 = RADIX_MULT( digit_1 ) % PRIME ;
- X
- X rkp->rk_patval = patval ;
- X rkp->rk_digit1 = digit_1 ;
- X return( SS_OK ) ;
- X}
- X
- X
- XPRIVATE void rk_done( hp )
- X header_s *hp ;
- X{
- X#ifdef lint
- X hp = hp ;
- X#endif
- X}
- X
- X
- XPRIVATE char *rk_match( hp, str, len )
- X register header_s *hp ;
- X char *str ;
- X int len ;
- X{
- X register int i ;
- X register unsigned char uc ;
- X register u_wide_int strval = 0 ;
- X register u_wide_int patval = RK_HEADER( hp )->rk_patval ;
- X register u_wide_int digit_1 = RK_HEADER( hp )->rk_digit1 ;
- X int patlen = SS_PATLEN( hp ) ;
- X char *endpat = &SS_PATTERN( hp )[ patlen ] ;
- X
- X /*
- X * Calculate initial value of 'str'
- X * Note that we are guaranteed that len >= pattern length
- X */
- X for ( i = 0 ; i < patlen ; i++ )
- X {
- X uc = UCHAR( SS_MAP( hp, str[i] ) ) ;
- X strval = ( RADIX_MULT( strval ) + uc ) % PRIME ;
- X }
- X
- X for ( i = 0 ;; i++ )
- X {
- X register u_wide_int t1 ;
- X
- X if ( strval == patval )
- X {
- X char *pp, *sp ;
- X
- X for ( pp = SS_PATTERN( hp ), sp = &str[i] ;; sp++, pp++ )
- X {
- X if ( pp == endpat )
- X return( &str[i] ) ;
- X if ( *pp != SS_MAP( hp, *sp ) )
- X break ;
- X }
- X }
- X
- X if ( i == len-patlen+1 )
- X break ;
- X
- X /*
- X * The formula we evaluate is:
- X *
- X * strval = ( RADIX_MULT( ( strval - UCHAR( str[i] )*digit_1 ) ) +
- X * UCHAR( str[i+patlen] ) ) % PRIME ;
- X *
- X * We have to make sure that the subtraction does not produce
- X * a negative number since that causes strval to be wrong.
- X */
- X uc = UCHAR( SS_MAP( hp, str[i] ) ) ;
- X t1 = ( uc * digit_1 ) % PRIME ;
- X if ( t1 > strval )
- X strval += PRIME ;
- X uc = UCHAR( SS_MAP( hp, str[i+patlen] ) ) ;
- X strval = ( RADIX_MULT( strval - t1 ) + uc ) % PRIME ;
- X }
- X return( NULL ) ;
- X}
- X
- X
- END_OF_FILE
- if test 2625 -ne `wc -c <'libs/src/str/ss_rk.c'`; then
- echo shar: \"'libs/src/str/ss_rk.c'\" unpacked with wrong size!
- fi
- # end of 'libs/src/str/ss_rk.c'
- fi
- if test -f 'libs/src/timer/timemacros.3' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libs/src/timer/timemacros.3'\"
- else
- echo shar: Extracting \"'libs/src/timer/timemacros.3'\" \(2100 characters\)
- sed "s/^X//" >'libs/src/timer/timemacros.3' <<'END_OF_FILE'
- X.\"(c) Copyright 1993 by Panagiotis Tsirigotis
- X.\"All rights reserved. The file named COPYRIGHT specifies the terms
- X.\"and conditions for redistribution.
- X.\"
- X.\" $Id: timemacros.3,v 4.1 1993/04/20 22:52:53 panos Exp $
- X.TH TIMEMACROS 3X "20 April 1993"
- X.SH NAME
- 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
- X.SH SYNOPSIS
- X.LP
- X.nf
- X.ft B
- X#include "timemacros.h"
- X.LP
- X.ft B
- Xvoid TV_ADD( tv_res, tv1, tv2 )
- Xstruct timeval tv_res, tv1, tv2 ;
- X.LP
- X.ft B
- Xvoid TV_SUB( tv_res, tv1, tv2 )
- Xstruct timeval tv_res, tv1, tv2 ;
- X.LP
- X.ft B
- Xvoid TV_ZERO( tv )
- Xstruct timeval tv ;
- X.LP
- X.ft B
- Xint TV_LT( tv1, tv2 )
- Xstruct timeval tv1, tv2 ;
- X.LP
- X.ft B
- Xint TV_LE( tv1, tv2 )
- Xstruct timeval tv1, tv2 ;
- X.LP
- X.ft B
- Xint TV_GT( tv1, tv2 )
- Xstruct timeval tv1, tv2 ;
- X.LP
- X.ft B
- Xint TV_GE( tv1, tv2 )
- Xstruct timeval tv1, tv2 ;
- X.LP
- X.ft B
- Xint TV_EQ( tv1, tv2 )
- Xstruct timeval tv1, tv2 ;
- X.LP
- X.ft B
- Xint TV_NE( tv1, tv2 )
- Xstruct timeval tv1, tv2 ;
- X.LP
- X.ft B
- Xint TV_ISZERO( tv )
- Xstruct timeval tv ;
- X.SH DESCRIPTION
- XThere are 2 groups of macros: the
- X.I "TV_*"
- Xmacros expect arguments that are
- X.I "struct timeval's"
- Xwhile the
- X.I "TVP_*"
- Xmacros expect arguments that are pointers to
- X.I "struct timeval."
- XIn the following only the
- X.I "TV_*"
- Xmacros will be described.
- X.LP
- X.B "TV_ADD()"
- Xadds
- X.I tv1
- Xand
- X.I tv2
- Xand puts the result in
- X.I tv_res.
- XThe result is "normalized" if the number of microseconds in
- X.I tv_res
- Xexceeds 1 million.
- X.LP
- X.B "TV_SUB()"
- Xperforms the subtraction
- X.I "tv1-tv2"
- Xand places the result in
- X.I tv_res.
- XThe result is "normalized" if the number of microseconds in
- X.I tv_res
- Xbecomes negative.
- X.LP
- X.B "TV_ZERO()"
- Xsets
- X.I tv
- Xto zero seconds and zero microseconds.
- X.LP
- X.B "TV_LT(),"
- X.B "TV_LE(),"
- X.B "TV_GT(),"
- X.B "TV_GE(),"
- X.B "TV_EQ(),"
- Xand
- X.B "TV_NE()"
- Xreturn
- X.SM TRUE
- Xif
- X.I tv1
- Xis
- Xless than,
- Xless than or equal,
- Xgreater than,
- Xgreater than or equal,
- Xequal,
- Xor
- Xnot equal
- Xto
- X.I tv2,
- Xrespectively.
- X.LP
- X.B "TV_ISZERO()"
- Xreturns
- X.SM TRUE
- Xif
- X.I tv
- Xis equal to zero.
- END_OF_FILE
- if test 2100 -ne `wc -c <'libs/src/timer/timemacros.3'`; then
- echo shar: \"'libs/src/timer/timemacros.3'\" unpacked with wrong size!
- fi
- # end of 'libs/src/timer/timemacros.3'
- fi
- if test -f 'xinetd/CHANGELOG' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'xinetd/CHANGELOG'\"
- else
- echo shar: Extracting \"'xinetd/CHANGELOG'\" \(2579 characters\)
- sed "s/^X//" >'xinetd/CHANGELOG' <<'END_OF_FILE'
- X
- XThis file describes the changes to xinetd. The base version is 2.0.0.
- X
- X2.0.0: (not released)
- X
- X2.0.1: (not released)
- X
- X2.0.2:
- X Changes to the Makefile.
- X Trivial mods to the usage() function
- X
- X2.0.3:
- X Changes to the Makefile.
- X Fixed a bug in the usage() function
- X
- X2.0.4:
- X Distribution versions of the Makefile no longer contain any
- X references to options.opt
- X
- X2.0.5:
- X 1) Clarified what an "unlisted RPC service" is in the man page
- X 2) Fixed a bug in remote_address_check which caused access to be denied
- X for all hosts if no_access was set and only_from was not set.
- X 3) Fixed a bug which caused arbitrary syslog levels if the log_type
- X was specified as SYSLOG in the "defaults" entry
- X
- X2.0.6:
- X bug fix in child.c: replaced strx_sprint with strx_print when naming
- X interceptor processes
- X
- X
- X-------------------------------------------------------------------------------
- X
- X2.1.0: (not released)
- X This was mostly a clean-up of 2.0
- X List of changes:
- X
- X A. The man page has been split into 3 parts:
- X xinetd.man : man page describing the program
- X xinetd.conf.man : man page describing the configuration file
- X This file now includes figures about the
- X overhead of interception.
- X xinetd.log.man : man page describing the log file
- X B. New service attributes
- X rpc_number : to support unlisted RPC services
- X nice : to set the nice value of forked servers
- X C. The IDONLY service flag was added
- X D. Now uses the timer library unless NO_TIMERS is defined. If NO_TIMERS
- X is not defined, the following are also available:
- X a) a new option, -cc, to do periodic consistency checks
- X b) timeout for reconfiguration
- X E. Configuration file man page now mentions that access control is
- X based on IP-address instead of domain address.
- X F. The interception code now sets the TCP_NODELAY option.
- X G. The timeout when contacting a remote identification server is
- X configurable both when the service request has been accepted and
- X when the request is rejected. In the former case it defaults to
- X infinity while in the latter it defaults to 30 sec.
- X H. The log line ids are now constants in an include file.
- X I. The fsma library is no longer used.
- X J. Most structure fields were renamed; certain functions were renamed too.
- X Access to structure fields is now via macros.
- X K. A bug in not restoring the number of descriptors to the soft limit
- X was fixed.
- X L. The -pid option works
- X M. New internal services:
- X "servers" : lists active servers
- X "services" : lists active services
- X
- X2.1.1:
- X xinetd produces more meaningful messages if it can't start logging
- X
- END_OF_FILE
- if test 2579 -ne `wc -c <'xinetd/CHANGELOG'`; then
- echo shar: \"'xinetd/CHANGELOG'\" unpacked with wrong size!
- fi
- # end of 'xinetd/CHANGELOG'
- fi
- if test -f 'xinetd/connection.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'xinetd/connection.h'\"
- else
- echo shar: Extracting \"'xinetd/connection.h'\" \(2232 characters\)
- sed "s/^X//" >'xinetd/connection.h' <<'END_OF_FILE'
- X/*
- X * (c) Copyright 1992 by Panagiotis Tsirigotis
- X * All rights reserved. The file named COPYRIGHT specifies the terms
- X * and conditions for redistribution.
- X */
- X
- X#ifndef CONNECTION_H
- X#define CONNECTION_H
- X
- X/*
- X * $Id: connection.h,v 6.3 1993/06/01 22:53:50 panos Exp $
- X */
- X
- X#include <sys/types.h>
- X#include <netinet/in.h>
- X
- X#include "mask.h"
- X#include "service.h"
- X
- X#define MAX_ALTERNATIVES 3
- X
- Xtypedef enum { CONN_CLOSED = 0, CONN_OPEN } conn_state_e ;
- X
- X#define COF_HAVE_ADDRESS 1
- X#define COF_SHUTDOWN 2
- X#define COF_CLEANUP 3
- X#define COF_NEW_DESCRIPTOR 4
- X
- Xstruct connection
- X{
- X conn_state_e co_state ;
- X struct service *co_sp ;
- X int co_descriptor ;
- X mask_t co_flags ;
- X struct sockaddr_in co_remote_address ;
- X unsigned co_alternative_count ;
- X unsigned co_next_alternative ;
- X struct service *co_alternatives[ MAX_ALTERNATIVES ] ;
- X} ;
- X
- Xtypedef struct connection connection_s ;
- X
- X#define COP( p ) ((connection_s *)(p))
- X
- X#define CONN_NULL COP( NULL )
- X
- X/*
- X * Field access macros
- X */
- X#define CONN_DESCRIPTOR( cp ) (cp)->co_descriptor
- X#define CONN_SERVICE( cp ) (cp)->co_sp
- X
- X#define conn_set_flag( cp, flag ) M_SET( (cp)->co_flags, flag )
- X
- X#define conn_shutdown( cp ) conn_set_flag( cp, COF_SHUTDOWN )
- X#define conn_cleanup( cp ) conn_set_flag( cp, COF_CLEANUP )
- X
- X#define conn_setaddr( cp, sinp ) \
- X { \
- X conn_set_flag( cp, COF_HAVE_ADDRESS ) ; \
- X (cp)->co_remote_address = *(sinp) ; \
- X }
- X#define conn_set_descriptor( cp, fd ) (cp)->co_descriptor = (fd)
- X
- X#define conn_address( cp ) \
- X ( \
- X M_IS_SET( (cp)->co_flags, COF_HAVE_ADDRESS ) \
- X ? &(cp)->co_remote_address \
- X : SOCKADDRIN_NULL \
- X )
- X
- Xchar *inet_ntoa() ;
- X
- X#define conn_addrstr( cp ) \
- X M_IS_SET( (cp)->co_flags, COF_HAVE_ADDRESS ) \
- X ? inet_ntoa( (cp)->co_remote_address.sin_addr ) \
- X : "<no address>"
- X
- Xstatus_e conn_init() ;
- Xconnection_s *conn_new() ;
- Xvoid conn_close() ;
- Xvoid conn_free() ;
- Xstatus_e conn_add_alternative() ;
- Xstatus_e conn_start_alternative() ;
- Xvoid conn_dump() ;
- X
- X#endif /* CONNECTION_H */
- X
- END_OF_FILE
- if test 2232 -ne `wc -c <'xinetd/connection.h'`; then
- echo shar: \"'xinetd/connection.h'\" unpacked with wrong size!
- fi
- # end of 'xinetd/connection.h'
- fi
- if test -f 'xinetd/nvlists.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'xinetd/nvlists.c'\"
- else
- echo shar: Extracting \"'xinetd/nvlists.c'\" \(2285 characters\)
- sed "s/^X//" >'xinetd/nvlists.c' <<'END_OF_FILE'
- X/*
- X * (c) Copyright 1992 by Panagiotis Tsirigotis
- X * All rights reserved. The file named COPYRIGHT specifies the terms
- X * and conditions for redistribution.
- X */
- X
- Xstatic char RCSid[] = "$Id: nvlists.c,v 6.3 1993/06/13 01:43:55 panos Exp $" ;
- X
- X#include <sys/types.h>
- X#include <sys/socket.h>
- X#include <syslog.h>
- X
- X#include "defs.h"
- X#include "sconf.h"
- X
- X/*
- X * A NULL value for the name field marks the end of the table
- X */
- X
- Xstruct name_value service_types[] =
- X {
- X#ifndef NO_RPC
- X { "RPC", ST_RPC },
- X#endif
- X { "INTERNAL", ST_INTERNAL },
- X { "UNLISTED", ST_UNLISTED },
- X { "SPECIAL", ST_SPECIAL },
- X { CHAR_NULL, 0 }
- X } ;
- X
- X
- Xstruct name_value service_flags[] =
- X {
- X { "REUSE", SF_REUSE },
- X { "INTERCEPT", SF_INTERCEPT },
- X { "NORETRY", SF_NORETRY },
- X { "IDONLY", SF_IDONLY },
- X { CHAR_NULL, 0 }
- X } ;
- X
- X
- Xstruct name_value socket_types[] =
- X {
- X { "stream", SOCK_STREAM },
- X { "dgram", SOCK_DGRAM },
- X { "raw", SOCK_RAW },
- X { "seqpacket", SOCK_SEQPACKET },
- X { CHAR_NULL, 1 },
- X { "BAD SOCKET TYPE", 0 }
- X } ;
- X
- X
- Xstruct name_value success_log_options[] =
- X {
- X { "HOST", LO_HOST },
- X { "DURATION", LO_DURATION },
- X { "EXIT", LO_EXIT },
- X { "PID", LO_PID },
- X { "USERID", LO_USERID },
- X { CHAR_NULL, 0 }
- X } ;
- X
- X
- Xstruct name_value failure_log_options[] =
- X {
- X { "HOST", LO_HOST },
- X { "ATTEMPT", LO_ATTEMPT },
- X { "RECORD", LO_RECORD },
- X { "USERID", LO_USERID },
- X { CHAR_NULL, 0 }
- X } ;
- X
- X
- X
- Xstruct name_value syslog_facilities[] =
- X {
- X { "daemon", LOG_DAEMON },
- X { "auth", LOG_AUTH },
- X { "user", LOG_USER },
- X { "local0", LOG_LOCAL0 },
- X { "local1", LOG_LOCAL1 },
- X { "local2", LOG_LOCAL2 },
- X { "local3", LOG_LOCAL3 },
- X { "local4", LOG_LOCAL4 },
- X { "local5", LOG_LOCAL5 },
- X { "local6", LOG_LOCAL6 },
- X { "local7", LOG_LOCAL7 },
- X { CHAR_NULL, 1 },
- X { "BAD FACILITY", 0 }
- X } ;
- X
- X
- Xstruct name_value syslog_levels[] =
- X {
- X { "emerg", LOG_EMERG },
- X { "alert", LOG_ALERT },
- X { "crit", LOG_CRIT },
- X { "err", LOG_ERR },
- X { "warning", LOG_WARNING },
- X { "notice", LOG_NOTICE },
- X { "info", LOG_INFO },
- X { "debug", LOG_DEBUG },
- X { CHAR_NULL, 1 },
- X { "BAD LEVEL", 0 }
- X } ;
- X
- END_OF_FILE
- if test 2285 -ne `wc -c <'xinetd/nvlists.c'`; then
- echo shar: \"'xinetd/nvlists.c'\" unpacked with wrong size!
- fi
- # end of 'xinetd/nvlists.c'
- fi
- if test -f 'xinetd/server.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'xinetd/server.h'\"
- else
- echo shar: Extracting \"'xinetd/server.h'\" \(2576 characters\)
- sed "s/^X//" >'xinetd/server.h' <<'END_OF_FILE'
- X/*
- X * (c) Copyright 1992 by Panagiotis Tsirigotis
- X * All rights reserved. The file named COPYRIGHT specifies the terms
- X * and conditions for redistribution.
- X */
- X
- X#ifndef SERVER_H
- X#define SERVER_H
- X
- X/*
- X * $Id: server.h,v 6.7 1993/06/20 20:13:47 panos Exp $
- X */
- X
- X#include <sys/types.h>
- X#include <sys/wait.h>
- X
- X#include "defs.h"
- X#include "service.h"
- X#include "connection.h"
- X
- X#ifdef NO_POSIX_TYPES
- Xtypedef int pid_t ;
- X#endif
- X
- X
- X/*
- X * This struct describes running servers
- X */
- Xstruct server
- X{
- X pid_t svr_pid ;
- X time_t svr_start_time ;
- X connection_s *svr_conn ;
- X struct service *svr_sp ; /* service that owns this server */
- X int svr_fork_failures ; /* number of fork(2) failures */
- X int svr_exit_status ;
- X bool_int svr_log_remote_user ;
- X bool_int svr_writes_to_log ; /* needed because a service may be */
- X /* reconfigured between server */
- X /* forking and exit */
- X} ;
- X
- X#define SERP( p ) ((struct server *)(p))
- X
- X#define SERVER_SERVICE( serp ) (serp)->svr_sp
- X#define SERVER_CONNECTION( serp) (serp)->svr_conn
- X#define SERVER_CONNSERVICE( serp ) CONN_SERVICE( SERVER_CONNECTION( serp ) )
- X#define SERVER_FD( serp ) CONN_DESCRIPTOR( (serp)->svr_conn )
- X#define SERVER_PID( serp ) (serp)->svr_pid
- X#define SERVER_EXITSTATUS( serp ) (serp)->svr_exit_status
- X#define SERVER_STARTTIME( serp ) (serp)->svr_start_time
- X#define SERVER_LOGUSER( serp ) (serp)->svr_log_remote_user
- X
- X#define SERVER_FORKLIMIT( serp ) \
- X ( (serp)->svr_fork_failures >= MAX_FORK_FAILURES )
- X
- X#define server_set_pid( serp, pid ) (serp)->svr_pid = (pid)
- X#define server_set_exit_status( serp, status ) \
- X (serp)->svr_exit_status = (status)
- X
- Xstatus_e server_init() ;
- Xvoid server_release() ;
- Xstatus_e server_run() ;
- Xstatus_e server_start() ;
- Xvoid server_dump() ;
- Xvoid server_end() ;
- Xstruct server *server_lookup() ;
- X
- X
- X/*
- X * Macros for compatibility
- X */
- X#ifndef OLD_WAIT
- X#define PROC_EXITED( s ) WIFEXITED( s )
- X#define PROC_SIGNALED( s ) WIFSIGNALED( s )
- X#define PROC_STOPPED( s ) WIFSTOPPED( s )
- X#define PROC_EXITSTATUS( s ) WEXITSTATUS( s )
- X#define PROC_TERMSIG( s ) WTERMSIG( s )
- X#else
- X#define PROC_EXITED( s ) WIFEXITED( *(union wait *)&(s) )
- X#define PROC_SIGNALED( s ) WIFSIGNALED( *(union wait *)&(s) )
- X#define PROC_STOPPED( s ) WIFSTOPPED( *(union wait *)&(s) )
- X#define PROC_EXITSTATUS( s ) (((union wait *)&(s))->w_T.w_Retcode)
- X#define PROC_TERMSIG( s ) (((union wait *)&(s))->w_T.w_Termsig)
- X#endif /* OLD_WAIT */
- X
- X#endif /* SERVER_H */
- X
- END_OF_FILE
- if test 2576 -ne `wc -c <'xinetd/server.h'`; then
- echo shar: \"'xinetd/server.h'\" unpacked with wrong size!
- fi
- # end of 'xinetd/server.h'
- fi
- echo shar: End of archive 4 \(of 31\).
- cp /dev/null ark4isdone
- MISSING=""
- 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
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 31 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-