home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-06-26 | 32.3 KB | 1,286 lines |
- Newsgroups: comp.sources.unix
- From: panos@cs.colorado.edu (Panos Tsirigotis)
- Subject: v26i250: xinetd-2.1.1 - inetd replacement with access control and logging, Part06/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 250
- Archive-Name: xinetd-2.1.1/part06
-
- #! /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 6 (of 31)."
- # Contents: INSTALL libs/src/misc/misc.c libs/src/pq/Makefile
- # libs/src/pq/pq.3 libs/src/pset/Makefile xinetd/access.c
- # xinetd/time.c xinetd/xinetd.log.man
- # Wrapped by panos@mystique on Mon Jun 21 14:51:21 1993
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'INSTALL' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'INSTALL'\"
- else
- echo shar: Extracting \"'INSTALL'\" \(3290 characters\)
- sed "s/^X//" >'INSTALL' <<'END_OF_FILE'
- X
- X1. Distribution
- X
- Xxinetd is distributed in shar archive kit form. After all the archives
- Xare unpacked, you should end up with the following directory structure:
- X
- X INSTALL
- X README
- X compile-src
- X ./xinetd
- X ./libs
- X ./libs/include
- X ./libs/man
- X ./libs/lib
- X ./libs/src/{sio,pset,misc,xlog,timer,pq}
- X
- X
- X----------------------------------------------------------------------
- X
- X2. Installing xinetd
- X
- XThe compile-src script will compile the libraries and xinetd.
- X"compile-src -help" will list all available options.
- XIt knows about some operating systems. When you invoke it, it will ask
- Xyou if your OS is among those it knows about. If so, all you need to do
- Xis type the OS name. If you have a different OS, compile-src will try
- Xto configure xinetd appropriately.
- X
- XThe script will also ask you questions when it can't figure out
- Xsomething. For every question that it asks, there is a command line
- Xoption, so in case you need to run the script more than once, you can
- Xuse the command line option to avoid having to answer the question
- Xmultiple times.
- X
- XIt is recommended that every time you make changes to xinetd or to the
- Xlibraries it uses, you cd to the top level directory (the one
- Xcontaining the directories "libs" and "xinetd") and run the script
- Xcompile-src. This script invokes "make" with arguments that override
- Xvariables defined in the Makefiles.
- X
- XWhen the compilation is over, the xinetd executable will be in the
- X"xinetd" directory. If you want to install it in one of the system
- Xdirectories, cd to the "xinetd" directory and type:
- X
- X make install BINDIR=<install program here> MANDIR=<install man page here>
- X
- XFor example:
- X
- X make install BINDIR=/usr/local/bin MANDIR=/usr/local/man/man1
- X
- XThe reason for putting the program in a directory like /usr/local/bin
- Xis that this is not a program that is only useful to superusers.
- X
- X
- X----------------------------------------------------------------------
- X
- X3. Customizing xinetd
- X
- XMost of the behavior of xinetd is determined by constants defined
- Xin the xinetd/config.h header file. Those constants are conditionally
- Xdefined and can be overriden by creating the file xinetd/customconf.h
- Xand invoking the compile-src script with the -custom option.
- X
- X
- X----------------------------------------------------------------------
- X
- X4. Epilogue
- X
- XHere are a few things worth mentioning:
- X
- X1. You can use the program "itox" in the "xinetd" directory to convert
- X inetd.conf to a xinetd configuration file. The program works as a
- X filter, i.e.
- X itox [-daemon_dir dir_name] < inetd.conf > xinetd.conf
- X The -daemon_dir option is useful in case you are already using tcpd for
- X access control. It specifies the directory name where tcpd expects
- X to find the daemon programs.
- X The itox program will also be compiled by the compile-src script.
- X
- X2. A sample xinetd configuration file is included: xinetd/sample.conf
- X
- X3. I have been using xinetd on a Sun SparcStation running SunOS 4.1 and
- X I have compiled it (but not used it) on a DECstation running Ultrix 4.2.
- X
- X4. You may find the libraries useful in their own right. They all come
- X with man pages that explain what the library functions do.
- X
- X5. You can send comments/bug-reports to panos@cs.colorado.edu
- X The file BUG-REPORTS in the "xinetd" directory contains instructions
- X on what to include in a bug report.
- X
- END_OF_FILE
- if test 3290 -ne `wc -c <'INSTALL'`; then
- echo shar: \"'INSTALL'\" unpacked with wrong size!
- fi
- # end of 'INSTALL'
- fi
- if test -f 'libs/src/misc/misc.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libs/src/misc/misc.c'\"
- else
- echo shar: Extracting \"'libs/src/misc/misc.c'\" \(3395 characters\)
- sed "s/^X//" >'libs/src/misc/misc.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: misc.c,v 2.1 1992/10/01 00:38:29 panos Exp $" ;
- Xstatic char misc_version[] = VERSION ;
- X
- X#include <varargs.h>
- X
- X/*
- X * MISCELLANEOUS FUNCTIONS
- X */
- X
- X#include "misc.h"
- X
- X#ifndef NULL
- X#define NULL 0
- X#endif
- X
- Xchar *strncpy() ;
- Xchar *strrchr() ;
- X
- X
- X/*
- X * Create a new argv array,
- X * copy the original to the new one,
- X * and clear the old one
- X */
- Xchar **argv_copy_and_clear( org_argv, start, count )
- X char **org_argv ; /* original argv */
- X int start ; /* from where to start copy/clear */
- X int count ; /* how many entries to copy/clear */
- X{
- X char **new_argv ;
- X char *p ;
- X int i ;
- X int j ;
- X char *malloc() ;
- X
- X new_argv = (char **) malloc( count * sizeof( char * ) ) ;
- X if ( new_argv == NULL )
- X return( NULL ) ;
- X
- X for ( i = 0 ; i < count ; i++ )
- X {
- X new_argv[ i ] = make_string( 1, org_argv[ start+i ] ) ;
- X if ( new_argv[ i ] == NULL )
- X {
- X for ( j = i-1 ; j >= 0 ; j-- )
- X free( new_argv[ j ] ) ;
- X free( (char *) new_argv ) ;
- X return( NULL ) ;
- X }
- X for ( p = org_argv[ start+i ] ; *p ; p++ )
- X *p = ' ' ;
- X }
- X return( new_argv ) ;
- X}
- X
- X
- X/*
- X * We always return a pointer in pathname
- X */
- Xchar *basename( pathname )
- X char *pathname ;
- X{
- X char *s = strrchr( pathname, '/' ) ;
- X
- X if ( s == NULL )
- X return( pathname ) ;
- X else
- X return( s+1 ) ;
- X}
- X
- X
- X/*
- X * We always return a malloced string
- X *
- X * There are 2 special cases:
- X *
- X * 1) pathname == "/"
- X * In this case we return "/"
- X * 2) pathname does not contain a '/'
- X * In this case we return "."
- X */
- Xchar *dirname( pathname )
- X char *pathname ;
- X{
- X int len ;
- X char *s = strrchr( pathname, '/' ) ;
- X char *p ;
- X char *malloc() ;
- X
- X if ( s == NULL )
- X return( make_string( 1, "." ) ) ;
- X else
- X {
- X len = s - pathname ;
- X if ( len == 0 )
- X return( make_string( 1, "/" ) ) ;
- X }
- X
- X p = malloc( len+1 ) ;
- X if ( p == NULL )
- X return( NULL ) ;
- X else
- X {
- X strncpy( p, pathname, len )[ len ] = '\0' ;
- X return( p ) ;
- X }
- X}
- X
- X
- Xchar *make_string( count, va_alist )
- X register unsigned count ;
- X va_dcl
- X{
- X va_list ap ;
- X register unsigned i ;
- X register unsigned len = 0 ;
- X register char *s, *p ;
- X char *new_string ;
- X
- X if ( count == 0 )
- X return( NULL ) ;
- X
- X va_start( ap ) ;
- X for ( i = 0 ; i < count ; i++ )
- X {
- X s = va_arg( ap, char * ) ;
- X if ( s == NULL )
- X continue ;
- X len += strlen( s ) ;
- X }
- X va_end( ap ) ;
- X
- X new_string = malloc( len + 1 ) ;
- X if ( new_string == NULL )
- X return( NULL ) ;
- X
- X p = new_string ;
- X va_start( ap ) ;
- X for ( i = 0 ; i < count ; i++ )
- X {
- X s = va_arg( ap, char * ) ;
- X if ( s == NULL )
- X continue ;
- X while ( *p++ = *s++ ) ;
- X p-- ;
- X }
- X va_end( ap ) ;
- X return( new_string ) ;
- X}
- X
- X
- Xchar *make_pathname( count, va_alist )
- X register unsigned count ;
- X va_dcl
- X{
- X va_list ap ;
- X register unsigned i ;
- X register unsigned len = 0 ;
- X register char *s, *p ;
- X char *pathname ;
- X
- X if ( count == 0 )
- X return( NULL ) ;
- X
- X va_start( ap ) ;
- X for ( i = 0 ; i < count ; i++ )
- X {
- X s = va_arg( ap, char * ) ;
- X len += strlen( s ) ;
- X }
- X va_end( ap ) ;
- X
- X pathname = malloc( len + count ) ;
- X if ( pathname == NULL )
- X return( NULL ) ;
- X
- X p = pathname ;
- X va_start( ap ) ;
- X for ( i = 0 ; i < count ; i++ )
- X {
- X s = va_arg( ap, char * ) ;
- X while ( *p++ = *s++ ) ;
- X *(p-1) = '/' ; /* change '\0' to '/' */
- X }
- X *(p-1) = '\0' ;
- X return( pathname ) ;
- X}
- X
- END_OF_FILE
- if test 3395 -ne `wc -c <'libs/src/misc/misc.c'`; then
- echo shar: \"'libs/src/misc/misc.c'\" unpacked with wrong size!
- fi
- # end of 'libs/src/misc/misc.c'
- fi
- if test -f 'libs/src/pq/Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libs/src/pq/Makefile'\"
- else
- echo shar: Extracting \"'libs/src/pq/Makefile'\" \(3498 characters\)
- sed "s/^X//" >'libs/src/pq/Makefile' <<'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#
- X# $Id: Makefile,v 2.2 1993/05/06 07:50:44 panos Exp $
- X#
- X# Based on Library makefile template: *Revision: 1.15 *
- X#
- X
- X#
- X# Available entries:
- X# lib --> creates the library
- X# install --> installs the library (archive, man page(s), header(s))
- X# uninstall --> uninstall the library
- X# clean --> removes all .o and .a files
- X# spotless --> clean + uninstall
- X# lint --> lints a file (usage: make lint MODULE=foo.c)
- X# tags --> creates a tags file (from the SOURCES and HEADERS)
- X# checkout --> checkout all files
- X# dist --> distribution support
- X#
- X
- XNAME = pq
- XVERSION = 1.0.2
- X
- XHEADERS = hpq.h hpqimpl.h pq.h
- XSOURCES = hpq.c pq.c
- XOBJECTS = hpq.o pq.o
- X
- XMANFILES = pq.3
- XINCLUDEFILES = hpq.h pq.h
- X
- X# The following variables are used by the 'install' entry and
- X# should be customized:
- X# LIBDIR: where the library will be placed
- X# INCUDEDIR: where the include files will be placed
- X# MANDIR: where the man pages will be placed
- X#
- XLIBDIR = $(HOME)/.links/libraries/$(ARCH)
- XMANDIR = $(HOME)/.links/manpages/man3
- XINCLUDEDIR = $(HOME)/.links/includes
- X
- XDEFS = # used for command line defined flags
- XDEBUG = -g # -g or -O
- XVERSION_DEF = -DVERSION=\"HPQ\ Version\ $(VERSION)\"
- X
- XCPP_DEFS = $(VERSION_DEF) $(DEFS)
- X
- X#
- X# The following variables shouldn't need to be changed
- X#
- XLINT_FLAGS = -hbux
- XCPP_FLAGS = $(CPP_DEFS)
- XCC_FLAGS = $(DEBUG)
- XCFLAGS = $(CPP_FLAGS) $(CC_FLAGS)
- X
- XINSTALL = install -c
- XFMODE = -m 640 # used by install
- XRANLIB = ranlib
- X
- XPAGER = less
- X
- X
- XLIBNAME = lib$(NAME).a
- X
- Xlib: $(LIBNAME)
- X
- Xlibopt: clean
- X make DEBUG=-O "DEFS=$(DEFS)" lib
- X $(INSTALL) $(FMODE) $(LIBNAME) $(LIBDIR)/optimized
- X
- X$(LIBNAME): $(OBJECTS)
- X ar r $@ $?
- X $(RANLIB) $@
- X
- Xlint:
- X lint $(CPP_FLAGS) $(LINT_FLAGS) $(MODULE) 2>&1 | $(PAGER)
- X
- Xinstall: $(LIBNAME)
- X @if test "$(LIBDIR)" -a "$(INCLUDEDIR)" -a "$(MANDIR)" ;\
- X then \
- X $(INSTALL) $(FMODE) $(LIBNAME) $(LIBDIR) ;\
- X echo "Installed $(LIBNAME) to $(LIBDIR)" ;\
- X for i in $(INCLUDEFILES); do $(INSTALL) $(FMODE) $$i $(INCLUDEDIR) ; done ;\
- X echo Installed $(INCLUDEFILES) to $(INCLUDEDIR) ;\
- X for i in $(MANFILES) ; do $(INSTALL) $(FMODE) $$i $(MANDIR) ; done ;\
- X echo Installed $(MANFILES) to $(MANDIR) ;\
- X else \
- X echo "You forgot to set one of the following variables: LIBDIR,INCLUDEDIR,MANDIR" ;\
- X fi
- X
- Xuninstall:
- X a=`pwd` ; cd $(INCLUDEDIR) ;\
- X if test $$a != `pwd` ; then rm -f $(INCLUDEFILES) ; fi
- X a=`pwd` ; cd $(LIBDIR) ;\
- X if test $$a != `pwd` ; then rm -f $(LIBNAME) ; fi
- X a=`pwd` ; cd $(MANDIR) ;\
- X if test $$a != `pwd` ; then rm -f $(MANFILES) ; fi
- X
- Xclean:
- X rm -f $(OBJECTS) $(LIBNAME) core
- X
- Xspotless: clean uninstall
- X
- Xtags: $(SOURCES) $(HEADERS)
- X ctags -w $(SOURCES) $(HEADERS)
- X
- Xcheckout:
- X co $(SOURCES) $(HEADERS) $(MANFILES)
- X
- X#
- X# Distribution section
- X# This section contains the 2 targets for distribution support: dist, dirs
- X# "dist" checks out all files to be distributed
- X# "dirs" prints a list of directories to be included in the distribution.
- X# These directories should have a Makefile with a "dist" target
- X#
- XDISTRIBUTION_FILES = $(HEADERS) $(SOURCES) $(MANFILES) COPYRIGHT
- XDIRS =
- X
- Xdist:
- X -co -q $(DISTRIBUTION_FILES)
- X
- Xdirs:
- X @echo $(DIRS)
- X
- X#
- X# PUT HERE THE RULES TO MAKE THE OBJECT FILES
- X#
- Xhpq.o: hpq.h hpqimpl.h pq.h
- X
- X#
- X# Simple test program
- X#
- Xpqtest: pqtest.c $(LIBNAME)
- X cc $(DEBUG) -o $@ pqtest.c $(LIBNAME)
- X
- END_OF_FILE
- if test 3498 -ne `wc -c <'libs/src/pq/Makefile'`; then
- echo shar: \"'libs/src/pq/Makefile'\" unpacked with wrong size!
- fi
- # end of 'libs/src/pq/Makefile'
- fi
- if test -f 'libs/src/pq/pq.3' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libs/src/pq/pq.3'\"
- else
- echo shar: Extracting \"'libs/src/pq/pq.3'\" \(3310 characters\)
- sed "s/^X//" >'libs/src/pq/pq.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: pq.3,v 1.4 1993/05/06 06:52:47 panos Exp $
- X.TH PQ 3PT "22 December 1991"
- X.SH NAME
- Xpq_create, pq_destroy, pq_head, pq_extract_head, pq_insert, pq_delete - functions that manage priority queues
- X.SH SYNOPSIS
- X.LP
- X.nf
- X.ft B
- X#include "pq.h"
- X.LP
- X.ft B
- Xpq_h pq_create( func, flags, errnop )
- Xint (*func)() ;
- Xint flags ;
- Xint *errnop ;
- X.LP
- X.ft B
- Xvoid pq_destroy( pq )
- Xpq_h pq ;
- X.LP
- X.ft B
- Xpq_obj pq_head( pq )
- Xpq_h pq ;
- X.LP
- X.ft B
- Xpq_obj pq_extract_head( pq )
- Xpq_h pq ;
- X.LP
- X.ft B
- Xint pq_insert( pq, object )
- Xpq_h pq ;
- Xpq_obj object ;
- X.LP
- X.ft B
- Xint pq_delete( pq, object )
- Xpq_h pq ;
- Xpq_obj object ;
- X.SH DESCRIPTION
- X.LP
- XThis library handles priority queues that contain objects. Objects are
- Xof type
- X.I pq_obj
- Xwhich is a pointer type.
- XThe object at the head of a priority queue is the
- X.I best
- Xobject. The
- Xuser defines the ordering by providing a function that compares objects
- Xwhen the priority queue is created.
- X.LP
- X.B pq_create()
- Xcreates a priority queue and returns a handle to be used for operations
- Xon that queue. \fIfunc\fR is a pointer to a function that takes 2 objects
- Xas arguments and returns 1 if the first object is
- X.I "better"
- Xthan the
- Xsecond and 0 otherwise. The only possible value for the \fIflags\fR
- Xargument is \fBPQ_RETURN_ERROR\fR which if used will cause queue
- Xoperations applied on the specific priority queue to return an error
- Xstatus if they fail (the default is to terminate the program with
- Xan appropriate error message). The value \fBPQ_NOFLAGS\fR can be
- Xused to specify no flags.
- XThe \fIerrnop\fR argument is a pointer to an integer where an
- Xerror code will be stored if an operation fails
- X(and \fBPQ_RETURN_ERROR\fR is used). If no pointer is specified,
- Xerror codes are placed in the global variable \fIpq_error\fR.
- X.LP
- X.B pq_destroy()
- Xis used to destroy a priority queue.
- X.LP
- X.B pq_head()
- Xreturns the object at the head of the priority queue.
- X.LP
- X.B pq_extract_head()
- Xextracts and returns the object at the head of the priority queue.
- X.LP
- X.B pq_insert()
- Xinserts the given \fIobject\fR in the priority queue.
- X.LP
- X.B pq_delete()
- Xdeletes the given \fIobject\fR from the priority queue.
- X.SH "RETURN VALUES"
- X.LP
- XIn the following, values for \fIpq_errno\fR will be stored in the
- Xuser-specified variable if one was provided.
- X.LP
- X.B pq_create()
- Xreturns a priority queue handle if successful, or
- X.SM NULL
- Xif it fails.
- XPossible \fIpq_errno\fR values:
- X.RS
- X.TP 20
- X.SB PQ_ENOFUNC
- XThe object comparison function is missing.
- X.TP
- X.SB PQ_ENOMEM
- XThe program ran out of memory.
- X.RE
- X.LP
- X.B pq_insert()
- Xreturns \fBPQ_OK\fR if successful and \fBPQ_ERR\fR if it fails.
- XPossible \fIpq_errno\fR values:
- X.RS
- X.TP 20
- X.SB PQ_ENULLOBJECT
- XThe object value is
- X.SM NULL.
- X.TP
- X.SB PQ_ENOMEM
- XThe program ran out of memory.
- X.RE
- X.LP
- X.B pq_head()
- Xreturns the object at the head of the queue or
- X.SM NULL
- Xif the queue is empty.
- X.LP
- X.B pq_extract_head()
- Xreturns the object at the head of the queue or
- X.SM NULL
- Xif the queue is empty.
- X.LP
- X.B pq_delete()
- Xreturns \fBPQ_OK\fR if successful and \fBPQ_ERR\fR if it fails.
- XPossible \fIpq_errno\fR values:
- X.RS
- X.TP 20
- X.SB PQ_ENULLOBJECT
- XThe object value is
- X.SM NULL.
- X.TP
- X.SB PQ_ENOTFOUND
- XThe object is not in the queue.
- X.RE
- END_OF_FILE
- if test 3310 -ne `wc -c <'libs/src/pq/pq.3'`; then
- echo shar: \"'libs/src/pq/pq.3'\" unpacked with wrong size!
- fi
- # end of 'libs/src/pq/pq.3'
- fi
- if test -f 'libs/src/pset/Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'libs/src/pset/Makefile'\"
- else
- echo shar: Extracting \"'libs/src/pset/Makefile'\" \(3363 characters\)
- sed "s/^X//" >'libs/src/pset/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 3.2 1993/03/13 23:22:29 panos Exp $
- X#
- X# Based on Library makefile template: *Revision: 1.15 *
- X#
- X
- X#
- X# Available entries:
- X# lib --> creates the library
- X# install --> installs the library (archive, man page(s), header(s))
- X# uninstall --> uninstall the library
- X# clean --> removes all .o and .a files
- X# spotless --> clean + uninstall
- X# lint --> lints a file (usage: make lint MODULE=foo.c)
- X# tags --> creates a tags file (from the SOURCES and HEADERS)
- X# checkout --> checkout all files
- X# dist --> distribution support
- X#
- X
- XNAME = pset
- XVERSION = 1.2.0
- X
- XHEADERS = pset.h
- XSOURCES = pset.c ops.c
- XOBJECTS = pset.o ops.o
- X
- XMANFILES = pset.3 psi.3
- XINCLUDEFILES = pset.h
- X
- X# The following variables are used by the 'install' entry and
- X# should be customized:
- X# LIBDIR: where the library will be placed
- X# INCUDEDIR: where the include files will be placed
- X# MANDIR: where the man pages will be placed
- X#
- XLIBDIR = $(HOME)/.links/libraries/$(ARCH)
- XMANDIR = $(HOME)/.links/manpages/man3
- XINCLUDEDIR = $(HOME)/.links/includes
- X
- XDEFS = # used for command line defined flags
- XDEBUG = -g # -g or -O
- XVERSION_DEF = -DVERSION=\"PSET\ Version\ $(VERSION)\"
- X
- XCPP_DEFS = $(VERSION_DEF) $(DEFS)
- X
- X#
- X# The following variables shouldn't need to be changed
- X#
- XLINT_FLAGS = -hbux
- XCPP_FLAGS = $(CPP_DEFS)
- XCC_FLAGS = $(DEBUG)
- XCFLAGS = $(CPP_FLAGS) $(CC_FLAGS)
- X
- XINSTALL = install -c
- XFMODE = -m 640 # used by install
- XRANLIB = ranlib
- X
- XPAGER = less
- X
- X
- XLIBNAME = lib$(NAME).a
- X
- Xlib: $(LIBNAME)
- X
- Xlibopt: clean
- X make DEBUG=-O lib
- X mv $(LIBNAME) $(LIBDIR)/optimized
- X
- X$(LIBNAME): $(OBJECTS)
- X ar r $@ $?
- X $(RANLIB) $@
- X
- Xlint:
- X lint $(CPP_FLAGS) $(LINT_FLAGS) $(MODULE) 2>&1 | $(PAGER)
- X
- Xinstall: $(LIBNAME)
- X @if test "$(LIBDIR)" -a "$(INCLUDEDIR)" -a "$(MANDIR)" ;\
- X then \
- X $(INSTALL) $(FMODE) $(LIBNAME) $(LIBDIR) ;\
- X echo "Installed $(LIBNAME) to $(LIBDIR)" ;\
- X for i in $(INCLUDEFILES); do $(INSTALL) $(FMODE) $$i $(INCLUDEDIR) ; done ;\
- X echo Installed $(INCLUDEFILES) to $(INCLUDEDIR) ;\
- X for i in $(MANFILES) ; do $(INSTALL) $(FMODE) $$i $(MANDIR) ; done ;\
- X echo Installed $(MANFILES) to $(MANDIR) ;\
- X else \
- X echo "You forgot to set one of the following variables: LIBDIR,INCLUDEDIR,MANDIR" ;\
- X fi
- X
- Xuninstall:
- X a=`pwd` ; cd $(INCLUDEDIR) ;\
- X if test $$a != `pwd` ; then rm -f $(INCLUDEFILES) ; fi
- X a=`pwd` ; cd $(LIBDIR) ;\
- X if test $$a != `pwd` ; then rm -f $(LIBNAME) ; fi
- X a=`pwd` ; cd $(MANDIR) ;\
- X if test $$a != `pwd` ; then rm -f $(MANFILES) ; fi
- X
- Xclean:
- X rm -f $(OBJECTS) $(LIBNAME) core
- X
- Xspotless: clean uninstall
- X
- Xtags: $(SOURCES) $(HEADERS)
- X ctags -w $(SOURCES) $(HEADERS)
- X
- Xcheckout:
- X co $(SOURCES) $(HEADERS) $(MANFILES)
- X
- X#
- X# Distribution section
- X# This section contains the 2 targets for distribution support: dist, dirs
- X# "dist" checks out all files to be distributed
- X# "dirs" prints a list of directories to be included in the distribution.
- X# These directories should have a Makefile with a "dist" target
- X#
- XDISTRIBUTION_FILES = $(SOURCES) $(HEADERS) $(MANFILES) COPYRIGHT
- XDIRS =
- X
- Xdist:
- X -co -q $(DISTRIBUTION_FILES)
- X
- Xdirs:
- X @echo $(DIRS)
- X
- X#
- X# PUT HERE THE RULES TO MAKE THE OBJECT FILES
- X#
- Xpset.o: pset.h
- X
- END_OF_FILE
- if test 3363 -ne `wc -c <'libs/src/pset/Makefile'`; then
- echo shar: \"'libs/src/pset/Makefile'\" unpacked with wrong size!
- fi
- # end of 'libs/src/pset/Makefile'
- fi
- if test -f 'xinetd/access.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'xinetd/access.c'\"
- else
- echo shar: Extracting \"'xinetd/access.c'\" \(3524 characters\)
- sed "s/^X//" >'xinetd/access.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: access.c,v 6.6 1993/06/15 23:25:57 panos Exp $" ;
- X
- X#include <syslog.h>
- X#include <time.h>
- X
- X#include "connection.h"
- X#include "service.h"
- X#include "state.h"
- X#include "addr.h"
- X#include "access.h"
- X
- Xchar *inet_ntoa() ;
- Xtime_t time() ;
- X
- Xvoid msg() ;
- X
- Xstruct name_value access_code_names[] =
- X {
- X { "address", (int) AC_ADDRESS },
- X { "time", (int) AC_TIME },
- X { "fork", (int) AC_FORK },
- X { "service_limit", (int) AC_SERVICE_LIMIT },
- X { "process_limit", (int) AC_PROCESS_LIMIT },
- X { CHAR_NULL, 1 },
- X { "UNKNOWN", 0 }
- X } ;
- X
- X
- X/*
- X * Returns OK if the IP address in sinp is acceptable to the access control
- X * lists of the specified service.
- X */
- XPRIVATE status_e remote_address_check( sp, sinp )
- X register struct service *sp ;
- X struct sockaddr_in *sinp ;
- X{
- X /*
- X * of means only_from, na means no_access
- X */
- X unsigned long of_match ;
- X unsigned long na_match ;
- X register bool_int of_matched ;
- X register bool_int na_matched ;
- X struct in_addr *addr ;
- X
- X addr = &sinp->sin_addr ;
- X
- X if ( sp->svc_no_access != NULL )
- X na_matched = addrlist_match( sp->svc_no_access, addr, &na_match ) ;
- X else
- X na_matched = FALSE ;
- X
- X if ( sp->svc_only_from != NULL )
- X of_matched = addrlist_match( sp->svc_only_from, addr, &of_match ) ;
- X else
- X of_matched = FALSE ;
- X
- X /*
- X * Check if the specified address is in both lists
- X */
- X if ( na_matched && of_matched )
- X {
- X /*
- X * The greater match wins.
- X * If the matches are equal, this is an error in the service entry
- X * and we cannot allow a server to start.
- X * We do not disable the service entry (not our job).
- X */
- X if ( na_match == of_match )
- X msg( LOG_ERR, "remote_address_check",
- X"Service=%s: only_from list and no_access list match equally the address %s",
- X SVC_ID( sp ), inet_ntoa( sinp->sin_addr ) ) ;
- X return( ( of_match > na_match ) ? OK : FAILED ) ;
- X }
- X
- X if ( sp->svc_no_access != NULL && na_matched )
- X return( FAILED ) ;
- X if ( sp->svc_only_from != NULL && ! of_matched )
- X return( FAILED ) ;
- X
- X /*
- X * If no lists were specified, the default is to allow starting a server
- X */
- X return( OK ) ;
- X}
- X
- X
- X/*
- X * mp is the mask pointer, t is the check type
- X */
- X#define CHECK( mp, t ) ( ( (mp) == NULL ) || M_IS_SET( *(mp), t ) )
- X
- X/*
- X * Perform the access controls specified by check_mask.
- X * If check_mask is NULL, perform all access controls
- X */
- Xaccess_e access_control( sp, cp, check_mask )
- X register struct service *sp ;
- X register connection_s *cp ;
- X register mask_t *check_mask ;
- X{
- X register struct service_config *scp = SVC_CONF( sp ) ;
- X struct sockaddr_in *sinp ;
- X
- X if ( CHECK( check_mask, CF_ADDRESS ) &&
- X ( sinp = conn_address( cp ) ) != SOCKADDRIN_NULL &&
- X remote_address_check( sp, sinp ) == FAILED )
- X return( AC_ADDRESS ) ;
- X
- X if ( CHECK( check_mask, CF_TIME ) &&
- X SC_ACCESS_TIMES( scp ) != NULL &&
- X ! ti_current_time_check( SC_ACCESS_TIMES( scp ) ) )
- X return( AC_TIME ) ;
- X
- X if ( CHECK( check_mask, CF_SERVICE_LIMIT ) &&
- X SVC_RUNNING_SERVERS( sp ) >= SC_INSTANCES( scp ) )
- X return( AC_SERVICE_LIMIT ) ;
- X
- X if ( CHECK( check_mask, CF_PROCESS_LIMIT ) && ps.ros.process_limit )
- X {
- X unsigned processes_to_create = SC_IS_INTERCEPTED( scp ) ? 2 : 1 ;
- X
- X if ( pset_count( SERVERS( ps ) ) + processes_to_create >
- X ps.ros.process_limit )
- X return( AC_PROCESS_LIMIT ) ;
- X }
- X return( AC_OK ) ;
- X}
- X
- END_OF_FILE
- if test 3524 -ne `wc -c <'xinetd/access.c'`; then
- echo shar: \"'xinetd/access.c'\" unpacked with wrong size!
- fi
- # end of 'xinetd/access.c'
- fi
- if test -f 'xinetd/time.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'xinetd/time.c'\"
- else
- echo shar: Extracting \"'xinetd/time.c'\" \(3472 characters\)
- sed "s/^X//" >'xinetd/time.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: time.c,v 6.5 1993/06/06 00:08:34 panos Exp $" ;
- X
- X#include <syslog.h>
- X#include <ctype.h>
- X#include <time.h>
- X
- X#include "pset.h"
- X
- X#include "defs.h"
- X
- Xtime_t time() ;
- Xchar *malloc() ;
- Xint free() ;
- X
- Xvoid parsemsg() ;
- Xvoid out_of_memory() ;
- X
- X
- X#define IN_RANGE( val, low, high ) ( (low) <= (val) && (val) <= (high) )
- X
- Xstruct time_interval
- X{
- X short min_start ;
- X short min_end ;
- X} ;
- X
- X#define TIP( p ) ( (struct time_interval *) (p) )
- X
- X#define NEW_TI() NEW( struct time_interval )
- X#define FREE_TI( tip ) FREE( tip )
- X
- X
- X/*
- X * Returns TRUE if the current time is within at least one of the intervals
- X */
- Xbool_int ti_current_time_check( intervals )
- X pset_h intervals ;
- X{
- X time_t current_time ;
- X register unsigned u ;
- X register short min_current ;
- X struct tm *tmp ;
- X
- X (void) time( ¤t_time ) ;
- X tmp = localtime( ¤t_time ) ;
- X min_current = tmp->tm_hour * 60 + tmp->tm_min ;
- X
- X for ( u = 0 ; u < pset_count( intervals ) ; u++ )
- X {
- X register struct time_interval *tip ;
- X
- X tip = TIP( pset_pointer( intervals, u ) ) ;
- X if ( IN_RANGE( min_current, tip->min_start, tip->min_end ) )
- X return( TRUE ) ;
- X }
- X return( FALSE ) ;
- X}
- X
- X
- XPRIVATE char *get_num( nump, min_val, max_val, s, stop_char )
- X register int *nump ;
- X int min_val ;
- X int max_val ;
- X char *s ;
- X char stop_char ;
- X{
- X register char *p = s ;
- X char *func = "get_num" ;
- X
- X for ( *nump = 0 ; isdigit( *p ) ; p++ )
- X {
- X *nump *= 10 ;
- X *nump += *p - '0' ;
- X }
- X
- X if ( *p != stop_char )
- X {
- X parsemsg( LOG_ERR, func, "incorrect time interval" ) ;
- X return( NULL );
- X }
- X
- X if ( ! IN_RANGE( *nump, min_val, max_val ) )
- X {
- X parsemsg( LOG_ERR, func, "invalid time interval" ) ;
- X return( NULL ) ;
- X }
- X return( p+1 ) ;
- X}
- X
- X
- X
- X/*
- X * Each interval should have the form:
- X * hour:min-hour:min
- X * Example: 2:30-4:15
- X */
- Xstatus_e ti_add( iset, interval_str )
- X pset_h iset ;
- X char *interval_str ;
- X{
- X struct time_interval *tip ;
- X int hours ;
- X int minutes ;
- X register char *p ;
- X int min_start ;
- X int min_end ;
- X char *func = "add_interval" ;
- X
- X if ( ( p = get_num( &hours, 0, 23, interval_str, ':' ) ) == NULL )
- X return( OK ) ;
- X if ( ( p = get_num( &minutes, 0, 59, p, '-' ) ) == NULL )
- X return( OK ) ;
- X min_start = hours * 60 + minutes ;
- X
- X if ( ( p = get_num( &hours, 0, 23, p, ':' ) ) == NULL )
- X return( OK ) ;
- X if ( ( p = get_num( &minutes, 0, 59, p, NUL ) ) == NULL )
- X return( OK ) ;
- X min_end = hours * 60 + minutes ;
- X if ( min_start >= min_end )
- X {
- X parsemsg( LOG_ERR, func, "invalid time interval: %s", interval_str ) ;
- X return( OK ) ;
- X }
- X
- X tip = NEW_TI() ;
- X if ( tip == NULL )
- X {
- X out_of_memory( func ) ;
- X return( FAILED ) ;
- X }
- X tip->min_start = min_start ;
- X tip->min_end = min_end ;
- X if ( pset_add( iset, tip ) == NULL )
- X {
- X FREE_TI( tip ) ;
- X out_of_memory( func ) ;
- X return( FAILED ) ;
- X }
- X return( OK ) ;
- X}
- X
- X
- Xvoid ti_dump( iset, fd )
- X pset_h iset ;
- X int fd ;
- X{
- X register unsigned u ;
- X
- X for ( u = 0 ; u < pset_count( iset ) ; u++ )
- X {
- X register struct time_interval *tip = TIP( pset_pointer( iset, u ) ) ;
- X
- X Sprint( fd, " %02d:%02d-%02d:%02d",
- X tip->min_start / 60, tip->min_start % 60,
- X tip->min_end / 60, tip->min_end % 60 ) ;
- X }
- X}
- X
- X
- Xvoid ti_free( iset )
- X pset_h iset ;
- X{
- X pset_apply( iset, free, NULL ) ;
- X}
- X
- END_OF_FILE
- if test 3472 -ne `wc -c <'xinetd/time.c'`; then
- echo shar: \"'xinetd/time.c'\" unpacked with wrong size!
- fi
- # end of 'xinetd/time.c'
- fi
- if test -f 'xinetd/xinetd.log.man' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'xinetd/xinetd.log.man'\"
- else
- echo shar: Extracting \"'xinetd/xinetd.log.man'\" \(3316 characters\)
- sed "s/^X//" >'xinetd/xinetd.log.man' <<'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: xinetd.log.man,v 6.4 1993/06/06 00:13:28 panos Exp $
- X.TH XINETD.LOG 5L "28 April 1993"
- X.SH NAME
- Xxinetd.log \- xinetd service log format
- X.\" *********************** DESCRIPTION ****************************
- X.SH "DESCRIPTION"
- XA service configuration may specify various degrees of logging when
- Xattempts are made to access the service. When logging for a service
- Xis enabled,
- X.B xinetd
- Xwill generate one-line log entries which have the following format
- X(all entries have a timestamp as a prefix):
- X.sp 1
- X.RS
- X\fIentry\fP: \fIservice-id\fP \fIdata\fP
- X.RE
- X.LP
- XThe \fIdata\fP depends on the \fIentry\fP.
- XPossible \fIentry\fP types include:
- X.RS
- X.TP 12
- X.SB START
- Xgenerated when a server is started
- X.TP
- X.SB EXIT
- Xgenerated when a server exits
- X.TP
- X.SB FAIL
- Xgenerated when it is not possible to start a server
- X.TP
- X.SB DATA
- Xgenerated when an attempt to start a server fails and the service supports
- Xthe \fIRECORD\fP log option.
- X.TP
- X.SB USERID
- Xgenerated if the \fIUSERID\fP log option is used.
- X.TP
- X.SB NOID
- Xgenerated if the
- X.I USERID
- Xlog option is used,
- Xand the
- X.I IDONLY
- Xservice flag is used,
- Xand the remote end does not identify who is trying to access the service.
- X.RE
- X.LP
- XIn the following, the information enclosed in brackets appears
- Xif the appropriate log option is used.
- X.LP
- XA \fISTART\fP entry has the format:
- X.sp 1
- X.RS
- XSTART: \fIservice-id\fP [pid=%d] [from=%d.%d.%d.%d]
- X.RE
- X.LP
- XAn \fIEXIT\fP entry has the format:
- X.sp 1
- X.RS
- XEXIT: \fIservice-id\fP [\fItype\fP=%d] [pid=%d] [duration=%d(sec)]
- X.RE
- X.sp 1
- X.I type
- Xcan be either
- X.SB status
- Xor
- X.SB signal.
- XThe number is either the exit status or the signal that caused process
- Xtermination.
- X.LP
- XA \fIFAIL\fP entry has the format:
- X.sp 1
- X.RS
- XFAIL: \fIservice-id\fP \fIreason\fP [from=%d.%d.%d.%d]
- X.RE
- X.sp 1
- XPossible \fIreasons\fP are:
- X.RS
- X.TP 15
- X.SB fork
- Xa certain number of consecutive fork attempts failed (this number is
- Xa configurable parameter)
- X.TP
- X.SB time
- Xthe time check failed
- X.TP
- X.SB address
- Xthe address check failed
- X.TP
- X.SB service_limit
- Xthe allowed number of server instances for this service would be exceeded
- X.TP
- X.SB process_limit
- Xa limit on the number of forked processes was specified and it would
- Xbe exceeded
- X.RE
- X.LP
- XA \fIDATA\fP entry has the format:
- X.sp 1
- X.RS
- XDATA: \fIservice-id\fP \fIdata\fP
- X.RE
- X.sp 1
- XThe \fIdata\fP logged depends on the service.
- X.RS
- X.TP 12
- X.SB login
- Xremote_user=%s local_user=%s tty=%s
- X.TP
- X.SB exec
- Xremote_user=%s verify=\fIstatus\fP command=%s
- X.br
- XPossible
- X.I status
- Xvalues:
- X.RS
- X.TP 10
- X.I ok
- Xthe password was correct
- X.TP
- X.I failed
- Xthe password was incorrect
- X.TP
- X.I baduser
- Xno such user
- X.RE
- X.TP
- X.SB shell
- Xremote_user=%s local_user=%s command=%s
- X.TP
- X.SB finger
- X\fIreceived string\fP or
- X.I EMPTY-LINE
- X.RE
- X.LP
- XA \fIUSERID\fP entry has the format:
- X.sp 1
- X.RS
- XUSERID: \fIservice-id\fP \fItext\fP
- X.RE
- X.sp 1
- XThe \fItext\fP is the response of the identification daemon at the remote end
- Xexcluding the port numbers (which are included in the response).
- X.LP
- XA \fINOID\fP entry has the format:
- X.sp 1
- X.RS
- XNOID: \fIservice-id\fP \fIIP-address\fP \fIreason\fP
- X.RE
- X.\" *********************** SEE ALSO ****************************
- X.SH "SEE ALSO"
- X.I "xinetd(1L),"
- X.LP
- X.I "xinetd.conf(5)"
- END_OF_FILE
- if test 3316 -ne `wc -c <'xinetd/xinetd.log.man'`; then
- echo shar: \"'xinetd/xinetd.log.man'\" unpacked with wrong size!
- fi
- # end of 'xinetd/xinetd.log.man'
- fi
- echo shar: End of archive 6 \(of 31\).
- cp /dev/null ark6isdone
- 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
-