Software Package:       
	apache

Release/Version:
	1.0.0

Retrieved from:
	ftp://www.apache.org/apache/dist/

Bug reports:
	This software package is maintained by the software contributor,
	not BSDI.  Please send any bug reports to both support@BSDI.COM
	and the Apache Project at either apache-bugs@apache.org
	or via the web at http://www.apache.org/bug_report

Comments:

	I've also applied these unofficial Apache Group patches...

From: ben@algroup.co.uk (Ben Laurie)
Subject: Cure scoreboard race condition
Affects: http_main.c scoreboard.h
Changelog: On heavily loaded servers it was possible for the scoreboard to
	get out of sync with reality, as a result of a race condition. The
	observed symptoms are far more Apaches running than should be, and
	heavy system loads, generally followed by catastrophic system failure.

*** http_main.c.old	Fri Dec  8 18:59:11 1995
--- http_main.c	Fri Dec  8 19:26:22 1995
***************
*** 433,439 ****
      int res = 0;
  
      for (i = 0; i < HARD_SERVER_MAX; ++i)
! 	if (scoreboard_image[i].status == SERVER_READY)
  	    ++res;
  
      return res;
--- 433,440 ----
      int res = 0;
  
      for (i = 0; i < HARD_SERVER_MAX; ++i)
! 	if (scoreboard_image[i].status == SERVER_READY
! 	  || scoreboard_image[i].status == SERVER_STARTING)
  	    ++res;
  
      return res;
***************
*** 963,969 ****
--- 964,973 ----
  	if ((count_idle_servers() < daemons_min_free)
  	    && (child_slot = find_free_child_num()) >= 0
  	    && child_slot <= daemons_limit)
+ 	    {
+ 	    update_child_status(child_slot,SERVER_STARTING);
  	    make_child(server_conf, child_slot);
+ 	    }
      }
  
  } /* standalone_main */
*** scoreboard.h.old	Fri Dec  8 18:59:47 1995
--- scoreboard.h	Fri Dec  8 19:04:49 1995
***************
*** 65,70 ****
--- 65,71 ----
  #define SERVER_DEAD 0		/* Unused scoreboard entry */
  #define SERVER_READY 1		/* Waiting for connection (or accept() lock) */
  #define SERVER_BUSY 2		/* Processing a client request */
+ #define SERVER_STARTING 3	/* Launched, but not yet live */
  
  typedef struct {
      pid_t pid;

From: drtr@ast.cam.ac.uk (David Robinson)
Subject: Trap recursive includes
Affects: mod_include.c
ChangeLog: Trap recursive includes.
Comments: Recursive includes can occur if the client supplies PATH_INFO data
          and the server provider uses relative links; as
          file.html relative to /doc.shtml/pathinfo is
          /doc.shtml/file.html.

*** mod_include.c.orig	Fri Nov 17 21:33:17 1995
--- mod_include.c	Mon Dec 11 16:19:03 1995
***************
*** 381,386 ****
--- 381,396 ----
  		&& (strncmp (rr->content_type, "text/", 5)))
  	        error_fmt =
  		  "unable to include potential exec %s in parsed file %s";
+ 
+ 	    if (error_fmt == NULL)
+ 	    {
+ 		request_rec *p;
+ 
+ 		for (p=r; p != NULL; p=p->main)
+ 		    if (strcmp(p->filename, rr->filename) == 0) break;
+ 		if (p != NULL)
+ 		    error_fmt = "Recursive include of %s in parsed file %s";
+ 	    }
  	    
  	    if (!error_fmt && run_sub_req (rr))
  	        error_fmt = "unable to include %s in parsed file %s";

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Modifications to this version made by BSDI:

Included the 1.0 set of apache docs from
http://www.apache.org/ in the docs directory.

Added the following files:
    Makefile
    Makefile.inc
    bsdi/*
    cgi-bin/Makefile
    cgi-bin/bsdi-man
    cgi-src/change-passwd.mk
    cgi-src/imagemap.mk
    cgi-src/post-query.mk
    cgi-src/query.mk
    conf/Makefile
    icons/Makefile
    icons/back.xbm
    icons/ball.xbm
    icons/binary.xbm
    icons/blank.xbm
    icons/ftp.xbm
    icons/image.xbm
    icons/index.xbm
    icons/menu.xbm
    icons/movie.xbm
    icons/sound.xbm
    icons/telnet.xbm
    icons/text.xbm
    icons/unknown.xbm
    src/httpd.1
    src/rfc931.h
    support/dbmmanage.mk
    support/dbmmanage.sh
    support/htpasswd.mk
    support/httpd_monitor.mk
    support/httpd_monitor.sh
    support/inc2shtml.mk
    support/logresolve.mk
    support/unescape.mk

Source changes are mainly to fit into the BSD/OS build environment
(pathnames, etc).  The exceptions are the mod_auth_dbm.c module
which I converted to use the Berkekley DB package and rfc931.c
which I did some cleanup on.

===================================================================
RCS file: /master/contrib/apache/cgi-bin/archie,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 archie
*** 1.1.1.1	1995/12/05 23:33:02
--- archie	1995/12/06 04:24:04
***************
*** 1,6 ****
  #!/bin/sh
  
! ARCHIE=/usr/local/bin/archie
  
  
  echo Content-type: text/html
--- 1,7 ----
  #!/bin/sh
+ #	BSDI	BSDI_CONTRIB,v 1.8 1995/12/11 21:12:58 sanders Exp
  
! ARCHIE=/usr/contrib/bin/archie
  
  
  echo Content-type: text/html
===================================================================
RCS file: /master/contrib/apache/cgi-bin/calendar,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 calendar
*** 1.1.1.1	1995/12/05 23:33:02
--- calendar	1995/12/06 04:30:06
***************
*** 1,6 ****
  #!/bin/sh
  
! CAL=/bin/cal
  
  echo Content-type: text/html
  echo
--- 1,7 ----
  #!/bin/sh
+ #	BSDI	BSDI_CONTRIB,v 1.8 1995/12/11 21:12:58 sanders Exp
  
! CAL=/usr/bin/cal
  
  echo Content-type: text/html
  echo
===================================================================
RCS file: /master/contrib/apache/cgi-bin/finger,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 finger
*** 1.1.1.1	1995/12/05 23:33:02
--- finger	1995/12/06 04:30:07
***************
*** 1,6 ****
  #!/bin/sh
  
! FINGER=/usr/ucb/finger
  
  echo Content-type: text/html
  echo
--- 1,7 ----
  #!/bin/sh
+ #	BSDI	BSDI_CONTRIB,v 1.8 1995/12/11 21:12:58 sanders Exp
  
! FINGER=/usr/bin/finger
  
  echo Content-type: text/html
  echo
===================================================================
RCS file: /master/contrib/apache/cgi-bin/test-cgi.tcl,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 test-cgi.tcl
*** 1.1.1.1	1995/12/05 23:33:02
--- test-cgi.tcl	1995/12/06 04:24:05
***************
*** 1,4 ****
! #!/usr/local/bin/tclsh
  # tcl-cgi.tcl
  # robert.bagwill@nist.gov, no warranty, no rights reserved
  # print out command line args, stdin, and environment variables
--- 1,5 ----
! #!/usr/contrib/bin/tclsh
! #	BSDI	BSDI_CONTRIB,v 1.8 1995/12/11 21:12:58 sanders Exp
  # tcl-cgi.tcl
  # robert.bagwill@nist.gov, no warranty, no rights reserved
  # print out command line args, stdin, and environment variables
===================================================================
RCS file: /master/contrib/apache/cgi-bin/uptime,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 uptime
*** 1.1.1.1	1995/12/05 23:33:03
--- uptime	1995/12/06 04:30:08
***************
*** 1,6 ****
  #!/bin/sh
  
! UPTIME=/usr/ucb/uptime
  
  echo Content-type: text/plain
  echo
--- 1,7 ----
  #!/bin/sh
+ #	BSDI	BSDI_CONTRIB,v 1.8 1995/12/11 21:12:58 sanders Exp
  
! UPTIME=/usr/bin/uptime
  
  echo Content-type: text/plain
  echo
===================================================================
RCS file: /master/contrib/apache/cgi-bin/wais.pl,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 wais.pl
*** 1.1.1.1	1995/12/05 23:33:03
--- wais.pl	1995/12/06 04:24:07
***************
*** 1,12 ****
! #!/usr/local/bin/perl
  #
  # wais.pl -- WAIS search interface
  #
  # wais.pl,v 1.2 1994/04/10 05:33:29 robm Exp
  #
! # Tony Sanders <sanders@bsdi.com>, Nov 1993
  #
! # Example configuration (in local.conf):
  #     map topdir wais.pl &do_wais($top, $path, $query, "database", "title")
  #
  
--- 1,14 ----
! #!/usr/bin/perl
! #	BSDI	BSDI_CONTRIB,v 1.8 1995/12/11 21:12:58 sanders Exp
  #
  # wais.pl -- WAIS search interface
  #
  # wais.pl,v 1.2 1994/04/10 05:33:29 robm Exp
  #
! # (orig by Tony Sanders <sanders@bsdi.com>, Nov 1993, for Plexus)
! # Modified by robm for NCSA HTTPD
  #
! # Example Plexus configuration (in local.conf):
  #     map topdir wais.pl &do_wais($top, $path, $query, "database", "title")
  #
  
===================================================================
RCS file: /master/contrib/apache/cgi-src/Makefile,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 Makefile
*** 1.1.1.1	1995/12/05 23:33:09
--- Makefile	1995/12/06 04:24:09
***************
*** 1,61 ****
! # For gcc
! CC= gcc
! # For ANSI compilers
! #CC= cc
! 
! #For Optimization
! #CFLAGS= -O2
! #For debugging
! CFLAGS= -g
! 
! RM= /bin/rm -f
! #--- You shouldn't have to edit anything else. ---
! 
! .c.o: 
! 	$(CC) -c $(CFLAGS) $<
! 
! all: query post-query imagemap jj phf
! 
! ibm:
! 	make all CC=gcc
! 
! sun:
! 	make all CC=gcc
! 
! hp: 
! 	make all CC=gcc
! 
! sgi:
! 	make all CC=cc
! 
! decmips:
! 	make all CC=cc
! 
! decaxp:
! 	make all CC=cc
! 
! tar: query post-query imagemap jj phf 
! 	$(RM) post-query.o util.o imagerect.o jj.o phf.o
! 
! post-query: post-query.o util.o
! 	$(CC) post-query.o util.o -o ../cgi-bin/post-query
! 
! query: query.o util.o
! 	$(CC) query.o util.o -o ../cgi-bin/query
! 
! imagemap: imagemap.o
! 	$(CC) imagemap.o -o ../cgi-bin/imagemap
! 
! jj: jj.o util.o
! 	$(CC) jj.o util.o -o ../cgi-bin/jj
! 
! phf: phf.o util.o
! 	$(CC) phf.o util.o -o ../cgi-bin/phf
! 
! change-passwd: change-passwd.o util.o
! 	$(CC) change-passwd.o util.o -o ../cgi-bin/change-passwd
! 
! 
! clean:
! 	rm -f *.o ../cgi-bin/post-query ../cgi-bin/query ../cgi-bin/change-passwd ../cgi-bin/phf ../cgi-bin/jj ../cgi-bin/imagemap
! 
--- 1,21 ----
! #	BSDI	BSDI_CONTRIB,v 1.8 1995/12/11 21:12:58 sanders Exp
! #
! # Multiple program support Makefile for BSDI build environment
! 
! MAKEFILES= \
!     change-passwd.mk \
!     imagemap.mk \
!     post-query.mk \
!     query.mk
! 
! all:
! 	@cd ${.CURDIR}; \
! 	for mkfile in ${MAKEFILES}; do \
! 	    ${MAKE} ${MFLAGS} -f $${mkfile} ${.TARGET}; \
! 	done
! 
! .DEFAULT:
! 	@cd ${.CURDIR}; \
! 	for mkfile in ${MAKEFILES}; do \
! 	    ${MAKE} ${MFLAGS} -f $${mkfile} ${.TARGET}; \
! 	done
===================================================================
RCS file: /master/contrib/apache/cgi-src/change-passwd.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 change-passwd.c
*** 1.1.1.1	1995/12/05 23:33:09
--- change-passwd.c	1995/12/06 04:10:06
***************
*** 5,11 ****
  #include <stdlib.h>
  #include <time.h>
  
! #define USER_FILE "/usr/local/etc/httpd/conf/.htpasswd"
  #define WIZARD "surobm"
  
  char *makeword(char *line, char stop);
--- 5,11 ----
  #include <stdlib.h>
  #include <time.h>
  
! #define USER_FILE "/var/www/conf/.htpasswd"
  #define WIZARD "surobm"
  
  char *makeword(char *line, char stop);
===================================================================
RCS file: /master/contrib/apache/cgi-src/imagemap.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 imagemap.c
*** 1.1.1.1	1995/12/05 23:33:09
--- imagemap.c	1995/12/06 04:10:27
***************
*** 55,61 ****
  #include <sys/types.h>
  #include <sys/stat.h>
  
! #define CONF_FILE "/usr/local/etc/httpd/conf/imagemap.conf"
  
  #define MAXLINE 500
  #define MAXVERTS 100
--- 55,61 ----
  #include <sys/types.h>
  #include <sys/stat.h>
  
! #define CONF_FILE "/var/www/conf/imagemap.conf"
  
  #define MAXLINE 500
  #define MAXVERTS 100
===================================================================
RCS file: /master/contrib/apache/conf/access.conf-dist,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 access.conf-dist
*** 1.1.1.1	1995/12/05 23:33:01
--- access.conf-dist	1995/12/06 04:14:22
***************
*** 11,23 ****
  # Originally by Rob McCool
  
  # /usr/local/etc/httpd/ should be changed to whatever you set ServerRoot to.
! <Directory /usr/local/etc/httpd/cgi-bin>
  Options Indexes FollowSymLinks
  </Directory>
  
  # This should be changed to whatever you set DocumentRoot to.
  
! <Directory /usr/local/etc/httpd/htdocs>
  
  # This may also be "None", "All", or any combination of "Indexes",
  # "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
--- 11,23 ----
  # Originally by Rob McCool
  
  # /usr/local/etc/httpd/ should be changed to whatever you set ServerRoot to.
! <Directory /var/www/cgi-bin>
  Options Indexes FollowSymLinks
  </Directory>
  
  # This should be changed to whatever you set DocumentRoot to.
  
! <Directory /var/www/docs>
  
  # This may also be "None", "All", or any combination of "Indexes",
  # "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
===================================================================
RCS file: /master/contrib/apache/conf/httpd.conf-dist,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 httpd.conf-dist
*** 1.1.1.1	1995/12/05 23:33:01
--- httpd.conf-dist	1995/12/06 04:21:17
***************
*** 23,40 ****
  
  # User/Group: The name (or #number) of the user/group to run httpd as.
  #  On SCO (ODT 3) use User nouser and Group nogroup
! User nobody
! Group #-1
  
  # ServerAdmin: Your address, where problems with the server should be
  # e-mailed.
  
! ServerAdmin you@your.address
  
  # ServerRoot: The directory the server's config, error, and log files
  # are kept in
  
! ServerRoot /usr/local/etc/httpd
  
  # BindAddress: You can support virtual hosts with this option. This option
  # is used to tell the server which IP address to listen to. It can either
--- 23,40 ----
  
  # User/Group: The name (or #number) of the user/group to run httpd as.
  #  On SCO (ODT 3) use User nouser and Group nogroup
! User www
! Group www
  
  # ServerAdmin: Your address, where problems with the server should be
  # e-mailed.
  
! ServerAdmin webmaster
  
  # ServerRoot: The directory the server's config, error, and log files
  # are kept in
  
! ServerRoot /var/www
  
  # BindAddress: You can support virtual hosts with this option. This option
  # is used to tell the server which IP address to listen to. It can either
***************
*** 103,109 ****
  # It is intended mainly as a brake to keep a runaway server from taking
  # Unix with it as it spirals down...
  
! MaxClients 150
  
  # MaxRequestsPerChild: the number of requests each child process is
  #  allowed to process before the child dies.
--- 103,109 ----
  # It is intended mainly as a brake to keep a runaway server from taking
  # Unix with it as it spirals down...
  
! MaxClients 60
  
  # MaxRequestsPerChild: the number of requests each child process is
  #  allowed to process before the child dies.
***************
*** 112,118 ****
  #  isn't really needed, but a few (such as Solaris) do have notable leaks
  #  in the libraries.
  
! MaxRequestsPerChild 30
  
  # VirtualHost: Allows the daemon to respond to requests for more than one
  # server address, if your server machine is configured to accept IP packets
--- 112,118 ----
  #  isn't really needed, but a few (such as Solaris) do have notable leaks
  #  in the libraries.
  
! MaxRequestsPerChild 32
  
  # VirtualHost: Allows the daemon to respond to requests for more than one
  # server address, if your server machine is configured to accept IP packets
===================================================================
RCS file: /master/contrib/apache/conf/mime.types,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 mime.types
*** 1.1.1.1	1995/12/05 23:33:01
--- mime.types	1995/12/06 04:24:27
***************
*** 1,66 ****
! # This is a comment. I love comments.
! 
! 
  application/activemessage
! application/andrew-inset                       
  application/applefile
! application/atomicmail                         
! application/dca-rft                            
! application/dec-dx                             
  application/mac-binhex40
  application/macwriteii
  application/msword
! application/news-message-id                    
! application/news-transmission                  
! application/octet-stream       bin             
! application/oda                oda
! application/pdf                pdf
! application/postscript         ai eps ps       
! application/remote-printing                    
! application/rtf                rtf             
! application/slate                              
! application/x-mif      mif
! application/wita                               
  application/wordperfect5.1
! application/x-csh              csh             
! application/x-dvi              dvi             
! application/x-hdf              hdf             
! application/x-latex            latex           
! application/x-netcdf           nc cdf          
! application/x-sh               sh              
! application/x-tcl              tcl             
! application/x-tex              tex             
! application/x-texinfo          texinfo texi   
! application/x-troff            t tr roff       
! application/x-troff-man        man             
! application/x-troff-me         me              
! application/x-troff-ms         ms              
! application/x-wais-source      src             
! application/zip                zip             
! application/x-bcpio            bcpio           
! application/x-cpio             cpio            
! application/x-gtar             gtar            
! application/x-shar             shar            
! application/x-sv4cpio          sv4cpio         
! application/x-sv4crc           sv4crc          
! application/x-tar              tar             
! application/x-ustar            ustar           
! audio/basic                    au snd          
! audio/x-aiff                   aif aiff aifc
! audio/x-wav                    wav             
! image/gif                      gif             
! image/ief                      ief             
! image/jpeg                     jpeg jpg jpe
! image/tiff                     tiff tif        
! image/x-cmu-raster             ras
! image/x-portable-anymap        pnm             
! image/x-portable-bitmap        pbm             
! image/x-portable-graymap       pgm             
! image/x-portable-pixmap        ppm             
! image/x-rgb                    rgb
! image/x-xbitmap                xbm             
! image/x-xpixmap                xpm             
! image/x-xwindowdump            xwd             
  message/external-body
  message/news
  message/partial
--- 1,69 ----
! #	BSDI	BSDI_CONTRIB,v 1.8 1995/12/11 21:12:58 sanders Exp
! #
! # File Extension -> MIME Type configuration file
! #
! # MIME Type			File Extension(s)
! # ----------------------------	--------------------
  application/activemessage
! application/andrew-inset
  application/applefile
! application/atomicmail
! application/dca-rft
! application/dec-dx
  application/mac-binhex40
  application/macwriteii
  application/msword
! application/news-message-id
! application/news-transmission
! application/octet-stream	bin
! application/oda			oda
! application/pdf			pdf
! application/postscript		ai	eps	ps
! application/remote-printing
! application/rtf			rtf
! application/slate
! application/wita
  application/wordperfect5.1
! application/x-bcpio		bcpio
! application/x-cpio		cpio
! application/x-csh		csh
! application/x-dvi		dvi
! application/x-gtar		gtar
! application/x-hdf		hdf
! application/x-latex		latex
! application/x-mif		mif
! application/x-netcdf		nc	cdf
! application/x-sh		sh
! application/x-shar		shar
! application/x-sv4cpio		sv4cpio
! application/x-sv4crc		sv4crc
! application/x-tar		tar
! application/x-tcl		tcl
! application/x-tex		tex
! application/x-texinfo		texinfo	texi
! application/x-troff		t	tr	roff
! application/x-troff-man		man
! application/x-troff-me		me
! application/x-troff-ms		ms
! application/x-ustar		ustar
! application/x-wais-source	src
! application/zip			zip
! audio/basic			au	snd
! audio/x-aiff			aif	aiff	aifc
! audio/x-wav			wav
! image/gif			gif
! image/ief			ief
! image/jpeg			jpeg	jpg	jpe
! image/tiff			tiff	tif
! image/x-cmu-raster		ras
! image/x-portable-anymap		pnm
! image/x-portable-bitmap		pbm
! image/x-portable-graymap	pgm
! image/x-portable-pixmap		ppm
! image/x-rgb			rgb
! image/x-xbitmap			xbm
! image/x-xpixmap			xpm
! image/x-xwindowdump		xwd
  message/external-body
  message/news
  message/partial
***************
*** 70,82 ****
  multipart/digest
  multipart/mixed
  multipart/parallel
! text/html                      html
! text/plain                     txt
! text/richtext                  rtx             
! text/tab-separated-values      tsv             
! text/x-setext                  etx             
! video/mpeg                     mpeg mpg mpe    
! video/quicktime                qt mov          
! video/x-msvideo                avi             
! video/x-sgi-movie              movie           
! 
--- 73,84 ----
  multipart/digest
  multipart/mixed
  multipart/parallel
! text/html			html
! text/plain			txt
! text/richtext			rtx
! text/tab-separated-values	tsv
! text/x-setext			etx
! video/mpeg			mpeg	mpg	mpe
! video/quicktime			qt	mov
! video/x-msvideo			avi
! video/x-sgi-movie		movie
===================================================================
RCS file: /master/contrib/apache/conf/srm.conf-dist,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 srm.conf-dist
*** 1.1.1.1	1995/12/05 23:33:01
--- srm.conf-dist	1995/12/06 04:15:27
***************
*** 12,18 ****
  # documents. By default, all requests are taken from this directory, but
  # symbolic links and aliases may be used to point to other locations.
  
! DocumentRoot /usr/local/etc/httpd/htdocs
  
  # UserDir: The name of the directory which is appended onto a user's home
  # directory if a ~user request is recieved.
--- 12,18 ----
  # documents. By default, all requests are taken from this directory, but
  # symbolic links and aliases may be used to point to other locations.
  
! DocumentRoot /var/www/docs
  
  # UserDir: The name of the directory which is appended onto a user's home
  # directory if a ~user request is recieved.
***************
*** 118,129 ****
  # Aliases: Add here as many aliases as you need (with no limit). The format is 
  # Alias fakename realname
  
! Alias /icons/ /usr/local/etc/httpd/icons/
  
  # ScriptAlias: This controls which directories contain server scripts.
  # Format: ScriptAlias fakename realname
  
! ScriptAlias /cgi-bin/ /usr/local/etc/httpd/cgi-bin/
  
  # If you want to use server side includes, or CGI outside
  # ScriptAliased directories, uncomment the following lines.
--- 118,129 ----
  # Aliases: Add here as many aliases as you need (with no limit). The format is 
  # Alias fakename realname
  
! Alias /icons/ /var/www/icons/
  
  # ScriptAlias: This controls which directories contain server scripts.
  # Format: ScriptAlias fakename realname
  
! ScriptAlias /cgi-bin/ /var/www/cgi-bin/
  
  # If you want to use server side includes, or CGI outside
  # ScriptAliased directories, uncomment the following lines.
===================================================================
RCS file: /master/contrib/apache/src/Configuration,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 Configuration
*** 1.1.1.1	1995/12/05 23:32:50
--- Configuration	1995/12/06 04:24:57
***************
*** 1,3 ****
--- 1,5 ----
+ #	BSDI	BSDI_CONTRIB,v 1.8 1995/12/11 21:12:58 sanders Exp
+ 
  # Config file for the Apache httpd.
  
  # There are three types of lines here:
***************
*** 16,22 ****
  # CC= cc
  # For Suns or other non-ANSI platforms. Please make sure your gcc is
  # 2.0 or later, as 1.40 seems to create bad code for the Sun 4.
! CC= gcc
  
  # CFLAGS, compile flags.
  
--- 18,26 ----
  # CC= cc
  # For Suns or other non-ANSI platforms. Please make sure your gcc is
  # 2.0 or later, as 1.40 seems to create bad code for the Sun 4.
! 
! # BSDI BSD/OS
! CC= shlicc
  
  # CFLAGS, compile flags.
  
***************
*** 33,40 ****
  #  may be configured out by changing the module config below, though it still
  #  defaults in.  Note that this config file does not include DBM auth by
  #  default --- configure it in below if you need it].
  
! CFLAGS= -O2
  
  # Place here any flags you may need upon linking, such as a flag to
  # prevent dynamic linking (if desired)
--- 37,45 ----
  #  may be configured out by changing the module config below, though it still
  #  defaults in.  Note that this config file does not include DBM auth by
  #  default --- configure it in below if you need it].
+ # -DAUTHDB will cause mod_auth_dbm to use the newer DB interfaces
  
! CFLAGS= -O2 -DAUTHDB
  
  # Place here any flags you may need upon linking, such as a flag to
  # prevent dynamic linking (if desired)
***************
*** 48,55 ****
  # NOTE: IF YOU DO NOT CHOOSE ONE OF THESE, EDIT httpd.h AND CHOOSE
  # SETTINGS FOR THE SYSTEM FLAGS. IF YOU DON'T, BAD THINGS WILL HAPPEN.
  
  # For SunOS 4
! AUX_CFLAGS= -DSUNOS4
  # For Solaris 2.
  #AUX_CFLAGS= -DSOLARIS2
  #AUX_LIBS= -lsocket -lnsl
--- 53,63 ----
  # NOTE: IF YOU DO NOT CHOOSE ONE OF THESE, EDIT httpd.h AND CHOOSE
  # SETTINGS FOR THE SYSTEM FLAGS. IF YOU DON'T, BAD THINGS WILL HAPPEN.
  
+ # BSDI BSD/OS
+ AUX_CFLAGS=
+ 
  # For SunOS 4
! #AUX_CFLAGS= -DSUNOS4
  # For Solaris 2.
  #AUX_CFLAGS= -DSOLARIS2
  #AUX_LIBS= -lsocket -lnsl
***************
*** 126,132 ****
  
  Module asis_module        mod_asis.o
  Module imap_module        mod_imap.o
! # Module dbm_auth_module  mod_auth_dbm.o
  
  # Optional modules for *full* NCSA compatibility --- we think these log
  # files are a bad idea, but reasonable people seem to disagree:
--- 134,140 ----
  
  Module asis_module        mod_asis.o
  Module imap_module        mod_imap.o
! Module dbm_auth_module    mod_auth_dbm.o
  
  # Optional modules for *full* NCSA compatibility --- we think these log
  # files are a bad idea, but reasonable people seem to disagree:
***************
*** 141,147 ****
  # aren't coming in via proxy.
  
  # Module dld_module     mod_dld.o
! # Module cookies_module mod_cookies.o
  
  # Finally, this is a *replacement* for mod_log_common which 
  # supports a LogFormat directive which allows you to specify what
--- 149,155 ----
  # aren't coming in via proxy.
  
  # Module dld_module     mod_dld.o
! Module cookies_module mod_cookies.o
  
  # Finally, this is a *replacement* for mod_log_common which 
  # supports a LogFormat directive which allows you to specify what
===================================================================
RCS file: /master/contrib/apache/src/Makefile,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 Makefile
*** 1.1.1.1	1995/12/05 23:32:50
--- Makefile	1995/12/06 04:24:59
***************
*** 1,128 ****
! # Makefile for the Apache httpd. 
  
! # For normal machines with ANSI compilers
! # CC= cc
! # For Suns or other non-ANSI platforms. Please make sure your gcc is
! # 2.0 or later, as 1.40 seems to create bad code for the Sun 4.
! CC= gcc -Wall
! 
! # CFLAGS, compile flags.
! 
! # If you want no reverse hostname resolution, use -DMINIMAL_DNS
! # If you want to have more secure hostname resolution at the cost of some 
! # performance, use -DMAXIMUM_DNS
! 
! #CFLAGS= -O2 
! CFLAGS= -g 
! 
! # Modules precompiled with the server.  Note that these must also be
! # in the list in modules.c in order to be active.
! 
! MODULES = mod_mime.o mod_access.o mod_alias.o mod_cgi.o mod_include.o \
! 	mod_dir.o mod_auth.o mod_auth_dbm.o mod_negotiation.o mod_userdir.o \
! 	mod_log_common.o mod_asis.o
! 
! # Place here any extra libraries you may need to link to. 
! # If you want DBM auth, -lndbm is commonly required.
! EXTRA_LIBS=
! 
! # AUX_CFLAGS are system-specific control flags.
! # NOTE: IF YOU DO NOT CHOOSE ONE OF THESE, EDIT httpd.h AND CHOOSE
! # SETTINGS FOR THE SYSTEM FLAGS. IF YOU DON'T, BAD THINGS WILL HAPPEN.
! 
! # For SunOS 4
! AUX_CFLAGS= -DSUNOS4
! # For Solaris 2.
! # AUX_CFLAGS= -DSOLARIS2 -DFCNTL_SERIALIZED_ACCEPT
! # EXTRA_LIBS= -lsocket -lnsl
! # For SGI IRIX. Use the EXTRA_LIBS line if you're using NIS and want
! # user-supported directories
! #AUX_CFLAGS= -DIRIX -DFCNTL_SERIALIZED_ACCEPT
! #EXTRA_LIBS= -lsun
! # For HP-UX
! #AUX_CFLAGS= -DHPUX
! # For AIX
! #AUX_CFLAGS= -DAIX -U__STR__
! # For Ultrix
! #AUX_CFLAGS= -DULTRIX
! # For DEC OSF/1
! #AUX_CFLAGS= -DOSF1
! # For NeXT
! #AUX_CFLAGS= -DNEXT
! # For Sequent
! #AUX_CFLAGS= -DSEQUENT
! # For Linux -m486 ONLY IF YOU HAVE 486 BINARY SUPPORT IN KERNEL
! #AUX_CFLAGS= -DLINUX -DFCNTL_SERIALIZED_ACCEPT
! # For A/UX
! #AUX_CFLAGS= -DAUX
! #EXTRA_LIBS= -lbsd -lposix -s
! # For SCO ODT
! # libcrypt_i available from sosco.sco.com, files /SLS/lng225b.Z and
! # /SLS/lng225b.ltr.Z
! #AUX_CFLAGS= -DSCO
! #EXTRA_LIBS= -lPW -lsocket -lmalloc -lcrypt_i
! # For SVR4
! #AUX_CFLAGS= -DSVR4
! #EXTRA_LIBS= -lsocket -lnsl -lc
! # For Amdahl UTS 2.1
! # -Xa enables ANSI mode, -eft is expanded types
! #AUX_CFLAGS= -Xa -eft -DUTS21
! #EXTRA_LIBS= -lsocket -lbsd -la
! # For HP/Apollo Domain/OS
! #AUX_CFLAGS= -DAPOLLO
! # For NetBSD/FreeBSD/BSDI 2.x
! # -m486 only if you are running on Intel 486/586
! #AUX_CFLAGS= -m486
! # BSDI doesn't need -lcrypt
! #EXTRA_LIBS= -lcrypt
! 
! # Place here any flags you may need upon linking, such as a flag to
! # prevent dynamic linking (if desired)
! LFLAGS= 
! 
! # You shouldn't have to edit anything else.
! 
! OBJS= alloc.o http_main.o http_core.o http_config.o http_request.o \
!   http_log.o http_protocol.o rfc931.o util.o util_script.o modules.o $(MODULES)
! 
! .c.o:
! 	$(CC) -c $(CFLAGS) $(AUX_CFLAGS) $<
! 
! all: httpd
! 
! httpd: $(OBJS)
! 	$(CC) $(LFLAGS) -o httpd $(OBJS) $(EXTRA_LIBS)
! 
! clean:
! 	rm -f httpd $(OBJS) *pure*
! 
! #Dependencies
! #Core code
! $(OBJS): Makefile httpd.h alloc.h conf.h
! 
! http_config.o http_core.o http_main.o util.o: http_conf_globals.h
! http_config.o http_core.o http_main.o: http_config.h http_log.h
! http_log.o http_protocol.o http_request.o modules.o: http_config.h
! http_config.o http_core.o http_protocol.o http_request.o: http_core.h
! http_protocol.o http_request.o util_script.o: http_log.h
! http_core.o http_main.o http_protocol.o http_request.o: http_main.h
! http_core.o http_main.o http_protocol.o http_request.o: http_protocol.h
! http_config.o http_main.o http_request.o: http_request.h
! http_main.o: scoreboard.h
! 
! #Modules
! $(MODULES): http_config.h
! mod_dld.o: http_conf_globals.h
! mod_ai_backcompat.o mod_auth.o mod_auth_dbm.o mod_cgi.o mod_dir.o: http_core.h
! mod_imap.o mod_include.o mod_negotiation.o: http_core.h
! mod_asis.o mod_auth.o mod_auth_dbm.o mod_cgi.o mod_dir.o: http_core.h
! mod_imap.o mod_include.o mod_negotiation.o: http_log.h
! mod_asis.o mod_cgi.o mod_dir.o mod_imap.o mod_include.o: http_main.h
! mod_asis.o mod_auth.o mod_auth_dbm.o mod_cgi.o mod_dir.o: http_protocol.h
! mod_imap.o mod_include.o: http_protocol.h
! mod_cgi.o mod_dir.o mod_imap.o mod_include.o mod_negotiation.o: http_request.h
! mod_asis.o mod_cgi.o mod_dir.o mod_imap.o mod_include.o: util_script.h
! 
! #Utils
! util.o: http_conf_globals.h
! util_script.o: http_core.h http_main.h http_protocol.h util_script.h
--- 1,17 ----
! #	BSDI	BSDI_CONTRIB,v 1.8 1995/12/11 21:12:58 sanders Exp
! #
! # This Makefile provided by BSDI for the BSDI build environment
! # but is compatible with that generated by the Apache configuration.
! # Running the Configure script will overwrite this Makefile with
! # the Apache version.
! CFLAGS+=-DAUTHDB
! PROG=httpd
! MODULES= \
!     mod_mime.c mod_access.c mod_auth.c mod_negotiation.c mod_include.c \
!     mod_dir.c mod_cgi.c mod_userdir.c mod_alias.c mod_log_common.c  \
!     mod_asis.c mod_imap.c mod_auth_dbm.c mod_cookies.c
! SRCS= $(MODULES) \
!     alloc.c http_main.c http_core.c http_config.c http_request.c \
!     http_log.c http_protocol.c rfc931.c util.c util_script.c modules.c
  
! .include <bsd.prog.mk>
===================================================================
RCS file: /master/contrib/apache/src/conf.h,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 conf.h
*** 1.1.1.1	1995/12/05 23:32:51
--- conf.h	1995/12/06 04:25:01
***************
*** 1,3 ****
--- 1,4 ----
+ /*	BSDI	BSDI_CONTRIB,v 1.8 1995/12/11 21:12:58 sanders Exp */
  
  /* ====================================================================
   * Copyright (c) 1995 The Apache Group.  All rights reserved.
***************
*** 330,335 ****
--- 331,340 ----
  
  #ifdef ultrix
  #define ULTRIX_BRAIN_DEATH
+ #endif
+ 
+ #ifdef ULTRIX_BRAIN_DEATH
+ #define NO_EXTERN_ANSI_PROTOTYPES
  #endif
  
  #ifndef S_ISLNK
===================================================================
RCS file: /master/contrib/apache/src/http_main.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 http_main.c
*** 1.1.1.1	1995/12/05 23:32:54
--- http_main.c	1995/12/06 04:25:03
***************
*** 1,3 ****
--- 1,4 ----
+ /*	BSDI	BSDI_CONTRIB,v 1.8 1995/12/11 21:12:58 sanders Exp */
  
  /* ====================================================================
   * Copyright (c) 1995 The Apache Group.  All rights reserved.
***************
*** 85,90 ****
--- 86,92 ----
  #include "http_protocol.h"	/* for read_request */
  #include "http_request.h"	/* for process_request */
  #include "http_conf_globals.h"
+ #include "rfc931.h"
  #include "scoreboard.h"
  #include <setjmp.h>
  
***************
*** 728,739 ****
      int clen;
      struct sockaddr sa_server;
      struct sockaddr sa_client;
- 
- #ifdef ULTRIX_BRAIN_DEATH
-     extern char *rfc931();
- #else
-     extern char *rfc931 (struct sockaddr_in *, struct sockaddr_in *);
- #endif
  
      csd = -1;
      dupped_csd = -1;
--- 730,735 ----
===================================================================
RCS file: /master/contrib/apache/src/httpd.h,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 httpd.h
*** 1.1.1.1	1995/12/05 23:32:52
--- httpd.h	1995/12/06 04:12:02
***************
*** 66,75 ****
  /* Define this to be the default server home dir. Anything later in this
   * file with a relative pathname will have this added.
   */
! #define HTTPD_ROOT "/usr/local/etc/httpd"
  
  /* Root of server */
! #define DOCUMENT_LOCATION "/usr/local/etc/httpd/htdocs"
  
  /* Max. number of dynamically loaded modules */
  #define DYNAMIC_MODULE_LIMIT 64
--- 66,75 ----
  /* Define this to be the default server home dir. Anything later in this
   * file with a relative pathname will have this added.
   */
! #define HTTPD_ROOT "/var/www"
  
  /* Root of server */
! #define DOCUMENT_LOCATION "/var/www/docs"
  
  /* Max. number of dynamically loaded modules */
  #define DYNAMIC_MODULE_LIMIT 64
***************
*** 132,138 ****
  #define DEFAULT_USER_DIR "public_html"
  
  /* The default path for CGI scripts if none is currently set */
! #define DEFAULT_PATH "/bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin"
  
  /* The path to the Bourne shell, for parsed docs */
  #define SHELL_PATH "/bin/sh"
--- 132,138 ----
  #define DEFAULT_USER_DIR "public_html"
  
  /* The default path for CGI scripts if none is currently set */
! #define DEFAULT_PATH "/bin:/usr/bin:/usr/contrib/bin:/usr/local/bin"
  
  /* The path to the Bourne shell, for parsed docs */
  #define SHELL_PATH "/bin/sh"
===================================================================
RCS file: /master/contrib/apache/src/mod_auth_dbm.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 mod_auth_dbm.c
*** 1.1.1.1	1995/12/05 23:32:57
--- mod_auth_dbm.c	1995/12/06 04:25:10
***************
*** 1,3 ****
--- 1,4 ----
+ /*	BSDI	BSDI_CONTRIB,v 1.8 1995/12/11 21:12:58 sanders Exp */
  
  /* ====================================================================
   * Copyright (c) 1995 The Apache Group.  All rights reserved.
***************
*** 58,63 ****
--- 59,65 ----
   * Rob McCool & Brian Behlendorf.
   * 
   * Adapted to Shambhala by rst.
+  * Adapted to conditionally support the DB package, sanders@bsdi.com, 8/30/95
   */
  
  #include "httpd.h"
***************
*** 65,71 ****
--- 67,77 ----
  #include "http_core.h"
  #include "http_log.h"
  #include "http_protocol.h"
+ #ifdef AUTHDB
+ #include <db.h>
+ #else
  #include <ndbm.h>
+ #endif
  
  typedef struct  {
  
***************
*** 91,96 ****
--- 97,130 ----
  
  module dbm_auth_module;
  
+ #ifdef AUTHDB
+ char *get_dbm_pw(request_rec *r, char *user, char *auth_dbmpwfile) {
+     DB *f; 
+     DBT d, q; 
+     char *pw = NULL;
+ 
+     q.data = user; 
+     q.size = strlen(q.data); 
+     
+     if(!(f=dbopen(auth_dbmpwfile,O_RDONLY,0664,DB_HASH,NULL))) {
+         log_reason ("could not open dbm auth file", auth_dbmpwfile, r);
+ 	return NULL;
+     }
+ 
+     (f->get)(f, &q, &d, 0);
+ 
+     if (d.data) {
+         pw = palloc (r->pool, d.size + 1);
+ 	strncpy(pw,d.data,d.size);
+ 	pw[d.size] = '\0';         /* Terminate the string */
+     }
+ 
+     (f->close)(f);
+     return pw; 
+ }
+ 
+ #else /* AUTHDB */
+ 
  char *get_dbm_pw(request_rec *r, char *user, char *auth_dbmpwfile) {
      DBM *f; 
      datum d, q; 
***************
*** 115,120 ****
--- 149,155 ----
      dbm_close(f);
      return pw; 
  }
+ #endif /* AUTHDB */
  
  /* We do something strange with the group file.  If the group file
   * contains any : we assume the format is
===================================================================
RCS file: /master/contrib/apache/src/modules.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 modules.c
*** 1.1.1.1	1995/12/05 23:33:00
--- modules.c	1995/12/06 01:30:26
***************
*** 1,36 ****
  #include "httpd.h"
  #include "http_config.h"
  
- /*
-  * This file just tells the core what other modules have been compiled
-  * in, so it knows to go out and configure them.  Someday, it might be
-  * automatically generated from a config file which is intelligible to
-  * J. Random Sysadmin...
-  */
- 
  extern module core_module;
  extern module mime_module;
  extern module access_module;
- extern module alias_module;
  extern module auth_module;
- extern module dbm_auth_module;
  extern module negotiation_module;
- extern module userdir_module;
- extern module cgi_module;
  extern module includes_module;
  extern module dir_module;
  extern module common_log_module;
  extern module asis_module;
! #ifdef DLD
! extern module dld_module;
! #endif
  
  module *prelinked_modules[] = {
    &core_module,
    &mime_module,
    &access_module,
    &auth_module,
-   &dbm_auth_module,
    &negotiation_module,
    &includes_module,
    &dir_module,
--- 1,31 ----
+ /* modules.c --- automatically generated by Apache
+  * configuration script.  DO NOT HAND EDIT!!!!!
+  */
+ 
  #include "httpd.h"
  #include "http_config.h"
  
  extern module core_module;
  extern module mime_module;
  extern module access_module;
  extern module auth_module;
  extern module negotiation_module;
  extern module includes_module;
  extern module dir_module;
+ extern module cgi_module;
+ extern module userdir_module;
+ extern module alias_module;
  extern module common_log_module;
  extern module asis_module;
! extern module imap_module;
! extern module dbm_auth_module;
! extern module cookies_module;
  
  module *prelinked_modules[] = {
    &core_module,
    &mime_module,
    &access_module,
    &auth_module,
    &negotiation_module,
    &includes_module,
    &dir_module,
***************
*** 39,46 ****
    &alias_module,
    &common_log_module,
    &asis_module,
! #ifdef DLD  
!   &dld_module,
! #endif  
!   NULL,
  };
--- 34,41 ----
    &alias_module,
    &common_log_module,
    &asis_module,
!   &imap_module,
!   &dbm_auth_module,
!   &cookies_module,
!   NULL
  };
===================================================================
RCS file: /master/contrib/apache/src/rfc931.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 rfc931.c
*** 1.1.1.1	1995/12/05 23:33:00
--- rfc931.c	1995/12/06 04:25:14
***************
*** 1,3 ****
--- 1,4 ----
+ /*	BSDI	BSDI_CONTRIB,v 1.8 1995/12/11 21:12:58 sanders Exp */
  
  /* ====================================================================
   * Copyright (c) 1995 The Apache Group.  All rights reserved.
***************
*** 51,297 ****
   *
   */
  
- 
  /*
   * rfc931() speaks a common subset of the RFC 931, AUTH, TAP and IDENT
   * protocols. The code queries an RFC 931 etc. compatible daemon on a remote
   * host to look up the owner of a connection. The information should not be
   * used for authentication purposes. This routine intercepts alarm signals.
   * 
-  * Diagnostics are reported through syslog(3).
-  * 
   * Author: Wietse Venema, Eindhoven University of Technology,
   * The Netherlands.
!  */
! 
! /* Some small additions for Shambhala --- ditch the "sccsid" var if
!  * compiling with gcc (it *has* changed), include conf.h for the
!  * prototypes it defines on at least one system (SunlOSs) which has
!  * them missing from the standard header files, and one minor change
!  * below (extra parens around assign "if (foo = bar) ..." to shut up
!  * gcc -Wall).
   */
  
  #include "conf.h"
  
! #ifdef NOTDEF			/* Has changed slightly... */
  static char sccsid[] = "@(#) rfc931.c 1.8 93/12/13 22:23:20";
  #endif
  
- #ifndef _HPUX_SOURCE
- #define _HPUX_SOURCE
- #endif
- 
  /* System libraries. */
  
  #include <stdio.h>
! #ifndef QNX
! #include <syslog.h>
  #endif
  #include <sys/types.h>
  #ifndef ULTRIX_BRAIN_DEATH
  #include <sys/socket.h>
  #endif
- #ifdef __bsdi__
- #if _BSDI_VERSION > 199312
- #include <netinet/in.h>
- #endif
- #else
  #include <netinet/in.h>
- #endif
- #include <setjmp.h>
- #include <signal.h>
- #ifndef NEXT
- #include <unistd.h>
- #endif
  
! #ifndef SCO
! extern char *strchr();
! extern char *inet_ntoa();
! #endif
! 
! /* Local stuff. */
! 
! /* #include "log_tcp.h" */
! 
! #define RFC931_TIMEOUT	500
  #define	RFC931_PORT	113		/* Semi-well-known port */
! #define	ANY_PORT	0		/* Any old port will do */
! #define FROM_UNKNOWN  "unknown"
! 
! int     rfc931_timeout = RFC931_TIMEOUT;/* Global so it can be changed */
! 
! static jmp_buf timebuf;
  
! #ifdef QNX
! 
! /*
! Gasp! QNX doesn't support syslog() (out of the box). Replace with output to
! stderr. Really, this module should use Apache error logging, but then it would
! need considerable hacking.
! 
! 9 Oct 95
! Ben Laurie <ben@algroup.co.uk>
! */
! #include <assert.h>
! 
! #define LOG_ERR 0
! 
! void syslog(int err,const char *str)
! {
!   char logbuf[200];
!   int n=ind(str,'%');
! 
!   assert(n >= 0);
!   memcpy(logbuf,str,n);
!   logbuf[n]='\0';
!   
!   fprintf(stderr,"%ssystem error %d",logbuf,errno);
! }
! 
! #endif /* def QNX */
! 
! /* fsocket - open stdio stream on top of socket */
! 
! static FILE *fsocket(domain, type, protocol)
! int     domain;
! int     type;
! int     protocol;
! {
!     int     s;
!     FILE   *fp;
! 
!     if ((s = socket(domain, type, protocol)) < 0) {
! 	syslog(LOG_ERR, "socket: %m");
! 	return (0);
!     } else {
! 	if ((fp = fdopen(s, "r+")) == 0) {
! 	    syslog(LOG_ERR, "fdopen: %m");
! 	    close(s);
! 	}
! 	return (fp);
!     }
! }
! 
! /* bind_connect - bind both ends of a socket */
! 
! int     bind_connect(s, local, remote, length)
! int     s;
! struct sockaddr *local;
! struct sockaddr *remote;
! int     length;
  {
!     if (bind(s, local, length) < 0) {
! 	syslog(LOG_ERR, "bind: %m");
! 	return (-1);
!     } else {
! 	return (connect(s, remote, length));
!     }
  }
  
! /* timeout - handle timeouts */
! 
! static void timeout(sig)
! int     sig;
  {
!     longjmp(timebuf, sig);
! }
  
! /* rfc931 - return remote user name, given socket structures */
  
! char   *rfc931(rmt_sin, our_sin)
! struct sockaddr_in *rmt_sin;
! struct sockaddr_in *our_sin;
! {
!     unsigned rmt_port;
!     unsigned our_port;
!     struct sockaddr_in rmt_query_sin;
!     struct sockaddr_in our_query_sin;
!     static char user[256];		/* XXX */
!     char    buffer[512];		/* XXX */
!     char   *cp;
!     static char *result;	/* XXX */
!     FILE   *fp;
! 
!     result = FROM_UNKNOWN;
!     /*
!      * Use one unbuffered stdio stream for writing to and for reading from
!      * the RFC931 etc. server. This is done because of a bug in the SunOS
!      * 4.1.x stdio library. The bug may live in other stdio implementations,
!      * too. When we use a single, buffered, bidirectional stdio stream ("r+"
!      * or "w+" mode) we read our own output. Such behaviour would make sense
!      * with resources that support random-access operations, but not with
!      * sockets.
!      */
  
!     if ((fp = fsocket(AF_INET, SOCK_STREAM, 0)) != 0) {
! 	setbuf(fp, (char *) 0);
  
  	/*
! 	 * Set up a timer so we won't get stuck while waiting for the server.
  	 */
  
! 	if (setjmp(timebuf) == 0) {
! 	    signal(SIGALRM, timeout);
! 	    alarm(rfc931_timeout);
! 
! 	    /*
! 	     * Bind the local and remote ends of the query socket to the same
! 	     * IP addresses as the connection under investigation. We go
! 	     * through all this trouble because the local or remote system
! 	     * might have more than one network address. The RFC931 etc.
! 	     * client sends only port numbers; the server takes the IP
! 	     * addresses from the query socket.
! 	     */
! 
! 	    our_query_sin = *our_sin;
! 	    our_query_sin.sin_port = htons(ANY_PORT);
! 	    rmt_query_sin = *rmt_sin;
! 	    rmt_query_sin.sin_port = htons(RFC931_PORT);
! 
! 	    if (bind_connect(fileno(fp),
! 			     (struct sockaddr *) & our_query_sin,
! 			     (struct sockaddr *) & rmt_query_sin,
! 			     sizeof(our_query_sin)) >= 0) {
! 
! 		/*
! 		 * Send query to server. Neglect the risk that a 13-byte
! 		 * write would have to be fragmented by the local system and
! 		 * cause trouble with buggy System V stdio libraries.
! 		 */
! 
! 		fprintf(fp, "%u,%u\r\n",
! 			ntohs(rmt_sin->sin_port),
! 			ntohs(our_sin->sin_port));
! 		fflush(fp);
! 
! 		/*
! 		 * Read response from server. Use fgets()/sscanf() so we can
! 		 * work around System V stdio libraries that incorrectly
! 		 * assume EOF when a read from a socket returns less than
! 		 * requested.
! 		 */
! 
! 		if (fgets(buffer, sizeof(buffer), fp) != 0
! 		    && ferror(fp) == 0 && feof(fp) == 0
! 		    && sscanf(buffer, "%u , %u : USERID :%*[^:]:%255s",
! 			      &rmt_port, &our_port, user) == 3
! 		    && ntohs(rmt_sin->sin_port) == rmt_port
! 		    && ntohs(our_sin->sin_port) == our_port) {
! 
! 		    /*
! 		     * Strip trailing carriage return. It is part of the
! 		     * protocol, not part of the data.
! 		     */
! 
! 		    if ((cp = strchr(user, '\r')))
! 			*cp = 0;
! 		    result = user;
! 		}
! 	    }
! 	    alarm(0);
! 	}
! 	fclose(fp);
      }
!     return (result);
  }
--- 52,184 ----
   *
   */
  
  /*
   * rfc931() speaks a common subset of the RFC 931, AUTH, TAP and IDENT
   * protocols. The code queries an RFC 931 etc. compatible daemon on a remote
   * host to look up the owner of a connection. The information should not be
   * used for authentication purposes. This routine intercepts alarm signals.
   * 
   * Author: Wietse Venema, Eindhoven University of Technology,
   * The Netherlands.
!  * Modified: Tony Sanders <sanders@earth.com>, September 15, 1995
   */
  
  #include "conf.h"
  
! #ifdef NOTDEF			/* Has changed a lot since this... */
  static char sccsid[] = "@(#) rfc931.c 1.8 93/12/13 22:23:20";
  #endif
  
  /* System libraries. */
  
  #include <stdio.h>
! #ifndef NEXT
! #include <unistd.h>
  #endif
+ #include <setjmp.h>
+ #include <signal.h>
+ #include <string.h>
+ #include <sys/param.h>
  #include <sys/types.h>
  #ifndef ULTRIX_BRAIN_DEATH
  #include <sys/socket.h>
  #endif
  #include <netinet/in.h>
  
! #define RFC931_TIMEOUT	500		/* default timeout (seconds) */
  #define	RFC931_PORT	113		/* Semi-well-known port */
! #define	RFC931_BUFLEN	512		/* must hold `%u , %u\r\n\0' */
  
! int rfc931_timeout = RFC931_TIMEOUT;		/* exported symbol */
! static char *rfc931_unknown = "unknown";	/* unknown result */
! static jmp_buf rfc931_jmpbuf;			/* timeout handler */
! 
! /* timeout -- handles SIGALRM */
! static void
! alarm_timeout(int sig)
  {
!     longjmp(rfc931_jmpbuf, sig);
  }
  
! /* rfc921 -- returns the remote user name */
! char *
! rfc931(struct sockaddr_in *remote_sin, struct sockaddr_in *local_sin)
  {
!     int s;
!     struct sockaddr_in remote_query_sin;
!     struct sockaddr_in local_query_sin;
!     unsigned remote_port;
!     unsigned local_port;
!     char buffer[RFC931_BUFLEN];
!     char scanbuf[80];				/* small sscanf fmt string */
!     static char user[RFC931_BUFLEN];		/* XXX: static buffer */
!     char *result;
! 
!     result = rfc931_unknown;
! 
!     if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0)
! 	return result;
! 
!     /* Set up timer so we won't get stuck while waiting for the server */
!     if (setjmp(rfc931_jmpbuf) == 0) {
! 	signal(SIGALRM, alarm_timeout);
! 	alarm(rfc931_timeout);
  
! 	/*
! 	 * Bind the local and remote ends of the query socket to the same
! 	 * IP addresses as the connection under investigation. We go
! 	 * through all this trouble because the local or remote system
! 	 * might have more than one network address. The RFC931 etc.
! 	 * client sends only port numbers; the server takes the IP
! 	 * addresses from the query socket.
! 	 */
  
! 	local_query_sin = *local_sin;
! 	local_query_sin.sin_port = htons(0);
! 	remote_query_sin = *remote_sin;
! 	remote_query_sin.sin_port = htons(RFC931_PORT);
! 
! 	if (bind(s, (struct sockaddr *)&local_query_sin,
! 		    sizeof(local_query_sin)) < 0)
! 	    return result;
! 
!         if (connect(s, (struct sockaddr *)&remote_query_sin,
! 		    sizeof(local_query_sin)) < 0)
! 	    return result;
! 
! 	/* Send query to server */
! 	sprintf(buffer, "%u , %u\r\n",
! 		ntohs(remote_sin->sin_port),
! 		ntohs(local_sin->sin_port));
! 	if (write(s, buffer, strlen(buffer)) == -1)
! 	    return result;
! 
! 	/* Read response from server */
! 	if (read(s, buffer, RFC931_BUFLEN-1) == -1)
! 	    return result;
  
! 	/* all done with network -- disable timeout alarm */
! 	alarm(0);
  
  	/*
! 	 * Return data format is:
! 	 *     lport , rport : reply_type : opsys_or_error : identifier
! 	 *
! 	 * "%d , %d : %[^ \t\r\n:] : %[^\t\r\n:] : %[^\r\n]"
  	 */
  
! 	sprintf(scanbuf, "%%u , %%u : USERID : %%*[^\t\r\n:] : %%%d[^\r\n]",
! 	    RFC931_BUFLEN-1);
! 	if (sscanf(buffer, scanbuf, &remote_port, &local_port, user) != 3)
! 	    return result;
! 
! 	/* sanity check port numbers */
! 	if ((ntohs(remote_sin->sin_port) != remote_port)
! 		    || (ntohs(local_sin->sin_port) != local_port))
! 	    return result;
! 
! 	result = user;
      }
! 
!     return result;
  }
===================================================================
RCS file: /master/contrib/apache/support/Makefile,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 Makefile
*** 1.1.1.1	1995/12/05 23:33:03
--- Makefile	1995/12/06 04:25:20
***************
*** 1,53 ****
! # For gcc
! CC= gcc
! # For ANSI compilers
! #CC= cc
! 
! #For Optimization
! #CFLAGS= -O2
! #For debugging
! CFLAGS= -g
! # For SCO ODT
! #EXTRA_LIBS= -lcrypt_i
! 
! RM= /bin/rm -f
! #--- You shouldn't have to edit anything else. ---
! 
! .c.o: 
! 	$(CC) -c $(CFLAGS) $<
! 
! all: htpasswd unescape inc2shtml
! 
! ibm: $(OBJS)
! 	make all CC=gcc
! 
! sun: $(OBJS)
! 	make all CC=gcc
! 
! hp: $(OBJS)
! 	make all CC=gcc
! 
! sgi: $(OBJS)
! 	make all CC=cc
! 
! decmips: $(OBJS)
! 	make all CC=cc
! 
! decaxp: $(OBJS)
! 	make all CC=cc
! 
! tar: htpasswd unescape
! 	$(RM) htpasswd unescape
! 
! htpasswd: htpasswd.c
! 	$(CC) $(CFLAGS) htpasswd.c -o htpasswd $(EXTRA_LIBS)
! 
! unescape: unescape.c
! 	$(CC) $(CFLAGS) unescape.c -o unescape
! 
! inc2shtml: inc2shtml.c
! 	$(CC) $(CFLAGS) inc2shtml.c -o inc2shtml
! 	
! clean:
! 	rm -f htpasswd unescape inc2shtml
! 
--- 1,23 ----
! #	BSDI	BSDI_CONTRIB,v 1.8 1995/12/11 21:12:58 sanders Exp
! #
! # Multiple program support Makefile for BSDI build environment
! 
! MAKEFILES= \
!     dbmmanage.mk \
!     htpasswd.mk \
!     httpd_monitor.mk \
!     inc2shtml.mk \
!     logresolve.mk \
!     unescape.mk
! 
! all:
! 	@cd ${.CURDIR}; \
! 	for mkfile in ${MAKEFILES}; do \
! 	    ${MAKE} ${MFLAGS} -f $${mkfile} ${.TARGET}; \
! 	done
! 
! .DEFAULT:
! 	@cd ${.CURDIR}; \
! 	for mkfile in ${MAKEFILES}; do \
! 	    ${MAKE} ${MFLAGS} -f $${mkfile} ${.TARGET}; \
! 	done
===================================================================
RCS file: /master/contrib/apache/support/logresolve.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 logresolve.c
*** 1.1.1.1	1995/12/05 23:33:03
--- logresolve.c	1995/12/06 03:25:33
***************
*** 267,272 ****
  
  	return (0);
  }
! -- end
  
  
--- 267,272 ----
  
  	return (0);
  }
! /* -- end */
  
  
