diff options
Diffstat (limited to 'support')
38 files changed, 0 insertions, 9359 deletions
diff --git a/support/.cvsignore b/support/.cvsignore deleted file mode 100644 index fa1c006478..0000000000 --- a/support/.cvsignore +++ /dev/null @@ -1,27 +0,0 @@ -.libs -*.lo -.deps -Makefile -*.mak -rotatelogs -htpasswd -htdigest -unescape -inc2shtml -httpd_monitor -suexec -logresolve -ab -apxs -Debug -Release -vc*.idb -*.opt -*.plg -*.pdb -apachectl -dbmmanage -log_server_status -logresolve.pl -split-logfile -phf_abuse_log.cgi diff --git a/support/.indent.pro b/support/.indent.pro deleted file mode 100644 index a9fbe9f9a1..0000000000 --- a/support/.indent.pro +++ /dev/null @@ -1,54 +0,0 @@ --i4 -npsl -di0 -br -nce -d0 -cli0 -npcs -nfc1 --TBUFF --TFILE --TTRANS --TUINT4 --T_trans --Tallow_options_t --Tapache_sfio --Tarray_header --Tbool_int --Tbuf_area --Tbuff_struct --Tbuffy --Tcmd_how --Tcmd_parms --Tcommand_rec --Tcommand_struct --Tconn_rec --Tcore_dir_config --Tcore_server_config --Tdir_maker_func --Tevent --Tglobals_s --Thandler_func --Thandler_rec --Tjoblist_s --Tlisten_rec --Tmerger_func --Tmode_t --Tmodule --Tmodule_struct --Tmutex --Tn_long --Tother_child_rec --Toverrides_t --Tparent_score --Tpid_t --Tpiped_log --Tpool --Trequest_rec --Trequire_line --Trlim_t --Tscoreboard --Tsemaphore --Tserver_addr_rec --Tserver_rec --Tserver_rec_chain --Tshort_score --Ttable --Ttable_entry --Tthread --Tu_wide_int --Tvtime_t --Twide_int diff --git a/support/Makefile.in b/support/Makefile.in deleted file mode 100644 index ff5f6a4e26..0000000000 --- a/support/Makefile.in +++ /dev/null @@ -1,46 +0,0 @@ -DISTCLEAN_TARGETS = apxs apachectl dbmmanage log_server_status logresolve.pl \ - phf_abuse_log.cgi split-logfile - -PROGRAMS = htpasswd htdigest rotatelogs logresolve ab -targets = $(PROGRAMS) - -PROGRAM_LDADD = $(EXTRA_LDFLAGS) $(PROGRAM_DEPENDENCIES) $(EXTRA_LIBS) -PROGRAM_DEPENDENCIES = \ - ../srclib/apr-util/libaprutil.la ../srclib/apr/libapr.la - -include $(top_srcdir)/build/rules.mk - -install: - @test -d $(bindir) || $(MKINSTALLDIRS) $(bindir) - @cp -p httpd.exp $(bindir) - @cp -p apachectl $(bindir) - chmod 755 $(bindir)/apachectl - @if test -f $(builddir)/apxs; then \ - cp -p apxs $(bindir); \ - chmod 755 $(bindir)/apxs; \ - fi - -htpasswd_OBJECTS = htpasswd.lo -htpasswd: $(htpasswd_OBJECTS) - $(LINK) $(htpasswd_OBJECTS) $(PROGRAM_LDADD) - -htdigest_OBJECTS = htdigest.lo -htdigest: $(htdigest_OBJECTS) - $(LINK) $(htdigest_OBJECTS) $(PROGRAM_LDADD) - -rotatelogs_OBJECTS = rotatelogs.lo -rotatelogs: $(rotatelogs_OBJECTS) - $(LINK) $(rotatelogs_OBJECTS) $(PROGRAM_LDADD) - -logresolve_OBJECTS = logresolve.lo -logresolve: $(logresolve_OBJECTS) - $(LINK) $(logresolve_OBJECTS) $(PROGRAM_LDADD) - -ab_OBJECTS = ab.lo -ab: $(ab_OBJECTS) - $(LINK) $(ab_OBJECTS) $(PROGRAM_LDADD) - -suexec_OBJECTS = suexec.lo -suexec: $(suexec_OBJECTS) - $(LINK) $(suexec_OBJECTS) $(PROGRAM_LDADD) - diff --git a/support/README b/support/README deleted file mode 100644 index 80e9cafde0..0000000000 --- a/support/README +++ /dev/null @@ -1,62 +0,0 @@ -Support files: - -ab - ABuse your server with this benchmarker. Rudimentary - command line testing tool. - -apachectl - Apache run-time Control script. To facilitate the - administrator and/or your rc.d scripts to control the - functioning of the Apache httpd daemon. - -apxs - APache eXtenSion tool. Eases building and installing - DSO style modules. - -dbmmanage - Create and update user authentication files in the faster - DBM format used by mod_auth_db. - -htdigest - Create and update user authentication files used in - DIGEST authentification. See mod_auth_digest. - -htpasswd - Create and update user authentication files used in - BASIC authentification. I.e. the htpasswd files. - See mod_auth. - -httpd.8 - General apache man page. - -log_server_status - This script is designed to be run at a frequent interval by something - like cron. It connects to the server and downloads the status - information. It reformats the information to a single line and logs - it to a file. - -logresolve - resolve hostnames for IP-adresses in Apache logfiles - -phf_abuse_log.cgi - This script can be used to detect people trying to abuse an ancient - and long plugged security hole which existed in a CGI script distributed - with Apache 1.0.3 and earlier versions. - -rotatelogs - rotate Apache logs without having to kill the server. - -split-logfile - This script will take a combined virtual hosts access - log file and break its contents into separate files. - -suexec - Switch User For Exec. Used internally by apache, - see the document `Apache suEXEC Support' - under http://www.apache.org/docs/suexec.html . - -SHA1 - This directory includes some utilities to allow Apache 1.3.6 to - recognize passwords in SHA1 format, as used by Netscape web - servers. It is not installed by default. - diff --git a/support/SHA1/README.sha1 b/support/SHA1/README.sha1 deleted file mode 100644 index 3998e1fdd9..0000000000 --- a/support/SHA1/README.sha1 +++ /dev/null @@ -1,34 +0,0 @@ -This directory includes some utilities to allow Apache 1.3.6 to -recognize passwords in SHA1 format, as used by Netscape web servers. - -From Netscape's admin interface, export the password database to an -ldif file and then use convert.pl in this distribution to generate -apache style password files. - -Note: SHA1 support is useful for migration purposes, but is less - secure than Apache's password format, since Apache's (MD5) - password format uses a random eight character salt to generate - one of many possible hashes for the same password. Netscape - uses plain SHA1 without a salt, so the same password - will always generate the same hash, making it easier - to break since the search space is smaller. - -This code was contributed by Clinton Wong <clintdw@netcom.com>. - -README.sha1 - this file - -convert-sha1.pl - takes an ldif dump from Netscape's web server on - standard in, outputs apache htpasswd format on standard out. - - Usage: convert.pl < ldif > passwords - -htpasswd-sha1.pl - perl script to generate entries in apache htpasswd format. - - Usage: htpasswd-sha1.pl some_user some_password - -ldif-sha1.example - sample ldif dump with one sha1 password and one crypt password. - diff --git a/support/SHA1/convert-sha1.pl b/support/SHA1/convert-sha1.pl deleted file mode 100644 index 35228022a0..0000000000 --- a/support/SHA1/convert-sha1.pl +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/perl -w -use strict; - -# This is public domain code. Do whatever you want with it. -# It was originally included in Clinton Wong's Apache 1.3.6 SHA1/ldif -# patch distribution as sample code for converting accounts from -# ldif format (as used by Netscape web servers) to Apache password format. - -my $uid=''; -my $passwd=''; - -while (my $line = <>) { - chomp $line; - if ( $line =~ /uid:\s*(.+)/) { $uid = $1 } - if ( $line =~ /userpassword:\s*(\{\w+\}.+)/) { - $passwd = $1; - $passwd =~ s/^\{crypt\}//i; # Apache stores crypt without a magic string - } - - if (length($line)==0) { - - if (length $uid and length $passwd) { - print $uid, ':', $passwd, "\n"; - } # output if we have something to print - - $uid = ''; - $passwd = ''; - - } # if newline -} # while something to read - -# handle last entry if there isn't a newline before EOF - if (length $uid and length $passwd) { - print $uid, ':', $passwd, "\n"; -} - diff --git a/support/SHA1/htpasswd-sha1.pl b/support/SHA1/htpasswd-sha1.pl deleted file mode 100644 index ad624d1101..0000000000 --- a/support/SHA1/htpasswd-sha1.pl +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/perl -w -use strict; -# -# Utility which takes a username and password -# on the command line and generates a username -# sha1-encrytped password on the stdout. -# -# Typical useage: -# ./htpasswd-sha1.pl dirkx MySecret >> sha1-passwd -# -# This is public domain code. Do whatever you want with it. -# It was originally included in Clinton Wong's Apache 1.3.6 SHA1/ldif -# patch distribution as sample code for generating entries for -# Apache password files using SHA1. - -use MIME::Base64; # http://www.cpan.org/modules/by-module/MIME/ -use Digest::SHA1; # http://www.cpan.org/modules/by-module/MD5/ - -if ($#ARGV!=1) { die "Usage $0: user password\n" } - -print $ARGV[0], ':{SHA}', encode_base64( Digest::SHA1::sha1($ARGV[1]) ); - diff --git a/support/SHA1/ldif-sha1.example b/support/SHA1/ldif-sha1.example deleted file mode 100644 index b8fe917eaf..0000000000 --- a/support/SHA1/ldif-sha1.example +++ /dev/null @@ -1,19 +0,0 @@ -dn: cn=someuser -cn: someuser -sn: someuser -objectclass: top -objectclass: person -objectclass: organizationalPerson -objectclass: inetOrgPerson -uid: someuser -userpassword: {SHA}GvF+c3IdvgxAARuC7Uuxp9vjzik= - -dn: cn=anotheruser -cn: anotheruser -sn: anotheruser -objectclass: top -objectclass: person -objectclass: organizationalPerson -objectclass: inetOrgPerson -uid: anotheruser -userpassword: {crypt}eFnp.4sz5XnH6 diff --git a/support/ab.c b/support/ab.c deleted file mode 100644 index 55f382ac7c..0000000000 --- a/support/ab.c +++ /dev/null @@ -1,1670 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -/* - ** This program is based on ZeusBench V1.0 written by Adam Twiss - ** which is Copyright (c) 1996 by Zeus Technology Ltd. http://www.zeustech.net/ - ** - ** This software is provided "as is" and any express or implied waranties, - ** including but not limited to, the implied warranties of merchantability and - ** fitness for a particular purpose are disclaimed. In no event shall - ** Zeus Technology Ltd. be liable for any direct, indirect, incidental, special, - ** exemplary, or consequential damaged (including, but not limited to, - ** procurement of substitute good or services; loss of use, data, or profits; - ** or business interruption) however caused and on theory of liability. Whether - ** in contract, strict liability or tort (including negligence or otherwise) - ** arising in any way out of the use of this software, even if advised of the - ** possibility of such damage. - ** - */ - -/* - ** HISTORY: - ** - Originally written by Adam Twiss <adam@zeus.co.uk>, March 1996 - ** with input from Mike Belshe <mbelshe@netscape.com> and - ** Michael Campanella <campanella@stevms.enet.dec.com> - ** - Enhanced by Dean Gaudet <dgaudet@apache.org>, November 1997 - ** - Cleaned up by Ralf S. Engelschall <rse@apache.org>, March 1998 - ** - POST and verbosity by Kurt Sussman <kls@merlot.com>, August 1998 - ** - HTML table output added by David N. Welton <davidw@prosa.it>, January 1999 - ** - Added Cookie, Arbitrary header and auth support. <dirkx@webweaving.org>, April 1999 - ** Version 1.3d - ** - Increased version number - as some of the socket/error handling has - ** fundamentally changed - and will give fundamentally different results - ** in situations where a server is dropping requests. Therefore you can - ** no longer compare results of AB as easily. Hence the inc of the version. - ** They should be closer to the truth though. Sander & <dirkx@covalent.net>, End 2000. - ** - Fixed proxy functionality, added median/mean statistics, added gnuplot - ** output option, added _experimental/rudimentary_ SSL support. Added - ** confidence guestimators and warnings. Sander & <dirkx@covalent.net>, End 2000 - ** - Fixed serious int overflow issues which would cause realistic (longer - ** than a few minutes) run's to have wrong (but believable) results. Added - ** trapping of connection errors which influenced measurements. - ** Contributed by Sander Temme - <sctemme@covalent.net>, Early 2001 - ** Version 1.3e - ** - Changed timeout behavour during write to work whilst the sockets - ** are filling up and apr_write() does writes a few - but not all. - ** This will potentially change results. <dirkx@webweaving.org>, April 2001 - ** - */ - -/* - * BUGS: - * - * - uses strcpy/etc. - * - has various other poor buffer attacks related to the lazy parsing of - * response headers from the server - * - doesn't implement much of HTTP/1.x, only accepts certain forms of - * responses - * - (performance problem) heavy use of strstr shows up top in profile - * only an issue for loopback usage - */ - -#define AB_VERSION "1.3e" - -/* -------------------------------------------------------------------- */ - -#if 'A' != 0x41 -/* Hmmm... This source code isn't being compiled in ASCII. - * In order for data that flows over the network to make - * sense, we need to translate to/from ASCII. - */ -#define NOT_ASCII -#endif - -/* affects include files on Solaris */ -#define BSD_COMP - -#include "apr.h" -#include "apr_strings.h" -#include "apr_network_io.h" -#include "apr_file_io.h" -#include "apr_time.h" -#include "apr_getopt.h" -#include "apr_general.h" -#include <signal.h> -#include "apr_lib.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" -#if APR_HAVE_STDIO_H -#include <stdio.h> /* for EOF */ -#endif -#if APR_HAVE_STDLIB_H -#include <stdlib.h> -#endif - -#include "apr_base64.h" -#ifdef NOT_ASCII -#include "apr_xlate.h" -#endif -#if APR_HAVE_STDIO_H -#include <stdio.h> -#endif -#if APR_HAVE_STDLIB_H -#include <stdlib.h> - -#ifdef USE_SSL -#if ((!(RSAREF)) && (!(SYSSSL))) -/* Libraries on most systems.. */ -#include <openssl/rsa.h> -#include <openssl/crypto.h> -#include <openssl/x509.h> -#include <openssl/pem.h> -#include <openssl/err.h> -#include <openssl/ssl.h> -#else -/* Libraries for RSAref and SYSSSL */ -#include <rsa.h> -#include <crypto.h> -#include <x509.h> -#include <pem.h> -#include <err.h> -#include <ssl.h> -#endif -#endif - -#include <math.h> -#endif -#if APR_HAVE_CTYPE_H -#include <ctype.h> -#endif - -/* ------------------- DEFINITIONS -------------------------- */ - -#ifndef LLONG_MAX -#define AB_MAX APR_INT64_C(0x7fffffffffffffff) -#else -#define AB_MAX LLONG_MAX -#endif - -/* maximum number of requests on a time limited test */ -#define MAX_REQUESTS 50000 - -/* good old state hostname */ -#define STATE_UNCONNECTED 0 -#define STATE_CONNECTING 1 -#define STATE_READ 2 - -#define CBUFFSIZE (2048) - -struct connection { - apr_socket_t *aprsock; - int state; - int read; /* amount of bytes read */ - int bread; /* amount of body read */ - int rwrite, rwrote; /* keep pointers in what we write - across - * EAGAINs */ - int length; /* Content-Length value used for keep-alive */ - char cbuff[CBUFFSIZE]; /* a buffer to store server response header */ - int cbx; /* offset in cbuffer */ - int keepalive; /* non-zero if a keep-alive request */ - int gotheader; /* non-zero if we have the entire header in - * cbuff */ - apr_time_t start, /* Start of connection */ - connect, /* Connected, start writing */ - endwrite, /* Request written */ - beginread, /* First byte of input */ - done; /* Connection closed */ - - int socknum; -#ifdef USE_SSL - SSL *ssl; -#endif -}; - -struct data { -#ifdef USE_SSL - /* XXXX insert SSL timings */ -#endif - int read; /* number of bytes read */ - apr_time_t starttime; /* start time of connection in seconds since - * Jan. 1, 1970 */ - apr_interval_time_t waittime; /* Between writing request and reading - * response */ - apr_interval_time_t ctime; /* time in ms to connect */ - apr_interval_time_t time; /* time in ms for connection */ -}; - -#define ap_min(a,b) ((a)<(b))?(a):(b) -#define ap_max(a,b) ((a)>(b))?(a):(b) - -/* --------------------- GLOBALS ---------------------------- */ - -int verbosity = 0; /* no verbosity by default */ -int posting = 0; /* GET by default */ -int requests = 1; /* Number of requests to make */ -int heartbeatres = 100; /* How often do we say we're alive */ -int concurrency = 1; /* Number of multiple requests to make */ -int percentile = 1; /* Show percentile served */ -int confidence = 1; /* Show confidence estimator and warnings */ -int tlimit = 0; /* time limit in cs */ -int keepalive = 0; /* try and do keepalive connections */ -char servername[1024]; /* name that server reports */ -char *hostname; /* host name from URL */ -char *host_field; /* value of "Host:" header field */ -char path[1024]; /* path name */ -char postfile[1024]; /* name of file containing post data */ -char *postdata; /* *buffer containing data from postfile */ -apr_size_t postlen = 0; /* length of data to be POSTed */ -char content_type[1024]; /* content type to put in POST header */ -char cookie[1024], /* optional cookie line */ - auth[1024], /* optional (basic/uuencoded) - * authentification */ - hdrs[4096]; /* optional arbitrary headers */ -apr_port_t port; /* port number */ -char proxyhost[1024]; /* proxy host name */ -int proxyport = 0; /* proxy port */ -char connecthost[1024]; -int connectport; -char *gnuplot; /* GNUplot file */ -char *csvperc; /* CSV Percentile file */ -char url[1024]; -char fullurl[1024]; -int isproxy = 0; -apr_time_t aprtimeout = 30 * APR_USEC_PER_SEC; /* timeout value */ - /* - * XXX - this is now a per read/write transact type of value - */ - -int use_html = 0; /* use html in the report */ -const char *tablestring; -const char *trstring; -const char *tdstring; - -int doclen = 0; /* the length the document should be */ -long started = 0; /* number of requests started, so no excess */ -long totalread = 0; /* total number of bytes read */ -long totalbread = 0; /* totoal amount of entity body read */ -long totalposted = 0; /* total number of bytes posted, inc. headers */ -long done = 0; /* number of requests we have done */ -long doneka = 0; /* number of keep alive connections done */ -long good = 0, bad = 0; /* number of good and bad requests */ -long epipe = 0; /* number of broken pipe writes */ - -#ifdef USE_SSL -int ssl = 0; -SSL_CTX *ctx; -#endif - -/* store error cases */ -int err_length = 0, err_conn = 0, err_except = 0; -int err_response = 0; - -apr_time_t start, endtime; - -/* global request (and its length) */ -char _request[512]; -char *request = _request; -apr_size_t reqlen; - -/* one global throw-away buffer to read stuff into */ -char buffer[8192]; - -/* interesting percentiles */ -int percs[] = {50, 66, 75, 80, 90, 95, 98, 99, 100}; - -struct connection *con; /* connection array */ -struct data *stats; /* date for each request */ -apr_pool_t *cntxt; - -apr_pollfd_t *readbits; - -#ifdef NOT_ASCII -apr_xlate_t *from_ascii, *to_ascii; -#endif - -static void close_connection(struct connection * c); -/* --------------------------------------------------------- */ - -/* simple little function to write an error string and exit */ - -static void err(char *s) -{ - fprintf(stderr, "%s", s); - exit(1); -} - -/* simple little function to write an APR error string and exit */ - -static void apr_err(char *s, apr_status_t rv) -{ - char buf[120]; - - fprintf(stderr, - "%s: %s (%d)\n", - s, apr_strerror(rv, buf, sizeof buf), rv); - exit(rv); -} - -/* --------------------------------------------------------- */ -/* write out request to a connection - assumes we can write - * (small) request out in one go into our new socket buffer - * - */ -static void write_request(struct connection * c) -{ - do { - apr_time_t tnow = apr_time_now(); - apr_size_t l = c->rwrite; - apr_status_t e; - - /* - * First time round ? - */ - if (c->rwrite == 0) { - apr_setsocketopt(c->aprsock, APR_SO_TIMEOUT, 0); - c->connect = tnow; - c->rwrite = reqlen; - c->rwrote = 0; - if (posting) - c->rwrite += postlen; - } - else if (tnow > c->connect + aprtimeout) { - printf("Send request timed out!\n"); - close_connection(c); - return; - } - - e = apr_send(c->aprsock, request + c->rwrote, &l); - - /* - * Bail early on the most common case - */ - if (l == c->rwrite) - break; - - if (e != APR_SUCCESS) { - /* - * Let's hope this traps EWOULDBLOCK too ! - */ - if (!APR_STATUS_IS_EAGAIN(e)) { - epipe++; - printf("Send request failed!\n"); - close_connection(c); - } - return; - } - c->rwrote += l; - c->rwrite -= l; - } while (1); - - totalposted += c->rwrite; - c->state = STATE_READ; - c->endwrite = apr_time_now(); - apr_poll_socket_add(readbits, c->aprsock, APR_POLLIN); -} - -/* --------------------------------------------------------- */ - -/* calculate and output results */ - -static int compradre(struct data * a, struct data * b) -{ - if ((a->ctime) < (b->ctime)) - return -1; - if ((a->ctime) > (b->ctime)) - return +1; - return 0; -} - -static int comprando(struct data * a, struct data * b) -{ - if ((a->time) < (b->time)) - return -1; - if ((a->time) > (b->time)) - return +1; - return 0; -} - -static int compri(struct data * a, struct data * b) -{ - apr_interval_time_t p = a->time - a->ctime; - apr_interval_time_t q = b->time - b->ctime; - if (p < q) - return -1; - if (p > q) - return +1; - return 0; -} - -static int compwait(struct data * a, struct data * b) -{ - if ((a->waittime) < (b->waittime)) - return -1; - if ((a->waittime) > (b->waittime)) - return 1; - return 0; -} - -static void output_results(void) -{ - apr_interval_time_t timetakenusec; - float timetaken; - - endtime = apr_time_now(); - timetakenusec = endtime - start; - timetaken = (float) timetakenusec / APR_USEC_PER_SEC; - - printf("\r \r"); - printf("Server Software: %s\n", servername); - printf("Server Hostname: %s\n", hostname); - printf("Server Port: %hd\n", port); - printf("\n"); - printf("Document Path: %s\n", path); - printf("Document Length: %d bytes\n", doclen); - printf("\n"); - printf("Concurrency Level: %d\n", concurrency); - printf("Time taken for tests: %" APR_TIME_T_FMT ".%03" APR_TIME_T_FMT " seconds\n", - (apr_interval_time_t) timetakenusec / APR_USEC_PER_SEC, - (apr_interval_time_t) timetakenusec % APR_USEC_PER_SEC); - printf("Complete requests: %ld\n", done); - printf("Failed requests: %ld\n", bad); - if (bad) - printf(" (Connect: %d, Length: %d, Exceptions: %d)\n", - err_conn, err_length, err_except); - printf("Write errors: %ld\n", epipe); - if (err_response) - printf("Non-2xx responses: %d\n", err_response); - if (keepalive) - printf("Keep-Alive requests: %ld\n", doneka); - printf("Total transferred: %ld bytes\n", totalread); - if (posting > 0) - printf("Total POSTed: %ld\n", totalposted); - printf("HTML transferred: %ld bytes\n", totalbread); - - /* avoid divide by zero */ - if (timetaken) { - printf("Requests per second: %.2f [#/sec] (mean)\n", done / timetaken); - printf("Time per request: %.3f [ms] (mean)\n", concurrency * timetaken / done); - printf("Time per request: %.3f [ms] (mean, across all concurent requests)\n", - timetaken / done); - printf("Transfer rate: %.2f [Kbytes/sec] received\n", - totalread / 1024 / timetaken); - if (posting > 0) { - printf(" %.2f kb/s sent\n", - (float) totalposted / timetaken / 1024); - printf(" %.2f kb/s total\n", - (float) (totalread + totalposted) / timetaken / 1024); - } - } - - if (requests) { - /* work out connection times */ - long i; - double totalcon = 0, total = 0, totald = 0, totalwait = 0; - apr_interval_time_t mincon = AB_MAX, mintot = AB_MAX, mind = AB_MAX, - minwait = AB_MAX; - apr_interval_time_t maxcon = 0, maxtot = 0, maxd = 0, maxwait = 0; - apr_interval_time_t meancon = 0, meantot = 0, meand = 0, meanwait = 0; - double sdtot = 0, sdcon = 0, sdd = 0, sdwait = 0; - - for (i = 0; i < requests; i++) { - struct data s = stats[i]; - mincon = ap_min(mincon, s.ctime); - mintot = ap_min(mintot, s.time); - mind = ap_min(mind, s.time - s.ctime); - minwait = ap_min(minwait, s.waittime); - - maxcon = ap_max(maxcon, s.ctime); - maxtot = ap_max(maxtot, s.time); - maxd = ap_max(maxd, s.time - s.ctime); - maxwait = ap_max(maxwait, s.waittime); - - totalcon += s.ctime; - total += s.time; - totald += s.time - s.ctime; - totalwait += s.waittime; - } - totalcon /= requests; - total /= requests; - totald /= requests; - totalwait /= requests; - - for (i = 0; i < requests; i++) { - struct data s = stats[i]; - apr_interval_time_t a; - a = (s.time - total); - sdtot += a * a; - a = (s.ctime - totalcon); - sdcon += a * a; - a = (s.time - s.ctime - totald); - sdd += a * a; - a = (s.waittime - totalwait); - sdwait += a * a; - }; - - sdtot = (requests > 1) ? sqrt(sdtot / (requests - 1)) : 0; - sdcon = (requests > 1) ? sqrt(sdcon / (requests - 1)) : 0; - sdd = (requests > 1) ? sqrt(sdd / (requests - 1)) : 0; - sdwait = (requests > 1) ? sqrt(sdwait / (requests - 1)) : 0; - - if (gnuplot) { - FILE *out = fopen(gnuplot, "w"); - long i; - apr_time_t sttime; - char tmstring[1024];/* XXXX */ - if (!out) { - perror("Cannot open gnuplot output file"); - exit(1); - }; - fprintf(out, "starttime\tseconds\tctime\tdtime\tttime\twait\n"); - for (i = 0; i < requests; i++) { - sttime = stats[i].starttime; - (void) apr_ctime(tmstring, sttime); - tmstring[strlen(tmstring) - 1] = '\0'; /* ctime returns a - * string with a - * trailing newline */ - fprintf(out, "%s\t%" APR_TIME_T_FMT "\t%" APR_TIME_T_FMT "\t%" APR_TIME_T_FMT "\t%" APR_TIME_T_FMT "\t%" APR_TIME_T_FMT "\n", - tmstring, - sttime, - stats[i].ctime, - stats[i].time - stats[i].ctime, - stats[i].time, - stats[i].waittime); - } - fclose(out); - }; - /* - * XXX: what is better; this hideous cast of the copare function; or - * the four warnings during compile ? dirkx just does not know and - * hates both/ - */ - qsort(stats, requests, sizeof(struct data), - (int (*) (const void *, const void *)) compradre); - if ((requests > 1) && (requests % 2)) - meancon = (stats[requests / 2].ctime + stats[requests / 2 + 1].ctime) / 2; - else - meancon = stats[requests / 2].ctime; - - qsort(stats, requests, sizeof(struct data), - (int (*) (const void *, const void *)) compri); - if ((requests > 1) && (requests % 2)) - meand = (stats[requests / 2].time + stats[requests / 2 + 1].time \ - -stats[requests / 2].ctime - stats[requests / 2 + 1].ctime) / 2; - else - meand = stats[requests / 2].time - stats[requests / 2].ctime; - - qsort(stats, requests, sizeof(struct data), - (int (*) (const void *, const void *)) compwait); - if ((requests > 1) && (requests % 2)) - meanwait = (stats[requests / 2].waittime + stats[requests / 2 + 1].waittime) / 2; - else - meanwait = stats[requests / 2].waittime; - - qsort(stats, requests, sizeof(struct data), - (int (*) (const void *, const void *)) comprando); - if ((requests > 1) && (requests % 2)) - meantot = (stats[requests / 2].time + stats[requests / 2 + 1].time) / 2; - else - meantot = stats[requests / 2].time; - - printf("\nConnection Times (ms)\n"); - - if (confidence) { -#define CONF_FMT_STRING "%" APR_TIME_T_FMT " %5d %6.1f %" APR_TIME_T_FMT " %" APR_TIME_T_FMT "\n" - printf(" min mean[+/-sd] median max\n"); - printf("Connect: " CONF_FMT_STRING, - mincon, (int) (totalcon + 0.5), sdcon, meancon, maxcon); - printf("Processing: " CONF_FMT_STRING, - mind, (int) (totald + 0.5), sdd, meand, maxd); - printf("Waiting: " CONF_FMT_STRING, - minwait, (int) (totalwait + 0.5), sdwait, meanwait, maxwait); - printf("Total: " CONF_FMT_STRING, - mintot, (int) (total + 0.5), sdtot, meantot, maxtot); -#undef CONF_FMT_STRING - -#define SANE(what,avg,mean,sd) \ - { \ - double d = avg - mean; \ - if (d < 0) d = -d; \ - if (d > 2 * sd ) \ - printf("ERROR: The median and mean for " what " are more than twice the standard\n" \ - " deviation apart. These results are NOT reliable.\n"); \ - else if (d > sd ) \ - printf("WARING: The median and mean for " what " are not within a normal deviation\n" \ - " These results are propably not that reliable.\n"); \ - } - SANE("the initial connection time", totalcon, meancon, sdcon); - SANE("the processing time", totald, meand, sdd); - SANE("the waiting time", totalwait, meanwait, sdwait); - SANE("the total time", total, meantot, sdtot); - } - else { - printf(" min avg max\n"); -#define CONF_FMT_STRING "%5" APR_TIME_T_FMT " %5e %5" APR_TIME_T_FMT "\n" - printf("Connect: " CONF_FMT_STRING, mincon, totalcon / requests, - maxcon); - printf("Processing: " CONF_FMT_STRING, mintot - mincon, - (total / requests) - (totalcon / requests), maxtot - maxcon); - printf("Total: " CONF_FMT_STRING, mintot, total / requests, - maxtot); -#undef CONF_FMT_STRING - } - - - /* Sorted on total connect times */ - if (percentile && (requests > 1)) { - printf("\nPercentage of the requests served within a certain time (ms)\n"); - for (i = 0; i < sizeof(percs) / sizeof(int); i++) - if (percs[i] <= 0) - printf(" 0%% <0> (never)\n"); - else if (percs[i] >= 100) - printf(" 100%% %5" APR_TIME_T_FMT " (longest request)\n", - stats[requests - 1].time); - else - printf(" %d%% %5" APR_TIME_T_FMT "\n", - percs[i], stats[(int) (requests * percs[i] / 100)].time); - }; - if (csvperc) { - FILE *out = fopen(csvperc, "w"); - int i; - if (!out) { - perror("Cannot open CSV output file"); - exit(1); - }; - fprintf(out, "" "Percentage served" "," "Time in ms" "\n"); - for (i = 0; i < 100; i++) { - double d; - if (i == 0) - d = stats[0].time; - else if (i == 100) - d = stats[requests - 1].time; - else - d = stats[(int) (0.5 + requests * i / 100.0)].time; - fprintf(out, "%d,%e\n", i, d); - } - fclose(out); - }; - - } -} - -/* --------------------------------------------------------- */ - -/* calculate and output results in HTML */ - -static void output_html_results(void) -{ - long timetaken; - - endtime = apr_time_now(); - timetaken = (endtime - start) / 1000; - - printf("\n\n<table %s>\n", tablestring); - printf("<tr %s><th colspan=2 %s>Server Software:</th>" - "<td colspan=2 %s>%s</td></tr>\n", - trstring, tdstring, tdstring, servername); - printf("<tr %s><th colspan=2 %s>Server Hostname:</th>" - "<td colspan=2 %s>%s</td></tr>\n", - trstring, tdstring, tdstring, hostname); - printf("<tr %s><th colspan=2 %s>Server Port:</th>" - "<td colspan=2 %s>%hd</td></tr>\n", - trstring, tdstring, tdstring, port); - printf("<tr %s><th colspan=2 %s>Document Path:</th>" - "<td colspan=2 %s>%s</td></tr>\n", - trstring, tdstring, tdstring, path); - printf("<tr %s><th colspan=2 %s>Document Length:</th>" - "<td colspan=2 %s>%d bytes</td></tr>\n", - trstring, tdstring, tdstring, doclen); - printf("<tr %s><th colspan=2 %s>Concurrency Level:</th>" - "<td colspan=2 %s>%d</td></tr>\n", - trstring, tdstring, tdstring, concurrency); - printf("<tr %s><th colspan=2 %s>Time taken for tests:</th>" - "<td colspan=2 %s>%qd.%03qd seconds</td></tr>\n", - trstring, tdstring, tdstring, timetaken / APR_USEC_PER_SEC, timetaken % APR_USEC_PER_SEC); - printf("<tr %s><th colspan=2 %s>Complete requests:</th>" - "<td colspan=2 %s>%ld</td></tr>\n", - trstring, tdstring, tdstring, done); - printf("<tr %s><th colspan=2 %s>Failed requests:</th>" - "<td colspan=2 %s>%ld</td></tr>\n", - trstring, tdstring, tdstring, bad); - if (bad) - printf("<tr %s><td colspan=4 %s > (Connect: %d, Length: %d, Exceptions: %d)</td></tr>\n", - trstring, tdstring, err_conn, err_length, err_except); - if (err_response) - printf("<tr %s><th colspan=2 %s>Non-2xx responses:</th>" - "<td colspan=2 %s>%d</td></tr>\n", - trstring, tdstring, tdstring, err_response); - if (keepalive) - printf("<tr %s><th colspan=2 %s>Keep-Alive requests:</th>" - "<td colspan=2 %s>%ld</td></tr>\n", - trstring, tdstring, tdstring, doneka); - printf("<tr %s><th colspan=2 %s>Total transferred:</th>" - "<td colspan=2 %s>%ld bytes</td></tr>\n", - trstring, tdstring, tdstring, totalread); - if (posting > 0) - printf("<tr %s><th colspan=2 %s>Total POSTed:</th>" - "<td colspan=2 %s>%ld</td></tr>\n", - trstring, tdstring, tdstring, totalposted); - printf("<tr %s><th colspan=2 %s>HTML transferred:</th>" - "<td colspan=2 %s>%ld bytes</td></tr>\n", - trstring, tdstring, tdstring, totalbread); - - /* avoid divide by zero */ - if (timetaken) { - printf("<tr %s><th colspan=2 %s>Requests per second:</th>" - "<td colspan=2 %s>%.2f</td></tr>\n", - trstring, tdstring, tdstring, 1000 * (float) (done) / timetaken); - printf("<tr %s><th colspan=2 %s>Transfer rate:</th>" - "<td colspan=2 %s>%.2f kb/s received</td></tr>\n", - trstring, tdstring, tdstring, (float) (totalread) / timetaken); - if (posting > 0) { - printf("<tr %s><td colspan=2 %s> </td>" - "<td colspan=2 %s>%.2f kb/s sent</td></tr>\n", - trstring, tdstring, tdstring, - (float) (totalposted) / timetaken); - printf("<tr %s><td colspan=2 %s> </td>" - "<td colspan=2 %s>%.2f kb/s total</td></tr>\n", - trstring, tdstring, tdstring, - (float) (totalread + totalposted) / timetaken); - } - } { - /* work out connection times */ - long i; - apr_interval_time_t totalcon = 0, total = 0; - apr_interval_time_t mincon = AB_MAX, mintot = AB_MAX; - apr_interval_time_t maxcon = 0, maxtot = 0; - - for (i = 0; i < requests; i++) { - struct data s = stats[i]; - mincon = ap_min(mincon, s.ctime); - mintot = ap_min(mintot, s.time); - maxcon = ap_max(maxcon, s.ctime); - maxtot = ap_max(maxtot, s.time); - totalcon += s.ctime; - total += s.time; - } - - if (requests > 0) { /* avoid division by zero (if 0 requests) */ - printf("<tr %s><th %s colspan=4>Connnection Times (ms)</th></tr>\n", - trstring, tdstring); - printf("<tr %s><th %s> </th> <th %s>min</th> <th %s>avg</th> <th %s>max</th></tr>\n", - trstring, tdstring, tdstring, tdstring, tdstring); - printf("<tr %s><th %s>Connect:</th>" - "<td %s>%5" APR_TIME_T_FMT "</td>" - "<td %s>%5" APR_TIME_T_FMT "</td>" - "<td %s>%5" APR_TIME_T_FMT "</td></tr>\n", - trstring, tdstring, tdstring, mincon, tdstring, totalcon / requests, tdstring, maxcon); - printf("<tr %s><th %s>Processing:</th>" - "<td %s>%5" APR_TIME_T_FMT "</td>" - "<td %s>%5" APR_TIME_T_FMT "</td>" - "<td %s>%5" APR_TIME_T_FMT "</td></tr>\n", - trstring, tdstring, tdstring, mintot - mincon, tdstring, - (total / requests) - (totalcon / requests), tdstring, maxtot - maxcon); - printf("<tr %s><th %s>Total:</th>" - "<td %s>%5" APR_TIME_T_FMT "</td>" - "<td %s>%5" APR_TIME_T_FMT "</td>" - "<td %s>%5" APR_TIME_T_FMT "</td></tr>\n", - trstring, tdstring, tdstring, mintot, tdstring, total / requests, tdstring, maxtot); - } - printf("</table>\n"); - } -} - -/* --------------------------------------------------------- */ - -/* start asnchronous non-blocking connection */ - -static void start_connect(struct connection * c) -{ - apr_status_t rv; - apr_sockaddr_t *destsa; - - if (!(started < requests)) - return; - - c->read = 0; - c->bread = 0; - c->keepalive = 0; - c->cbx = 0; - c->gotheader = 0; - c->rwrite = 0; - - if ((rv = apr_sockaddr_info_get(&destsa, connecthost, APR_UNSPEC, connectport, 0, cntxt)) - != APR_SUCCESS) { - char buf[120]; - apr_snprintf(buf, sizeof(buf), - "apr_sockaddr_info_get() for %s", connecthost); - apr_err(buf, rv); - } - if ((rv = apr_socket_create(&c->aprsock, destsa->sa.sin.sin_family, - SOCK_STREAM, cntxt)) != APR_SUCCESS) { - apr_err("socket", rv); - } - c->start = apr_time_now(); - if ((rv = apr_connect(c->aprsock, destsa)) != APR_SUCCESS) { - if (APR_STATUS_IS_EINPROGRESS(rv)) { - c->state = STATE_CONNECTING; - c->rwrite = 0; - apr_poll_socket_add(readbits, c->aprsock, APR_POLLOUT); - return; - } - else { - apr_poll_socket_remove(readbits, c->aprsock); - apr_socket_close(c->aprsock); - err_conn++; - if (bad++ > 10) { - fprintf(stderr, - "\nTest aborted after 10 failures\n\n"); - apr_err("apr_connect()", rv); - } - c->state = STATE_UNCONNECTED; - start_connect(c); - return; - } - } - - /* connected first time */ - started++; - write_request(c); -} - -/* --------------------------------------------------------- */ - -/* close down connection and save stats */ - -static void close_connection(struct connection * c) -{ - if (c->read == 0 && c->keepalive) { - /* - * server has legitimately shut down an idle keep alive request - */ - if (good) - good--; /* connection never happened */ - } - else { - if (good == 1) { - /* first time here */ - doclen = c->bread; - } - else if (c->bread != doclen) { - bad++; - err_length++; - } - /* save out time */ - if (done < requests) { - struct data s; - if ((done) && heartbeatres && !(done % heartbeatres)) { - fprintf(stderr, "Completed %ld requests\n", done); - fflush(stderr); - } - c->done = apr_time_now(); - s.read = c->read; - s.starttime = c->start; - s.ctime = (c->connect - c->start) / 1000; - s.time = (c->done - c->start) / 1000; - s.waittime = (c->beginread - c->endwrite) / 1000; - stats[done++] = s; - } - } - - apr_poll_socket_remove(readbits, c->aprsock); - apr_socket_close(c->aprsock); - c->state = STATE_UNCONNECTED; - - /* connect again */ - start_connect(c); - return; -} - -/* --------------------------------------------------------- */ - -/* read data from connection */ - -static void read_connection(struct connection * c) -{ - apr_size_t r; - apr_status_t status; - char *part; - char respcode[4]; /* 3 digits and null */ - - r = sizeof(buffer); - apr_setsocketopt(c->aprsock, APR_SO_TIMEOUT, aprtimeout); - status = apr_recv(c->aprsock, buffer, &r); - if (r == 0 || (status != APR_SUCCESS && !APR_STATUS_IS_EAGAIN(status))) { - good++; - close_connection(c); - return; - } - - if (APR_STATUS_IS_EAGAIN(status)) - return; - - totalread += r; - if (c->read == 0) { - c->beginread = apr_time_now(); - }; - c->read += r; - - - if (!c->gotheader) { - char *s; - int l = 4; - int space = CBUFFSIZE - c->cbx - 1; /* -1 to allow for 0 - * terminator */ - int tocopy = (space < r) ? space : r; -#ifdef NOT_ASCII - apr_size_t inbytes_left = space, outbytes_left = space; - - status = apr_xlate_conv_buffer(from_ascii, buffer, &inbytes_left, - c->cbuff + c->cbx, &outbytes_left); - if (status || inbytes_left || outbytes_left) { - fprintf(stderr, "only simple translation is supported (%d/%u/%u)\n", - status, inbytes_left, outbytes_left); - exit(1); - } -#else - memcpy(c->cbuff + c->cbx, buffer, space); -#endif /* NOT_ASCII */ - c->cbx += tocopy; - space -= tocopy; - c->cbuff[c->cbx] = 0; /* terminate for benefit of strstr */ - if (verbosity >= 4) { - printf("LOG: header received:\n%s\n", c->cbuff); - } - s = strstr(c->cbuff, "\r\n\r\n"); - /* - * this next line is so that we talk to NCSA 1.5 which blatantly - * breaks the http specifaction - */ - if (!s) { - s = strstr(c->cbuff, "\n\n"); - l = 2; - } - - if (!s) { - /* read rest next time */ - if (space) { - return; - } - else { - /* header is in invalid or too big - close connection */ - apr_poll_socket_remove(readbits, c->aprsock); - apr_socket_close(c->aprsock); - err_response++; - if (bad++ > 10) { - err("\nTest aborted after 10 failures\n\n"); - } - start_connect(c); - } - } - else { - /* have full header */ - if (!good) { - /* - * this is first time, extract some interesting info - */ - char *p, *q; - p = strstr(c->cbuff, "Server:"); - q = servername; - if (p) { - p += 8; - while (*p > 32) - *q++ = *p++; - } - *q = 0; - } - /* - * XXX: this parsing isn't even remotely HTTP compliant... but in - * the interest of speed it doesn't totally have to be, it just - * needs to be extended to handle whatever servers folks want to - * test against. -djg - */ - - /* check response code */ - part = strstr(c->cbuff, "HTTP"); /* really HTTP/1.x_ */ - strncpy(respcode, (part + strlen("HTTP/1.x_")), 3); - respcode[3] = '\0'; - if (respcode[0] != '2') { - err_response++; - if (verbosity >= 2) - printf("WARNING: Response code not 2xx (%s)\n", respcode); - } - else if (verbosity >= 3) { - printf("LOG: Response code = %s\n", respcode); - } - c->gotheader = 1; - *s = 0; /* terminate at end of header */ - if (keepalive && - (strstr(c->cbuff, "Keep-Alive") - || strstr(c->cbuff, "keep-alive"))) { /* for benefit of MSIIS */ - char *cl; - cl = strstr(c->cbuff, "Content-Length:"); - /* handle NCSA, which sends Content-length: */ - if (!cl) - cl = strstr(c->cbuff, "Content-length:"); - if (cl) { - c->keepalive = 1; - c->length = atoi(cl + 16); - } - } - c->bread += c->cbx - (s + l - c->cbuff) + r - tocopy; - totalbread += c->bread; - } - } - else { - /* outside header, everything we have read is entity body */ - c->bread += r; - totalbread += r; - } - - if (c->keepalive && (c->bread >= c->length)) { - /* finished a keep-alive connection */ - good++; - doneka++; - /* save out time */ - if (good == 1) { - /* first time here */ - doclen = c->bread; - } - else if (c->bread != doclen) { - bad++; - err_length++; - } - if (done < requests) { - struct data s; - if ((done) && (!(done % heartbeatres))) { - fprintf(stderr, "Completed %ld requests\n", done); - fflush(stderr); - } - c->done = apr_time_now(); - s.read = c->read; - s.starttime = c->start; - s.ctime = (c->connect - c->start) / 1000; - s.waittime = (c->beginread - c->endwrite) / 1000; - s.time = (c->done - c->start) / 1000; - stats[done++] = s; - } - c->keepalive = 0; - c->length = 0; - c->gotheader = 0; - c->cbx = 0; - c->read = c->bread = 0; - write_request(c); - c->start = c->connect; /* zero connect time with keep-alive */ - } -} - -/* --------------------------------------------------------- */ - -/* run the tests */ - -static void test(void) -{ - apr_time_t now; - apr_int16_t rv; - long i; - apr_status_t status; -#ifdef NOT_ASCII - apr_size_t inbytes_left, outbytes_left; -#endif - - if (isproxy) { - strcpy(connecthost, proxyhost); - connectport = proxyport; - } - else { - strcpy(connecthost, hostname); - connectport = port; - } - - if (!use_html) { - printf("Benchmarking %s ", hostname); - if (isproxy) - printf("[through %s:%d] ", proxyhost, proxyport); - printf("(be patient)%s", - (heartbeatres ? "\n" : "...")); - fflush(stdout); - } - - now = apr_time_now(); - - con = malloc(concurrency * sizeof(struct connection)); - memset(con, 0, concurrency * sizeof(struct connection)); - - stats = malloc(requests * sizeof(struct data)); - apr_poll_setup(&readbits, concurrency, cntxt); - - /* setup request */ - if (!posting) { - sprintf(request, "%s %s HTTP/1.0\r\n" - "User-Agent: ApacheBench/%s\r\n" - "%s" "%s" "%s" - "Host: %s\r\n" - "Accept: */*\r\n" - "%s" "\r\n", - (posting == 0) ? "GET" : "HEAD", - (isproxy) ? fullurl : path, - AB_VERSION, - keepalive ? "Connection: Keep-Alive\r\n" : "", - cookie, auth, host_field, hdrs); - } - else { - sprintf(request, "POST %s HTTP/1.0\r\n" - "User-Agent: ApacheBench/%s\r\n" - "%s" "%s" "%s" - "Host: %s\r\n" - "Accept: */*\r\n" - "Content-length: %" APR_SIZE_T_FMT "\r\n" - "Content-type: %s\r\n" - "%s" - "\r\n", - (isproxy) ? fullurl : path, - AB_VERSION, - keepalive ? "Connection: Keep-Alive\r\n" : "", - cookie, auth, - host_field, postlen, - (content_type[0]) ? content_type : "text/plain", hdrs); - } - - if (verbosity >= 2) - printf("INFO: POST header == \n---\n%s\n---\n", request); - - reqlen = strlen(request); - - /* - * Combine headers and (optional) post file into one contineous buffer - */ - if (posting) { - char *buff = (char *) malloc(postlen + reqlen + 1); - strcpy(buff, request); - strcpy(buff + reqlen, postdata); - request = buff; - } - -#ifdef NOT_ASCII - inbytes_left = outbytes_left = reqlen; - status = apr_xlate_conv_buffer(to_ascii, request, &inbytes_left, - request, &outbytes_left); - if (status || inbytes_left || outbytes_left) { - fprintf(stderr, "only simple translation is supported (%d/%u/%u)\n", - status, inbytes_left, outbytes_left); - exit(1); - } -#endif /* NOT_ASCII */ - - /* ok - lets start */ - start = apr_time_now(); - - /* initialise lots of requests */ - for (i = 0; i < concurrency; i++) { - con[i].socknum = i; - start_connect(&con[i]); - } - - while (done < requests) { - apr_int32_t n; - apr_int32_t timed; - - /* check for time limit expiry */ - now = apr_time_now(); - timed = (now - start) / APR_USEC_PER_SEC; - if (tlimit && timed > (tlimit * 1000)) { - requests = done; /* so stats are correct */ - } - - n = concurrency; - status = apr_poll(readbits, &n, aprtimeout); - if (status != APR_SUCCESS) - apr_err("apr_poll", status); - - if (!n) { - err("\nServer timed out\n\n"); - } - - for (i = 0; i < concurrency; i++) { - /* - * If the connection isn't connected how can we check it? - */ - if (con[i].state == STATE_UNCONNECTED) - continue; - - apr_poll_revents_get(&rv, con[i].aprsock, readbits); - /* - * Notes: APR_POLLHUP is set after FIN is received on some - * systems, so treat that like APR_POLLIN so that we try to read - * again. - * - * Some systems return APR_POLLERR with APR_POLLHUP. We need to - * call read_connection() for APR_POLLHUP, so check for - * APR_POLLHUP first so that a closed connection isn't treated - * like an I/O error. If it is, we never figure out that the - * connection is done and we loop here endlessly calling - * apr_poll(). - */ - if ((rv & APR_POLLIN) || (rv & APR_POLLPRI) || (rv & APR_POLLHUP)) - read_connection(&con[i]); - if ((rv & APR_POLLERR) || (rv & APR_POLLNVAL)) { - bad++; - err_except++; - start_connect(&con[i]); - continue; - } - if (rv & APR_POLLOUT) - write_request(&con[i]); - - /* - * When using a select based poll every time we check the bits - * are reset. In 1.3's ab we copied the FD_SET's each time - * through, but here we're going to check the state and if the - * connection is in STATE_READ or STATE_CONNECTING we'll add the - * socket back in as APR_POLLIN. - */ - if (con[i].state == STATE_READ || con[i].state == STATE_CONNECTING) - apr_poll_socket_add(readbits, con[i].aprsock, APR_POLLIN); - - } - } - - if (heartbeatres) - fprintf(stderr, "Finished %ld requests\n", done); - else - printf("..done\n"); - - if (use_html) - output_html_results(); - else - output_results(); -} - -/* ------------------------------------------------------- */ - -/* display copyright information */ -static void copyright(void) -{ - if (!use_html) { - printf("This is ApacheBench, Version %s\n", AB_VERSION " <$Revision: 1.70 $> apache-2.0"); - printf("Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n"); - printf("Copyright (c) 1998-2001 The Apache Software Foundation, http://www.apache.org/\n"); - printf("\n"); - } - else { - printf("<p>\n"); - printf(" This is ApacheBench, Version %s <i><%s></i> apache-2.0<br>\n", AB_VERSION, "$Revision: 1.70 $"); - printf(" Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br>\n"); - printf(" Copyright (c) 1998-2001 The Apache Software Foundation, http://www.apache.org/<br>\n"); - printf("</p>\n<p>\n"); - } -} - -/* display usage information */ -static void usage(const char *progname) -{ - fprintf(stderr, "Usage: %s [options] [http" -#if USE_SSL - "[s]" -#endif - "://]hostname[:port]/path\n", progname); - fprintf(stderr, "Options are:\n"); - fprintf(stderr, " -n requests Number of requests to perform\n"); - fprintf(stderr, " -c concurrency Number of multiple requests to make\n"); - fprintf(stderr, " -t timelimit Seconds to max. wait for responses\n"); - fprintf(stderr, " -p postfile File containing data to POST\n"); - fprintf(stderr, " -T content-type Content-type header for POSTing\n"); - fprintf(stderr, " -v verbosity How much troubleshooting info to print\n"); - fprintf(stderr, " -w Print out results in HTML tables\n"); - fprintf(stderr, " -i Use HEAD instead of GET\n"); - fprintf(stderr, " -x attributes String to insert as table attributes\n"); - fprintf(stderr, " -y attributes String to insert as tr attributes\n"); - fprintf(stderr, " -z attributes String to insert as td or th attributes\n"); - fprintf(stderr, " -C attribute Add cookie, eg. 'Apache=1234. (repeatable)\n"); - fprintf(stderr, " -H attribute Add Arbitrary header line, eg. 'Accept-Encoding: zop'\n"); - fprintf(stderr, " Inserted after all normal header lines. (repeatable)\n"); - fprintf(stderr, " -A attribute Add Basic WWW Authentication, the attributes\n"); - fprintf(stderr, " are a colon separated username and password.\n"); - fprintf(stderr, " -P attribute Add Basic Proxy Authentication, the attributes\n"); - fprintf(stderr, " are a colon separated username and password.\n"); - fprintf(stderr, " -X proxy:port Proxyserver and port number to use\n"); - fprintf(stderr, " -V Print version number and exit\n"); - fprintf(stderr, " -k Use HTTP KeepAlive feature\n"); - fprintf(stderr, " -d Do not show percentiles served table.\n"); - fprintf(stderr, " -S Do not show confidence estimators and warnings.\n"); - fprintf(stderr, " -g filename Output collected data to gnuplot format file.\n"); - fprintf(stderr, " -e filename Output CSV file with percentages served\n"); -#if USE_SSL - fprintf(stderr, " -s Use httpS instead of HTTP (SSL)\n"); -#endif - fprintf(stderr, " -h Display usage information (this message)\n"); - exit(EINVAL); -} - -/* ------------------------------------------------------- */ - -/* split URL into parts */ - -static int parse_url(char *url) -{ - char *cp; - char *h; - char *scope_id; - apr_status_t rv; - - if (strlen(url) > 7 && strncmp(url, "http://", 7) == 0) - url += 7; - else -#if USE_SSL - if (strlen(url) > 8 && strncmp(url, "https://", 8) == 0) { - url += 8; - ssl = 1; - port = 443; - } -#else - if (strlen(url) > 8 && strncmp(url, "https://", 8) == 0) { - fprintf(stderr, "SSL not compiled in; no https support\n"); - exit(1); - } -#endif - - if ((cp = strchr(url, '/')) == NULL) - return 1; - h = apr_palloc(cntxt, cp - url + 1); - memcpy(h, url, cp - url); - h[cp - url] = '\0'; - rv = apr_parse_addr_port(&hostname, &scope_id, &port, h, cntxt); - if (rv != APR_SUCCESS || !hostname || scope_id) { - return 1; - } - strcpy(path, cp); - *cp = '\0'; - if (*url == '[') { /* IPv6 numeric address string */ - host_field = apr_psprintf(cntxt, "[%s]", hostname); - } - else { - host_field = hostname; - } - if (port == 0) { /* no port specified */ - port = 80; - } - return 0; -} - -/* ------------------------------------------------------- */ - -/* read data to POST from file, save contents and length */ - -static int open_postfile(const char *pfile) -{ - apr_file_t *postfd = NULL; - apr_finfo_t finfo; - apr_fileperms_t mode = APR_OS_DEFAULT; - apr_size_t length; - apr_status_t rv; - char errmsg[120]; - - rv = apr_file_open(&postfd, pfile, APR_READ, mode, cntxt); - if (rv != APR_SUCCESS) { - printf("Invalid postfile name (%s): %s\n", pfile, - apr_strerror(rv, errmsg, sizeof errmsg)); - return rv; - } - - apr_file_info_get(&finfo, APR_FINFO_NORM, postfd); - postlen = finfo.size; - postdata = (char *) malloc(postlen); - if (!postdata) { - printf("Can\'t alloc postfile buffer\n"); - return APR_ENOMEM; - } - length = postlen; - rv = apr_file_read(postfd, postdata, &length); - if (rv != APR_SUCCESS) { - printf("error reading postfile: %s\n", - apr_strerror(rv, errmsg, sizeof errmsg)); - return rv; - } - if (length != postlen) { - printf("error reading postfile: read only %" - APR_SIZE_T_FMT " bytes", - length); - return APR_EINVAL; - } - apr_file_close(postfd); - return 0; -} - -static void terminate(void) -{ - apr_terminate(); -} - -/* ------------------------------------------------------- */ - -/* sort out command-line args and call test */ -int main(int argc, const char *const argv[]) -{ - int r, l; - char tmp[1024]; - apr_status_t status; - apr_getopt_t *opt; - const char *optarg; - char c; - - /* table defaults */ - tablestring = ""; - trstring = ""; - tdstring = "bgcolor=white"; - cookie[0] = '\0'; - auth[0] = '\0'; - proxyhost[0] = '\0'; - hdrs[0] = '\0'; - - apr_initialize(); - atexit(terminate); - apr_pool_create(&cntxt, NULL); - -#ifdef NOT_ASCII - status = apr_xlate_open(&to_ascii, "ISO8859-1", APR_DEFAULT_CHARSET, cntxt); - if (status) { - fprintf(stderr, "apr_xlate_open(to ASCII)->%d\n", status); - exit(1); - } - status = apr_xlate_open(&from_ascii, APR_DEFAULT_CHARSET, "ISO8859-1", cntxt); - if (status) { - fprintf(stderr, "apr_xlate_open(from ASCII)->%d\n", status); - exit(1); - } - status = apr_base64init_ebcdic(to_ascii, from_ascii); - if (status) { - fprintf(stderr, "apr_base64init_ebcdic()->%d\n", status); - exit(1); - } -#endif - - apr_getopt_init(&opt, cntxt, argc, argv); - while ((status = apr_getopt(opt, "n:c:t:T:p:v:kVhwix:y:z:C:H:P:A:g:X:de:Sq" -#if USE_SSL - "s" -#endif - ,&c, &optarg)) == APR_SUCCESS) { - switch (c) { -#if USE_SSL - case 's': - ssl = 1; - break; -#endif - case 'n': - requests = atoi(optarg); - if (!requests) { - err("Invalid number of requests\n"); - } - break; - case 'k': - keepalive = 1; - break; - case 'q': - heartbeatres = 0; - break; - case 'c': - concurrency = atoi(optarg); - break; - case 'i': - if (posting == 1) - err("Cannot mix POST and HEAD\n"); - posting = -1; - break; - case 'g': - gnuplot = strdup(optarg); - break; - case 'd': - percentile = 0; - break; - case 'e': - csvperc = strdup(optarg); - break; - case 'S': - confidence = 0; - break; - case 'p': - if (posting != 0) - err("Cannot mix POST and HEAD\n"); - - if (0 == (r = open_postfile(optarg))) { - posting = 1; - } - else if (postdata) { - exit(r); - } - break; - case 'v': - verbosity = atoi(optarg); - break; - case 't': - tlimit = atoi(optarg); - requests = MAX_REQUESTS; /* need to size data array on - * something */ - break; - case 'T': - strcpy(content_type, optarg); - break; - case 'C': - strncat(cookie, "Cookie: ", sizeof(cookie)); - strncat(cookie, optarg, sizeof(cookie)); - strncat(cookie, "\r\n", sizeof(cookie)); - break; - case 'A': - /* - * assume username passwd already to be in colon separated form. - * Ready to be uu-encoded. - */ - while (apr_isspace(*optarg)) - optarg++; - l = apr_base64_encode(tmp, optarg, strlen(optarg)); - tmp[l] = '\0'; - - strncat(auth, "Authorization: Basic ", sizeof(auth)); - strncat(auth, tmp, sizeof(auth)); - strncat(auth, "\r\n", sizeof(auth)); - break; - case 'P': - /* - * assume username passwd already to be in colon separated form. - */ - while (apr_isspace(*optarg)) - optarg++; - l = apr_base64_encode(tmp, optarg, strlen(optarg)); - tmp[l] = '\0'; - - strncat(auth, "Proxy-Authorization: Basic ", sizeof(auth)); - strncat(auth, tmp, sizeof(auth)); - strncat(auth, "\r\n", sizeof(auth)); - break; - case 'H': - strncat(hdrs, optarg, sizeof(hdrs)); - strncat(hdrs, "\r\n", sizeof(hdrs)); - break; - case 'w': - use_html = 1; - break; - /* - * if any of the following three are used, turn on html output - * automatically - */ - case 'x': - use_html = 1; - tablestring = optarg; - break; - case 'X': - { - char *p; - /* - * assume proxy-name[:port] - */ - if ((p = strchr(optarg, ':'))) { - *p = '\0'; - p++; - proxyport = atoi(p); - }; - strcpy(proxyhost, optarg); - isproxy = 1; - } - break; - case 'y': - use_html = 1; - trstring = optarg; - break; - case 'z': - use_html = 1; - tdstring = optarg; - break; - case 'h': - usage(argv[0]); - break; - case 'V': - copyright(); - return 0; - } - } - - if (opt->ind != argc - 1) { - fprintf(stderr, "%s: wrong number of arguments\n", argv[0]); - usage(argv[0]); - } - - if (parse_url(apr_pstrdup(cntxt, opt->argv[opt->ind++]))) { - fprintf(stderr, "%s: invalid URL\n", argv[0]); - usage(argv[0]); - } - - - if ((heartbeatres) && (requests > 150)) { - heartbeatres = requests / 10; /* Print line every 10% of requests */ - if (heartbeatres < 100) - heartbeatres = 100; /* but never more often than once every 100 - * connections. */ - } - else - heartbeatres = 0; - -#ifdef USE_SSL - SSL_library_init(); - if (!(ctx = SSL_CTX_new(SSLv2_client_method()))) { - fprintf(stderr, "Could not init SSL CTX"); - ERR_print_errors_fp(stderr); - exit(1); - } -#endif -#if SIGPIPE - signal(SIGPIPE, SIG_IGN); /* Ignore writes to connections that - * have been closed at the other end. */ -#endif - copyright(); - test(); - - return 0; -} diff --git a/support/ab.dsp b/support/ab.dsp deleted file mode 100644 index 616799b8e0..0000000000 --- a/support/ab.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ab" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=ab - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ab.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ab.mak" CFG="ab - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ab - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "ab - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ab - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fd"Release/ab" /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /incremental:no /map /machine:I386 -# ADD LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /incremental:no /map /machine:I386 - -!ELSEIF "$(CFG)" == "ab - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fd"Debug/ab" /FD /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /incremental:no /map /debug /machine:I386 -# ADD LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /incremental:no /map /debug /machine:I386 - -!ENDIF - -# Begin Target - -# Name "ab - Win32 Release" -# Name "ab - Win32 Debug" -# Begin Source File - -SOURCE=.\ab.c -# End Source File -# End Target -# End Project diff --git a/support/ab.mak b/support/ab.mak deleted file mode 100644 index ce41db0b20..0000000000 --- a/support/ab.mak +++ /dev/null @@ -1,290 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on ab.dsp -!IF "$(CFG)" == "" -CFG=ab - Win32 Debug -!MESSAGE No configuration specified. Defaulting to ab - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "ab - Win32 Release" && "$(CFG)" != "ab - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ab.mak" CFG="ab - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ab - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "ab - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "ab - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\ab.exe" - -!ELSE - -ALL : "aprutil - Win32 Release" "apr - Win32 Release" "$(OUTDIR)\ab.exe" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"apr - Win32 ReleaseCLEAN" "aprutil - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\ab.idb" - -@erase "$(INTDIR)\ab.obj" - -@erase "$(OUTDIR)\ab.exe" - -@erase "$(OUTDIR)\ab.map" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /I "../srclib/apr/include" /I\ - "../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D\ - "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\ab"\ - /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\ab.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo\ - /subsystem:console /incremental:no /pdb:"$(OUTDIR)\ab.pdb"\ - /map:"$(INTDIR)\ab.map" /machine:I386 /out:"$(OUTDIR)\ab.exe" -LINK32_OBJS= \ - "$(INTDIR)\ab.obj" \ - "..\srclib\apr-util\LibR\aprutil.lib" \ - "..\srclib\apr\LibR\apr.lib" - -"$(OUTDIR)\ab.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "ab - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\ab.exe" - -!ELSE - -ALL : "aprutil - Win32 Debug" "apr - Win32 Debug" "$(OUTDIR)\ab.exe" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"apr - Win32 DebugCLEAN" "aprutil - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\ab.idb" - -@erase "$(INTDIR)\ab.obj" - -@erase "$(OUTDIR)\ab.exe" - -@erase "$(OUTDIR)\ab.map" - -@erase "$(OUTDIR)\ab.pdb" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MDd /W3 /GX /Zi /Od /I "../srclib/apr/include" /I\ - "../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D\ - "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\ab"\ - /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\ab.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo\ - /subsystem:console /incremental:no /pdb:"$(OUTDIR)\ab.pdb"\ - /map:"$(INTDIR)\ab.map" /debug /machine:I386 /out:"$(OUTDIR)\ab.exe" -LINK32_OBJS= \ - "$(INTDIR)\ab.obj" \ - "..\srclib\apr-util\LibD\aprutil.lib" \ - "..\srclib\apr\LibD\apr.lib" - -"$(OUTDIR)\ab.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "ab - Win32 Release" || "$(CFG)" == "ab - Win32 Debug" - -!IF "$(CFG)" == "ab - Win32 Release" - -"apr - Win32 Release" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\apr.mak CFG="apr - Win32 Release" - cd "..\..\support" - -"apr - Win32 ReleaseCLEAN" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\apr.mak CFG="apr - Win32 Release" RECURSE=1\ - - cd "..\..\support" - -!ELSEIF "$(CFG)" == "ab - Win32 Debug" - -"apr - Win32 Debug" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\apr.mak CFG="apr - Win32 Debug" - cd "..\..\support" - -"apr - Win32 DebugCLEAN" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\apr.mak CFG="apr - Win32 Debug" RECURSE=1 - cd "..\..\support" - -!ENDIF - -!IF "$(CFG)" == "ab - Win32 Release" - -"aprutil - Win32 Release" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release" - cd "..\..\support" - -"aprutil - Win32 ReleaseCLEAN" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\aprutil.mak" CFG="aprutil - Win32 Release"\ - RECURSE=1 - cd "..\..\support" - -!ELSEIF "$(CFG)" == "ab - Win32 Debug" - -"aprutil - Win32 Debug" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug" - cd "..\..\support" - -"aprutil - Win32 DebugCLEAN" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\aprutil.mak" CFG="aprutil - Win32 Debug"\ - RECURSE=1 - cd "..\..\support" - -!ENDIF - -SOURCE=.\ab.c -DEP_CPP_AB_C0=\ - "..\srclib\apr-util\include\apr_base64.h"\ - "..\srclib\apr-util\include\apu.h"\ - "..\srclib\apr\include\apr.h"\ - "..\srclib\apr\include\apr_errno.h"\ - "..\srclib\apr\include\apr_file_info.h"\ - "..\srclib\apr\include\apr_file_io.h"\ - "..\srclib\apr\include\apr_general.h"\ - "..\srclib\apr\include\apr_getopt.h"\ - "..\srclib\apr\include\apr_lib.h"\ - "..\srclib\apr\include\apr_network_io.h"\ - "..\srclib\apr\include\apr_pools.h"\ - "..\srclib\apr\include\apr_strings.h"\ - "..\srclib\apr\include\apr_time.h"\ - "..\srclib\apr\include\apr_user.h"\ - "..\srclib\apr\include\apr_want.h"\ - "..\srclib\apr\include\apr_xlate.h"\ - - -"$(INTDIR)\ab.obj" : $(SOURCE) $(DEP_CPP_AB_C0) "$(INTDIR)" - - - -!ENDIF - diff --git a/support/apachectl.in b/support/apachectl.in deleted file mode 100644 index 136a81cacb..0000000000 --- a/support/apachectl.in +++ /dev/null @@ -1,234 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2000-2001 The Apache Software Foundation. -# See license at the end of this file. -# -# Apache control script designed to allow an easy command line interface -# to controlling Apache. Written by Marc Slemko, 1997/08/23 -# -# The exit codes returned are: -# 0 - operation completed successfully -# 1 - -# 2 - usage error -# 3 - httpd could not be started -# 4 - httpd could not be stopped -# 5 - httpd could not be started during a restart -# 6 - httpd could not be restarted during a restart -# 7 - httpd could not be restarted during a graceful restart -# 8 - configuration syntax error -# -# When multiple arguments are given, only the error from the _last_ -# one is reported. Run "apachectl help" for usage info -# -# -# |||||||||||||||||||| START CONFIGURATION SECTION |||||||||||||||||||| -# -------------------- -------------------- -# -# the path to your PID file -PIDFILE=@prefix@/logs/httpd.pid -# -# the path to your httpd binary, including options if necessary -HTTPD='@prefix@/bin/httpd' -# -# a command that outputs a formatted text version of the HTML at the -# url given on the command line. Designed for lynx, however other -# programs may work. -LYNX="lynx -dump" -# -# the URL to your server's mod_status status page. If you do not -# have one, then status and fullstatus will not work. -STATUSURL="http://localhost:@PORT@/server-status" -# -# -------------------- -------------------- -# |||||||||||||||||||| END CONFIGURATION SECTION |||||||||||||||||||| - -ERROR=0 -ARGV="$@" -if [ "x$ARGV" = "x" ] ; then - ARGS="help" -fi - -for ARG in $@ $ARGS -do - # check for pidfile - if [ -f $PIDFILE ] ; then - PID=`cat $PIDFILE` - if [ "x$PID" != "x" ] && kill -0 $PID 2>/dev/null ; then - STATUS="httpd (pid $PID) running" - RUNNING=1 - else - STATUS="httpd (pid $PID?) not running" - RUNNING=0 - fi - else - STATUS="httpd (no pid file) not running" - RUNNING=0 - fi - - case $ARG in - start) - if [ $RUNNING -eq 1 ]; then - echo "$0 $ARG: httpd (pid $PID) already running" - continue - fi - if $HTTPD ; then - echo "$0 $ARG: httpd started" - else - echo "$0 $ARG: httpd could not be started" - ERROR=3 - fi - ;; - stop) - if [ $RUNNING -eq 0 ]; then - echo "$0 $ARG: $STATUS" - continue - fi - if kill $PID ; then - echo "$0 $ARG: httpd stopped" - else - echo "$0 $ARG: httpd could not be stopped" - ERROR=4 - fi - ;; - restart) - if [ $RUNNING -eq 0 ]; then - echo "$0 $ARG: httpd not running, trying to start" - if $HTTPD ; then - echo "$0 $ARG: httpd started" - else - echo "$0 $ARG: httpd could not be started" - ERROR=5 - fi - else - if $HTTPD -t >/dev/null 2>&1; then - if kill -HUP $PID ; then - echo "$0 $ARG: httpd restarted" - else - echo "$0 $ARG: httpd could not be restarted" - ERROR=6 - fi - else - echo "$0 $ARG: configuration broken, ignoring restart" - echo "$0 $ARG: (run 'apachectl configtest' for details)" - ERROR=6 - fi - fi - ;; - graceful) - if [ $RUNNING -eq 0 ]; then - echo "$0 $ARG: httpd not running, trying to start" - if $HTTPD ; then - echo "$0 $ARG: httpd started" - else - echo "$0 $ARG: httpd could not be started" - ERROR=5 - fi - else - if $HTTPD -t >/dev/null 2>&1; then - if kill -WINCH $PID ; then - echo "$0 $ARG: httpd gracefully restarted" - else - echo "$0 $ARG: httpd could not be restarted" - ERROR=7 - fi - else - echo "$0 $ARG: configuration broken, ignoring restart" - echo "$0 $ARG: (run 'apachectl configtest' for details)" - ERROR=7 - fi - fi - ;; - status) - $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } ' - ;; - fullstatus) - $LYNX $STATUSURL - ;; - configtest) - if $HTTPD -t; then - : - else - ERROR=8 - fi - ;; - *) - echo "usage: $0 (start|stop|restart|fullstatus|status|graceful|configtest|help)" - cat <<EOF - -start - start httpd -stop - stop httpd -restart - restart httpd if running by sending a SIGHUP or start if - not running -fullstatus - dump a full status screen; requires lynx and mod_status enabled -status - dump a short status screen; requires lynx and mod_status enabled -graceful - do a graceful restart by sending a SIGWINCH or start if not running -configtest - do a configuration syntax test -help - this screen - -EOF - ERROR=2 - ;; - - esac - -done - -exit $ERROR - -# ==================================================================== -# The Apache Software License, Version 1.1 -# -# Copyright (c) 2000-2001 The Apache Software Foundation. All rights -# reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# -# 3. The end-user documentation included with the redistribution, -# if any, must include the following acknowledgment: -# "This product includes software developed by the -# Apache Software Foundation (http://www.apache.org/)." -# Alternately, this acknowledgment may appear in the software itself, -# if and wherever such third-party acknowledgments normally appear. -# -# 4. The names "Apache" and "Apache Software Foundation" must -# not be used to endorse or promote products derived from this -# software without prior written permission. For written -# permission, please contact apache@apache.org. -# -# 5. Products derived from this software may not be called "Apache", -# nor may "Apache" appear in their name, without prior written -# permission of the Apache Software Foundation. -# -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR -# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# ==================================================================== -# -# This software consists of voluntary contributions made by many -# individuals on behalf of the Apache Software Foundation. For more -# information on the Apache Software Foundation, please see -# <http://www.apache.org/>. -# -# Portions of this software are based upon public domain software -# originally written at the National Center for Supercomputing Applications, -# University of Illinois, Urbana-Champaign. -# diff --git a/support/apxs.in b/support/apxs.in deleted file mode 100644 index c1c91ee07f..0000000000 --- a/support/apxs.in +++ /dev/null @@ -1,646 +0,0 @@ -#!@perlbin@ -# ==================================================================== -# The Apache Software License, Version 1.1 -# -# Copyright (c) 2000-2001 The Apache Software Foundation. All rights -# reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# -# 3. The end-user documentation included with the redistribution, -# if any, must include the following acknowledgment: -# "This product includes software developed by the -# Apache Software Foundation (http://www.apache.org/)." -# Alternately, this acknowledgment may appear in the software itself, -# if and wherever such third-party acknowledgments normally appear. -# -# 4. The names "Apache" and "Apache Software Foundation" must -# not be used to endorse or promote products derived from this -# software without prior written permission. For written -# permission, please contact apache@apache.org. -# -# 5. Products derived from this software may not be called "Apache", -# nor may "Apache" appear in their name, without prior written -# permission of the Apache Software Foundation. -# -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR -# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# ==================================================================== -# -# This software consists of voluntary contributions made by many -# individuals on behalf of the Apache Software Foundation. For more -# information on the Apache Software Foundation, please see -# <http://www.apache.org/>. -# -## -## apxs -- APache eXtenSion tool -## Written by Ralf S. Engelschall <rse@apache.org> -## - -require 5.003; -use strict; -package apxs; - -## -## Configuration -## - -my $CFG_TARGET = '@progname@'; -my $CFG_CC = '@CC@'; -my $CFG_DEFS = '@DEFS@'; -my $CFG_CFLAGS = '@CFLAGS@ @EXTRA_CFLAGS@'; -my $CFG_PREFIX = "@prefix@"; -my $prefix = "$CFG_PREFIX"; -my $CFG_EXEC_PREFIX = "@exec_prefix@"; -my $exec_prefix = "$CFG_EXEC_PREFIX"; -my $CFG_SBINDIR = "@bindir@"; -my $CFG_INCLUDEDIR = "@includedir@"; -my $CFG_LIBEXECDIR = "@libexecdir@"; -my $CFG_SYSCONFDIR = "@sysconfdir@"; - - -## -## Cleanup the above stuff -## -$CFG_CFLAGS =~ s|^\s+||; -$CFG_CFLAGS =~ s|\s+$||; -$CFG_CFLAGS =~ s|\s+`.+apaci`||; - -## -## parse argument line -## - -# defaults for parameters -my $opt_n = ''; -my $opt_g = ''; -my $opt_c = 0; -my $opt_o = ''; -my @opt_D = (); -my @opt_I = (); -my @opt_L = (); -my @opt_l = (); -my @opt_W = (); -my @opt_S = (); -my $opt_e = 0; -my $opt_i = 0; -my $opt_a = 0; -my $opt_A = 0; -my $opt_q = 0; - -# this subroutine is derived from Perl's getopts.pl with the enhancement of -# the "+" metacharater at the format string to allow a list to be build by -# subsequent occurance of the same option. -sub Getopts { - my ($argumentative, @ARGV) = @_; - my (@args, $first, $rest, $pos); - my ($errs) = 0; - local ($_); - local ($[) = 0; - - @args = split( / */, $argumentative); - while(@ARGV && ($_ = $ARGV[0]) =~ /^-(.)(.*)/) { - ($first, $rest) = ($1,$2); - if ($_ =~ m|^--$|) { - shift(@ARGV); - last; - } - $pos = index($argumentative,$first); - if($pos >= $[) { - if($args[$pos+1] eq ':') { - shift(@ARGV); - if($rest eq '') { - unless (@ARGV) { - print STDERR "apxs:Error: Incomplete option: $first (needs an argument)\n"; - ++$errs; - } - $rest = shift(@ARGV); - } - eval "\$opt_$first = \$rest;"; - } - elsif ($args[$pos+1] eq '+') { - shift(@ARGV); - if($rest eq '') { - unless (@ARGV) { - print STDERR "apxs:Error: Incomplete option: $first (needs an argument)\n"; - ++$errs; - } - $rest = shift(@ARGV); - } - eval "push(\@opt_$first, \$rest);"; - } - else { - eval "\$opt_$first = 1"; - if($rest eq '') { - shift(@ARGV); - } - else { - $ARGV[0] = "-$rest"; - } - } - } - else { - print STDERR "apxs:Error: Unknown option: $first\n"; - ++$errs; - if($rest ne '') { - $ARGV[0] = "-$rest"; - } - else { - shift(@ARGV); - } - } - } - return ($errs == 0, @ARGV); -} - -sub usage { - print STDERR "Usage: apxs -g [-S <var>=<val>] -n <modname>\n"; - print STDERR " apxs -q [-S <var>=<val>] <query> ...\n"; - print STDERR " apxs -c [-S <var>=<val>] [-o <dsofile>] [-D <name>[=<value>]]\n"; - print STDERR " [-I <incdir>] [-L <libdir>] [-l <libname>] [-Wc,<flags>]\n"; - print STDERR " [-Wl,<flags>] <files> ...\n"; - print STDERR " apxs -i [-S <var>=<val>] [-a] [-A] [-n <modname>] <dsofile> ...\n"; - print STDERR " apxs -e [-S <var>=<val>] [-a] [-A] [-n <modname>] <dsofile> ...\n"; - exit(1); -} - -# option handling -my $rc; -($rc, @ARGV) = &Getopts("qn:gco:I+D+L+l+W+S+eiaA", @ARGV); -&usage if ($rc == 0); -&usage if ($#ARGV == -1 and not $opt_g); -&usage if (not $opt_q and not ($opt_g and $opt_n) and not $opt_i and not $opt_c and not $opt_e); - -# argument handling -my @args = @ARGV; -my $name = 'unknown'; -$name = $opt_n if ($opt_n ne ''); - -if (@opt_S) { - my ($opt_S); - foreach $opt_S (@opt_S) { - if ($opt_S =~ m/^([^=]+)=(.*)$/) { - my ($var) = $1; - my ($val) = $2; - my $oldval = eval "\$CFG_$var"; - - unless ($var and $oldval) { - print STDERR "apxs:Error: no config variable $var\n"; - &usage; - } - - eval "\$CFG_${var}=\"${val}\""; - } else { - print STDERR "apxs:Error: malformatted -S option\n"; - &usage; - } - } -} - -## -## Initial shared object support check -## -my $httpd = "$CFG_SBINDIR/$CFG_TARGET"; - -#allow apxs to be run from the source tree, before installation -if ($0 =~ m:support/apxs$:) { - ($httpd = $0) =~ s:support/apxs$::; - $httpd .= $CFG_TARGET; -} - -if (not -x $httpd) { - print STDERR "apxs:Error: $httpd not found or not executable\n"; - exit(1); -} -if (not grep(/mod_so/, `$httpd -l`)) { - print STDERR "apxs:Error: Sorry, no shared object support for Apache\n"; - print STDERR "apxs:Error: available under your platform. Make sure\n"; - print STDERR "apxs:Error: the Apache module mod_so is compiled into\n"; - print STDERR "apxs:Error: your server binary `$httpd'.\n"; - exit(1); -} - -## -## Operation -## - -# helper function for executing a list of -# system command with return code checks -sub execute_cmds { - my (@cmds) = @_; - my ($cmd, $rc); - - foreach $cmd (@cmds) { - print STDERR "$cmd\n"; - $rc = system("$cmd"); - if ($rc != 0) { - printf(STDERR "apxs:Break: Command failed with rc=%d\n", $rc << 8); - exit(1); - } - } -} - -if ($opt_g) { - ## - ## SAMPLE MODULE SOURCE GENERATION - ## - - if (-d $name) { - print STDERR "apxs:Error: Directory `$name' already exists. Remove first\n"; - exit(1); - } - - my $data = join('', <DATA>); - $data =~ s|%NAME%|$name|sg; - $data =~ s|%TARGET%|$CFG_TARGET|sg; - - my ($mkf, $src) = ($data =~ m|^(.+)-=#=-\n(.+)|s); - - print STDERR "Creating [DIR] $name\n"; - system("mkdir $name"); - print STDERR "Creating [FILE] $name/Makefile\n"; - open(FP, ">${name}/Makefile") || die; - print FP $mkf; - close(FP); - print STDERR "Creating [FILE] $name/mod_$name.c\n"; - open(FP, ">${name}/mod_${name}.c") || die; - print FP $src; - close(FP); - - exit(0); -} - - -if ($opt_q) { - ## - ## QUERY INFORMATION - ## - - my $result = ''; - my $arg; - foreach $arg (@args) { - my $ok = 0; - my $name; - foreach $name (qw( - TARGET CC CFLAGS CFLAGS_SHLIB LD_SHLIB LDFLAGS_SHLIB LIBS_SHLIB - PREFIX SBINDIR INCLUDEDIR LIBEXECDIR SYSCONFDIR - )) { - if ($arg eq $name or $arg eq lc($name)) { - my $val = eval "\$CFG_$name"; - $result .= "${val}::"; - $ok = 1; - } - } - if (not $ok) { - printf(STDERR "apxs:Error: Invalid query string `%s'\n", $arg); - exit(1); - } - } - $result =~ s|::$||; - $result =~ s|::| |; - print $result; -} - -if ($opt_c) { - ## - ## SHARED OBJECT COMPILATION - ## - - # split files into sources and objects - my @srcs = (); - my @objs = (); - my $f; - foreach $f (@args) { - if ($f =~ m|\.c$|) { - push(@srcs, $f); - } - else { - push(@objs, $f); - } - } - - # determine output file - my $dso_file; - if ($opt_o eq '') { - if ($#srcs > -1) { - $dso_file = $srcs[0]; - $dso_file =~ s|\.[^.]+$|.la|; - } - elsif ($#objs > -1) { - $dso_file = $objs[0]; - $dso_file =~ s|\.[^.]+$|.la|; - } - else { - $dso_file = "mod_unknown.so"; - } - } - else { - $dso_file = $opt_o; - } - - # create compilation commands - my @cmds = (); - my $opt = ''; - my ($opt_Wc, $opt_I, $opt_D); - foreach $opt_Wc (@opt_W) { - $opt .= "$1 " if ($opt_Wc =~ m|^\s*c,(.*)$|); - } - foreach $opt_I (@opt_I) { - $opt .= "-I$opt_I "; - } - foreach $opt_D (@opt_D) { - $opt .= "-D$opt_D "; - } - my $cflags = "$CFG_CFLAGS"; - my $s; - my $mod; - foreach $s (@srcs) { - my $slo = $s; - $slo =~ s|\.c$|.slo|; - my $lo = $s; - $lo =~ s|\.c$|.lo|; - my $la = $s; - $la =~ s|\.c$|.la|; - my $o = $s; - $o =~ s|\.c$|.o|; - push(@cmds, "libtool --silent --mode=compile $CFG_CC $cflags -I$CFG_INCLUDEDIR $opt -c -o $lo $s && touch $slo"); - unshift(@objs, $lo); - } - - # create link command - my $o; - my $lo; - foreach $o (@objs) { - $lo .= " $o"; - } - - push(@cmds, "libtool --silent --mode=link $CFG_CC $cflags -o $dso_file -rpath $CFG_LIBEXECDIR -module -avoid-version $lo"); - - # execute the commands - &execute_cmds(@cmds); - - # allow one-step compilation and installation - if ($opt_i or $opt_e) { - @args = ( $dso_file ); - } -} - -if ($opt_i or $opt_e) { - ## - ## SHARED OBJECT INSTALLATION - ## - - # determine installation commands - # and corresponding LoadModule/AddModule directives - my @lmd = (); - my @amd = (); - my @cmds = (); - my $f; - foreach $f (@args) { - if ($f !~ m#(\.so$|\.la$)#) { - print STDERR "apxs:Error: file $f is not a shared object\n"; - exit(1); - } - my $t = $f; - $t =~ s|^.+/([^/]+)$|$1|; - if ($opt_i) { - push(@cmds, "libtool --mode=install cp $f $CFG_LIBEXECDIR/$t"); - push(@cmds, "chmod 755 $CFG_LIBEXECDIR/$t"); - } - - # determine module symbolname and filename - my $filename = ''; - if ($name eq 'unknown') { - $name = ''; - my $base = $f; - $base =~ s|\.[^.]+$||; - if (-f "$base.c") { - open(FP, "<$base.c"); - my $content = join('', <FP>); - close(FP); - if ($content =~ m|.*module\s+(?:AP_MODULE_DECLARE_DATA\s+)?([a-zA-Z0-9_]+)_module\s*=\s*.*|s) { - $name = "$1"; - $filename = "$base.c"; - $filename =~ s|^[^/]+/||; - } - } - if ($name eq '') { - if ($base =~ m|.*mod_([a-zA-Z0-9_]+)\..+|) { - $name = "$1"; - $filename = $base; - $filename =~ s|^[^/]+/||; - } - } - if ($name eq '') { - print "apxs:Error: Sorry, cannot determine bootstrap symbol name\n"; - print "apxs:Error: Please specify one with option `-n'\n"; - exit(1); - } - } - if ($filename eq '') { - $filename = "mod_${name}.c"; - } - my $dir = $CFG_LIBEXECDIR; - $dir =~ s|^$CFG_PREFIX/?||; - $dir =~ s|(.)$|$1/|; - $t =~ s|\.la$|.so|; - push(@lmd, sprintf("LoadModule %-18s %s", "${name}_module", "$dir$t")); - push(@amd, sprintf("AddModule %s", $filename)); - } - - # execute the commands - &execute_cmds(@cmds); - - # activate module via LoadModule/AddModule directive - if ($opt_a or $opt_A) { - if (not -f "$CFG_SYSCONFDIR/$CFG_TARGET.conf") { - print "apxs:Error: Config file $CFG_SYSCONFDIR/$CFG_TARGET.conf not found\n"; - exit(1); - } - - open(FP, "<$CFG_SYSCONFDIR/$CFG_TARGET.conf") || die; - my $content = join('', <FP>); - close(FP); - - if ($content !~ m|\n#?\s*LoadModule\s+|) { - print STDERR "apxs:Error: Activation failed for custom $CFG_SYSCONFDIR/$CFG_TARGET.conf file.\n"; - print STDERR "apxs:Error: At least one `LoadModule' directive already has to exist.\n"; - exit(1); - } - - my $lmd; - my $c = ''; - $c = '#' if ($opt_A); - foreach $lmd (@lmd) { - my $what = $opt_A ? "preparing" : "activating"; - if ($content !~ m|\n#?\s*$lmd|) { - $content =~ s|^(.*\n#?\s*LoadModule\s+[^\n]+\n)|$1$c$lmd\n|sg; - } else { - $content =~ s|^(.*\n)#?\s*$lmd[^\n]*\n|$1$c$lmd\n|sg; - } - $lmd =~ m|LoadModule\s+(.+?)_module.*|; - print STDERR "[$what module `$1' in $CFG_SYSCONFDIR/$CFG_TARGET.conf]\n"; - } - my $amd; - foreach $amd (@amd) { - if ($content !~ m|\n#?\s*$amd|) { - $content =~ s|^(.*\n#?\s*AddModule\s+[^\n]+\n)|$1$c$amd\n|sg; - } else { - $content =~ s|^(.*\n)#?\s*$amd[^\n]*\n|$1$c$amd\n|sg; - } - } - if (@lmd or @amd) { - if (open(FP, ">$CFG_SYSCONFDIR/$CFG_TARGET.conf.new")) { - print FP $content; - close(FP); - system("cp $CFG_SYSCONFDIR/$CFG_TARGET.conf $CFG_SYSCONFDIR/$CFG_TARGET.conf.bak && " . - "cp $CFG_SYSCONFDIR/$CFG_TARGET.conf.new $CFG_SYSCONFDIR/$CFG_TARGET.conf && " . - "rm $CFG_SYSCONFDIR/$CFG_TARGET.conf.new"); - } else { - print STDERR "unable to open configuration file\n"; - } - } - } -} - -##EOF## -__DATA__ -## -## Makefile -- Build procedure for sample %NAME% Apache module -## Autogenerated via ``apxs -n %NAME% -g''. -## - -# the used tools -APXS=apxs -APACHECTL=apachectl - -# additional defines, includes and libraries -#DEF=-Dmy_define=my_value -#INC=-Imy/include/dir -#LIB=-Lmy/lib/dir -lmylib - -# the default target -all: mod_%NAME%.la - -# compile the shared object file -mod_%NAME%.la: mod_%NAME%.c - $(APXS) -c $(DEF) $(INC) $(LIB) mod_%NAME%.c - -# install the shared object file into Apache -install: all - $(APXS) -i -a -n '%NAME%' mod_%NAME%.la - -# cleanup -clean: - -rm -f mod_%NAME%.o mod_%NAME%.lo mod_%NAME%.slo mod_%NAME%.la - -# simple test -test: reload - lynx -mime_header http://localhost/%NAME% - -# install and activate shared object by reloading Apache to -# force a reload of the shared object file -reload: install restart - -# the general Apache start/restart/stop -# procedures -start: - $(APACHECTL) start -restart: - $(APACHECTL) restart -stop: - $(APACHECTL) stop - --=#=- -/* -** mod_%NAME%.c -- Apache sample %NAME% module -** [Autogenerated via ``apxs -n %NAME% -g''] -** -** To play with this sample module first compile it into a -** DSO file and install it into Apache's modules directory -** by running: -** -** $ apxs -c -i mod_%NAME%.c -** -** Then activate it in Apache's %TARGET%.conf file for instance -** for the URL /%NAME% in as follows: -** -** # %TARGET%.conf -** LoadModule %NAME%_module modules/mod_%NAME%.so -** <Location /%NAME%> -** SetHandler %NAME% -** </Location> -** -** Then after restarting Apache via -** -** $ apachectl restart -** -** you immediately can request the URL /%NAME% and watch for the -** output of this module. This can be achieved for instance via: -** -** $ lynx -mime_header http://localhost/%NAME% -** -** The output should be similar to the following one: -** -** HTTP/1.1 200 OK -** Date: Tue, 31 Mar 1998 14:42:22 GMT -** Server: Apache/1.3.4 (Unix) -** Connection: close -** Content-Type: text/html -** -** The sample page from mod_%NAME%.c -*/ - -#include "httpd.h" -#include "http_config.h" -#include "http_protocol.h" -#include "ap_config.h" - -/* The sample content handler */ -static int %NAME%_handler(request_rec *r) -{ - if (strcmp(r->handler, "%NAME%")) { - return DECLINED; - } - r->content_type = "text/html"; - ap_send_http_header(r); - if (!r->header_only) - ap_rputs("The sample page from mod_%NAME%.c\n", r); - return OK; -} - -static void %NAME%_register_hooks(apr_pool_t *p) -{ - ap_hook_handler(%NAME%_handler, NULL, NULL, APR_HOOK_MIDDLE); -} - -/* Dispatch list for API hooks */ -module AP_MODULE_DECLARE_DATA %NAME%_module = { - STANDARD20_MODULE_STUFF, - NULL, /* create per-dir config structures */ - NULL, /* merge per-dir config structures */ - NULL, /* create per-server config structures */ - NULL, /* merge per-server config structures */ - NULL, /* table of config file commands */ - %NAME%_register_hooks /* register hooks */ -}; - diff --git a/support/dbmmanage b/support/dbmmanage deleted file mode 100644 index ad9a4aca76..0000000000 --- a/support/dbmmanage +++ /dev/null @@ -1,350 +0,0 @@ -#!/usr/bin/perl -# ==================================================================== -# The Apache Software License, Version 1.1 -# -# Copyright (c) 2000-2001 The Apache Software Foundation. All rights -# reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# -# 3. The end-user documentation included with the redistribution, -# if any, must include the following acknowledgment: -# "This product includes software developed by the -# Apache Software Foundation (http://www.apache.org/)." -# Alternately, this acknowledgment may appear in the software itself, -# if and wherever such third-party acknowledgments normally appear. -# -# 4. The names "Apache" and "Apache Software Foundation" must -# not be used to endorse or promote products derived from this -# software without prior written permission. For written -# permission, please contact apache@apache.org. -# -# 5. Products derived from this software may not be called "Apache", -# nor may "Apache" appear in their name, without prior written -# permission of the Apache Software Foundation. -# -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR -# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# ==================================================================== -# -# This software consists of voluntary contributions made by many -# individuals on behalf of the Apache Software Foundation. For more -# information on the Apache Software Foundation, please see -# <http://www.apache.org/>. -# - -#for more functionality see the HTTPD::UserAdmin module: -# http://www.perl.com/CPAN/modules/by-module/HTTPD/HTTPD-Tools-x.xx.tar.gz -# -# usage: dbmmanage <DBMfile> <command> <user> <password> <groups> <comment> - -package dbmmanage; -# -ldb -lndbm -lgdbm -lsdbm -BEGIN { @AnyDBM_File::ISA = qw(DB_File NDBM_File GDBM_File SDBM_File) } -use strict; -use Fcntl; -use AnyDBM_File (); - -sub usage { - my $cmds = join "|", sort keys %dbmc::; - die <<SYNTAX; -Usage: dbmmanage [enc] dbname command [username [pw [group[,group] [comment]]]] - - where enc is -d for crypt encryption (default except on Win32, Netware) - -m for MD5 encryption (default on Win32, Netware) - -s for SHA1 encryption - -p for plaintext - - command is one of: $cmds - - pw of . for update command retains the old password - pw of - (or blank) for update command prompts for the password - - groups or comment of . (or blank) for update command retains old values - groups or comment of - for update command clears the existing value - groups or comment of - for add and adduser commands is the empty value -SYNTAX -} - -sub need_sha1_crypt { - if (!eval ('require "Digest/SHA1.pm";')) { - print STDERR <<SHAERR; -dbmmanage SHA1 passwords require the interface or the module Digest::SHA1 -available from CPAN: - - http://www.cpan.org/modules/by-module/Digest/Digest-MD5-2.12.tar.gz - -Please install Digest::SHA1 and try again, or use a different crypt option: - -SHAERR - usage(); - } -} - -sub need_md5_crypt { - if (!eval ('require "Crypt/PasswdMD5.pm";')) { - print STDERR <<MD5ERR; -dbmmanage MD5 passwords require the module Crypt::PasswdMD5 available from CPAN - - http://www.cpan.org/modules/by-module/Crypt/Crypt-PasswdMD5-1.1.tar.gz - -Please install Crypt::PasswdMD5 and try again, or use a different crypt option: - -MD5ERR - usage(); - } -} - -# if your osname is in $newstyle_salt, then use new style salt (starts with '_' and contains -# four bytes of iteration count and four bytes of salt). Otherwise, just use -# the traditional two-byte salt. -# see the man page on your system to decide if you have a newer crypt() lib. -# I believe that 4.4BSD derived systems do (at least BSD/OS 2.0 does). -# The new style crypt() allows up to 20 characters of the password to be -# significant rather than only 8. -# -my $newstyle_salt_platforms = join '|', qw{bsdos}; #others? -my $newstyle_salt = $^O =~ /(?:$newstyle_salt_platforms)/; - -# Some platforms just can't crypt() for Apache -# -my $crypt_not_supported_platforms = join '|', qw{MSWin32 NetWare}; #others? -my $crypt_not_supported = $^O =~ /(?:$crypt_not_supported_platforms)/; - -my $crypt_method = "crypt"; - -if ($crypt_not_supported) { - $crypt_method = "md5"; -} - -# Some platforms won't jump through our favorite hoops -# -my $not_unix_platforms = join '|', qw{MSWin32 NetWare}; #others? -my $not_unix = $^O =~ /(?:$not_unix_platforms)/; - -if ($crypt_not_supported) { - $crypt_method = "md5"; -} - -if (@ARGV[0] eq "-d") { - shift @ARGV; - if ($crypt_not_supported) { - print STDERR - "Warning: Apache/$^O does not support crypt()ed passwords!\n\n"; - } - $crypt_method = "crypt"; -} - -if (@ARGV[0] eq "-m") { - shift @ARGV; - $crypt_method = "md5"; -} - -if (@ARGV[0] eq "-p") { - shift @ARGV; - if (!$crypt_not_supported) { - print STDERR - "Warning: Apache/$^O does not support plaintext passwords!\n\n"; - } - $crypt_method = "plain"; -} - -if (@ARGV[0] eq "-s") { - shift @ARGV; - need_sha1_crypt(); - $crypt_method = "sha1"; -} - -if ($crypt_method eq "md5") { - need_md5_crypt(); -} - -my($file,$command,$key,$crypted_pwd,$groups,$comment) = @ARGV; - -usage() unless $file and $command and defined &{$dbmc::{$command}}; - -# remove extension if any -my $chop = join '|', qw{db.? pag dir}; -$file =~ s/\.($chop)$//; - -my $is_update = $command eq "update"; -my %DB = (); -my @range = (); -my($mode, $flags) = $command =~ - /^(?:view|check)$/ ? (0644, O_RDONLY) : (0644, O_RDWR|O_CREAT); - -tie (%DB, "AnyDBM_File", $file, $flags, $mode) || die "Can't tie $file: $!"; -dbmc->$command(); -untie %DB; - - -my $x; -sub genseed { - my $psf; - if ($not_unix) { - srand (time ^ $$ or time ^ ($$ + ($$ << 15))); - } - else { - for (qw(-xlwwa -le)) { - `ps $_ 2>/dev/null`; - $psf = $_, last unless $?; - } - srand (time ^ $$ ^ unpack("%L*", `ps $psf | gzip -f`)); - } - @range = (qw(. /), '0'..'9','a'..'z','A'..'Z'); - $x = int scalar @range; -} - -sub randchar { - join '', map $range[rand $x], 1..shift||1; -} - -sub saltpw_crypt { - genseed() unless @range; - return $newstyle_salt ? - join '', "_", randchar, "a..", randchar(4) : - randchar(2); -} - -sub cryptpw_crypt { - my ($pw, $salt) = @_; - $salt = saltpw_crypt unless $salt; - crypt $pw, $salt; -} - -sub saltpw_md5 { - genseed() unless @range; - randchar(8); -} - -sub cryptpw_md5 { - my($pw, $salt) = @_; - $salt = saltpw_md5 unless $salt; - Crypt::PasswdMD5::apache_md5_crypt($pw, $salt); -} - -sub cryptpw_sha1 { - my($pw, $salt) = @_; - '{SHA}' . Digest::SHA1::sha1_base64($pw) . "="; -} - -sub cryptpw { - if ($crypt_method eq "md5") { - return cryptpw_md5(@_); - } elsif ($crypt_method eq "sha1") { - return cryptpw_sha1(@_); - } elsif ($crypt_method eq "crypt") { - return cryptpw_crypt(@_); - } - @_[0]; # otherwise return plaintext -} - -sub getpass { - my $prompt = shift || "Enter password:"; - - unless($not_unix) { - open STDIN, "/dev/tty" or warn "couldn't open /dev/tty $!\n"; - system "stty -echo;"; - } - - my($c,$pwd); - print STDERR $prompt; - while (($c = getc(STDIN)) ne '' and $c ne "\n" and $c ne "\r") { - $pwd .= $c; - } - - system "stty echo" unless $not_unix; - print STDERR "\n"; - die "Can't use empty password!\n" unless length $pwd; - return $pwd; -} - -sub dbmc::update { - die "Sorry, user `$key' doesn't exist!\n" unless $DB{$key}; - $crypted_pwd = (split /:/, $DB{$key}, 3)[0] if $crypted_pwd eq '.'; - $groups = (split /:/, $DB{$key}, 3)[1] if !$groups || $groups eq '.'; - $comment = (split /:/, $DB{$key}, 3)[2] if !$comment || $comment eq '.'; - if (!$crypted_pwd || $crypted_pwd eq '-') { - dbmc->adduser; - } - else { - dbmc->add; - } -} - -sub dbmc::add { - die "Can't use empty password!\n" unless $crypted_pwd; - unless($is_update) { - die "Sorry, user `$key' already exists!\n" if $DB{$key}; - } - $groups = '' if $groups eq '-'; - $comment = '' if $comment eq '-'; - $groups .= ":" . $comment if $comment; - $crypted_pwd .= ":" . $groups if $groups; - $DB{$key} = $crypted_pwd; - my $action = $is_update ? "updated" : "added"; - print "User $key $action with password encrypted to $DB{$key} using $crypt_method\n"; -} - -sub dbmc::adduser { - my $value = getpass "New password:"; - die "They don't match, sorry.\n" unless getpass("Re-type new password:") eq $value; - $crypted_pwd = cryptpw $value; - dbmc->add; -} - -sub dbmc::delete { - die "Sorry, user `$key' doesn't exist!\n" unless $DB{$key}; - delete $DB{$key}, print "`$key' deleted\n"; -} - -sub dbmc::view { - print $key ? "$key:$DB{$key}\n" : map { "$_:$DB{$_}\n" if $DB{$_} } keys %DB; -} - -sub dbmc::check { - die "Sorry, user `$key' doesn't exist!\n" unless $DB{$key}; - my $chkpass = (split /:/, $DB{$key}, 3)[0]; - my $testpass = getpass(); - if (substr($chkpass, 0, 6) eq '$apr1$') { - need_md5_crypt; - $crypt_method = "md5"; - } elsif (substr($chkpass, 0, 5) eq '{SHA}') { - need_sha1_crypt; - $crypt_method = "sha1"; - } elsif (length($chkpass) == 13 && $chkpass ne $testpass) { - $crypt_method = "crypt"; - } else { - $crypt_method = "plain"; - } - print $crypt_method . (cryptpw($testpass, $chkpass) eq $chkpass - ? " password ok\n" : " password mismatch\n"); -} - -sub dbmc::import { - while(defined($_ = <STDIN>) and chomp) { - ($key,$crypted_pwd,$groups,$comment) = split /:/, $_, 4; - dbmc->add; - } -} - diff --git a/support/dbmmanage.in b/support/dbmmanage.in deleted file mode 100644 index 8c75637e1d..0000000000 --- a/support/dbmmanage.in +++ /dev/null @@ -1,350 +0,0 @@ -#!@perlbin@ -# ==================================================================== -# The Apache Software License, Version 1.1 -# -# Copyright (c) 2000-2001 The Apache Software Foundation. All rights -# reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# -# 3. The end-user documentation included with the redistribution, -# if any, must include the following acknowledgment: -# "This product includes software developed by the -# Apache Software Foundation (http://www.apache.org/)." -# Alternately, this acknowledgment may appear in the software itself, -# if and wherever such third-party acknowledgments normally appear. -# -# 4. The names "Apache" and "Apache Software Foundation" must -# not be used to endorse or promote products derived from this -# software without prior written permission. For written -# permission, please contact apache@apache.org. -# -# 5. Products derived from this software may not be called "Apache", -# nor may "Apache" appear in their name, without prior written -# permission of the Apache Software Foundation. -# -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR -# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# ==================================================================== -# -# This software consists of voluntary contributions made by many -# individuals on behalf of the Apache Software Foundation. For more -# information on the Apache Software Foundation, please see -# <http://www.apache.org/>. -# - -#for more functionality see the HTTPD::UserAdmin module: -# http://www.perl.com/CPAN/modules/by-module/HTTPD/HTTPD-Tools-x.xx.tar.gz -# -# usage: dbmmanage <DBMfile> <command> <user> <password> <groups> <comment> - -package dbmmanage; -# -ldb -lndbm -lgdbm -lsdbm -BEGIN { @AnyDBM_File::ISA = qw(DB_File NDBM_File GDBM_File SDBM_File) } -use strict; -use Fcntl; -use AnyDBM_File (); - -sub usage { - my $cmds = join "|", sort keys %dbmc::; - die <<SYNTAX; -Usage: dbmmanage [enc] dbname command [username [pw [group[,group] [comment]]]] - - where enc is -d for crypt encryption (default except on Win32, Netware) - -m for MD5 encryption (default on Win32, Netware) - -s for SHA1 encryption - -p for plaintext - - command is one of: $cmds - - pw of . for update command retains the old password - pw of - (or blank) for update command prompts for the password - - groups or comment of . (or blank) for update command retains old values - groups or comment of - for update command clears the existing value - groups or comment of - for add and adduser commands is the empty value -SYNTAX -} - -sub need_sha1_crypt { - if (!eval ('require "Digest/SHA1.pm";')) { - print STDERR <<SHAERR; -dbmmanage SHA1 passwords require the interface or the module Digest::SHA1 -available from CPAN: - - http://www.cpan.org/modules/by-module/Digest/Digest-MD5-2.12.tar.gz - -Please install Digest::SHA1 and try again, or use a different crypt option: - -SHAERR - usage(); - } -} - -sub need_md5_crypt { - if (!eval ('require "Crypt/PasswdMD5.pm";')) { - print STDERR <<MD5ERR; -dbmmanage MD5 passwords require the module Crypt::PasswdMD5 available from CPAN - - http://www.cpan.org/modules/by-module/Crypt/Crypt-PasswdMD5-1.1.tar.gz - -Please install Crypt::PasswdMD5 and try again, or use a different crypt option: - -MD5ERR - usage(); - } -} - -# if your osname is in $newstyle_salt, then use new style salt (starts with '_' and contains -# four bytes of iteration count and four bytes of salt). Otherwise, just use -# the traditional two-byte salt. -# see the man page on your system to decide if you have a newer crypt() lib. -# I believe that 4.4BSD derived systems do (at least BSD/OS 2.0 does). -# The new style crypt() allows up to 20 characters of the password to be -# significant rather than only 8. -# -my $newstyle_salt_platforms = join '|', qw{bsdos}; #others? -my $newstyle_salt = $^O =~ /(?:$newstyle_salt_platforms)/; - -# Some platforms just can't crypt() for Apache -# -my $crypt_not_supported_platforms = join '|', qw{MSWin32 NetWare}; #others? -my $crypt_not_supported = $^O =~ /(?:$crypt_not_supported_platforms)/; - -my $crypt_method = "crypt"; - -if ($crypt_not_supported) { - $crypt_method = "md5"; -} - -# Some platforms won't jump through our favorite hoops -# -my $not_unix_platforms = join '|', qw{MSWin32 NetWare}; #others? -my $not_unix = $^O =~ /(?:$not_unix_platforms)/; - -if ($crypt_not_supported) { - $crypt_method = "md5"; -} - -if (@ARGV[0] eq "-d") { - shift @ARGV; - if ($crypt_not_supported) { - print STDERR - "Warning: Apache/$^O does not support crypt()ed passwords!\n\n"; - } - $crypt_method = "crypt"; -} - -if (@ARGV[0] eq "-m") { - shift @ARGV; - $crypt_method = "md5"; -} - -if (@ARGV[0] eq "-p") { - shift @ARGV; - if (!$crypt_not_supported) { - print STDERR - "Warning: Apache/$^O does not support plaintext passwords!\n\n"; - } - $crypt_method = "plain"; -} - -if (@ARGV[0] eq "-s") { - shift @ARGV; - need_sha1_crypt(); - $crypt_method = "sha1"; -} - -if ($crypt_method eq "md5") { - need_md5_crypt(); -} - -my($file,$command,$key,$crypted_pwd,$groups,$comment) = @ARGV; - -usage() unless $file and $command and defined &{$dbmc::{$command}}; - -# remove extension if any -my $chop = join '|', qw{db.? pag dir}; -$file =~ s/\.($chop)$//; - -my $is_update = $command eq "update"; -my %DB = (); -my @range = (); -my($mode, $flags) = $command =~ - /^(?:view|check)$/ ? (0644, O_RDONLY) : (0644, O_RDWR|O_CREAT); - -tie (%DB, "AnyDBM_File", $file, $flags, $mode) || die "Can't tie $file: $!"; -dbmc->$command(); -untie %DB; - - -my $x; -sub genseed { - my $psf; - if ($not_unix) { - srand (time ^ $$ or time ^ ($$ + ($$ << 15))); - } - else { - for (qw(-xlwwa -le)) { - `ps $_ 2>/dev/null`; - $psf = $_, last unless $?; - } - srand (time ^ $$ ^ unpack("%L*", `ps $psf | gzip -f`)); - } - @range = (qw(. /), '0'..'9','a'..'z','A'..'Z'); - $x = int scalar @range; -} - -sub randchar { - join '', map $range[rand $x], 1..shift||1; -} - -sub saltpw_crypt { - genseed() unless @range; - return $newstyle_salt ? - join '', "_", randchar, "a..", randchar(4) : - randchar(2); -} - -sub cryptpw_crypt { - my ($pw, $salt) = @_; - $salt = saltpw_crypt unless $salt; - crypt $pw, $salt; -} - -sub saltpw_md5 { - genseed() unless @range; - randchar(8); -} - -sub cryptpw_md5 { - my($pw, $salt) = @_; - $salt = saltpw_md5 unless $salt; - Crypt::PasswdMD5::apache_md5_crypt($pw, $salt); -} - -sub cryptpw_sha1 { - my($pw, $salt) = @_; - '{SHA}' . Digest::SHA1::sha1_base64($pw) . "="; -} - -sub cryptpw { - if ($crypt_method eq "md5") { - return cryptpw_md5(@_); - } elsif ($crypt_method eq "sha1") { - return cryptpw_sha1(@_); - } elsif ($crypt_method eq "crypt") { - return cryptpw_crypt(@_); - } - @_[0]; # otherwise return plaintext -} - -sub getpass { - my $prompt = shift || "Enter password:"; - - unless($not_unix) { - open STDIN, "/dev/tty" or warn "couldn't open /dev/tty $!\n"; - system "stty -echo;"; - } - - my($c,$pwd); - print STDERR $prompt; - while (($c = getc(STDIN)) ne '' and $c ne "\n" and $c ne "\r") { - $pwd .= $c; - } - - system "stty echo" unless $not_unix; - print STDERR "\n"; - die "Can't use empty password!\n" unless length $pwd; - return $pwd; -} - -sub dbmc::update { - die "Sorry, user `$key' doesn't exist!\n" unless $DB{$key}; - $crypted_pwd = (split /:/, $DB{$key}, 3)[0] if $crypted_pwd eq '.'; - $groups = (split /:/, $DB{$key}, 3)[1] if !$groups || $groups eq '.'; - $comment = (split /:/, $DB{$key}, 3)[2] if !$comment || $comment eq '.'; - if (!$crypted_pwd || $crypted_pwd eq '-') { - dbmc->adduser; - } - else { - dbmc->add; - } -} - -sub dbmc::add { - die "Can't use empty password!\n" unless $crypted_pwd; - unless($is_update) { - die "Sorry, user `$key' already exists!\n" if $DB{$key}; - } - $groups = '' if $groups eq '-'; - $comment = '' if $comment eq '-'; - $groups .= ":" . $comment if $comment; - $crypted_pwd .= ":" . $groups if $groups; - $DB{$key} = $crypted_pwd; - my $action = $is_update ? "updated" : "added"; - print "User $key $action with password encrypted to $DB{$key} using $crypt_method\n"; -} - -sub dbmc::adduser { - my $value = getpass "New password:"; - die "They don't match, sorry.\n" unless getpass("Re-type new password:") eq $value; - $crypted_pwd = cryptpw $value; - dbmc->add; -} - -sub dbmc::delete { - die "Sorry, user `$key' doesn't exist!\n" unless $DB{$key}; - delete $DB{$key}, print "`$key' deleted\n"; -} - -sub dbmc::view { - print $key ? "$key:$DB{$key}\n" : map { "$_:$DB{$_}\n" if $DB{$_} } keys %DB; -} - -sub dbmc::check { - die "Sorry, user `$key' doesn't exist!\n" unless $DB{$key}; - my $chkpass = (split /:/, $DB{$key}, 3)[0]; - my $testpass = getpass(); - if (substr($chkpass, 0, 6) eq '$apr1$') { - need_md5_crypt; - $crypt_method = "md5"; - } elsif (substr($chkpass, 0, 5) eq '{SHA}') { - need_sha1_crypt; - $crypt_method = "sha1"; - } elsif (length($chkpass) == 13 && $chkpass ne $testpass) { - $crypt_method = "crypt"; - } else { - $crypt_method = "plain"; - } - print $crypt_method . (cryptpw($testpass, $chkpass) eq $chkpass - ? " password ok\n" : " password mismatch\n"); -} - -sub dbmc::import { - while(defined($_ = <STDIN>) and chomp) { - ($key,$crypted_pwd,$groups,$comment) = split /:/, $_, 4; - dbmc->add; - } -} - diff --git a/support/htdigest.c b/support/htdigest.c deleted file mode 100644 index 987bd629a6..0000000000 --- a/support/htdigest.c +++ /dev/null @@ -1,318 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ - -/****************************************************************************** - ****************************************************************************** - * NOTE! This program is not safe as a setuid executable! Do not make it - * setuid! - ****************************************************************************** - *****************************************************************************/ -/* - * htdigest.c: simple program for manipulating digest passwd file for Apache - * - * by Alexei Kosut, based on htpasswd.c, by Rob McCool - */ - -#include "apr.h" -#include "apr_file_io.h" -#include "apr_md5.h" -#include "apr_lib.h" /* for apr_getpass() */ -#include "apr_general.h" -#include "apr_signal.h" - -#define APR_WANT_STDIO -#include "apr_want.h" - -#if APR_HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif -#if APR_HAVE_STDLIB_H -#include <stdlib.h> -#endif - -#ifdef WIN32 -#include <conio.h> -#endif - - -#if APR_CHARSET_EBCDIC -#define LF '\n' -#define CR '\r' -#else -#define LF 10 -#define CR 13 -#endif /* APR_CHARSET_EBCDIC */ - -#define MAX_STRING_LEN 256 - -char *tn; -apr_pool_t *cntxt; -#if APR_CHARSET_EBCDIC -apr_xlate_t *to_ascii; -#endif - -static void getword(char *word, char *line, char stop) -{ - int x = 0, y; - - for (x = 0; ((line[x]) && (line[x] != stop)); x++) - word[x] = line[x]; - - word[x] = '\0'; - if (line[x]) - ++x; - y = 0; - - while ((line[y++] = line[x++])); -} - -static int getline(char *s, int n, apr_file_t *f) -{ - register int i = 0; - char ch; - - while (1) { - apr_file_getc(&ch, f); - s[i] = ch; - - if (s[i] == CR) - apr_file_getc(&ch, f); - s[i] = ch; - - if ((s[i] == 0x4) || (s[i] == LF) || (i == (n - 1))) { - s[i] = '\0'; - if (apr_file_eof(f) == APR_EOF) { - return 1; - } - return 0; - } - ++i; - } -} - -static void putline(apr_file_t *f, char *l) -{ - int x; - - for (x = 0; l[x]; x++) - apr_file_putc(l[x], f); - apr_file_putc('\n', f); -} - - -static void add_password(char *user, char *realm, apr_file_t *f) -{ - char *pw; - apr_md5_ctx_t context; - unsigned char digest[16]; - char string[MAX_STRING_LEN]; - char pwin[MAX_STRING_LEN]; - char pwv[MAX_STRING_LEN]; - unsigned int i; - size_t len = sizeof(pwin); - - if (apr_password_get("New password: ", pwin, &len) != APR_SUCCESS) { - fprintf(stderr, "password too long"); - exit(5); - } - len = sizeof(pwin); - apr_password_get("Re-type new password: ", pwv, &len); - if (strcmp(pwin, pwv) != 0) { - fprintf(stderr, "They don't match, sorry.\n"); - if (tn) { - apr_file_remove(tn, cntxt); - } - exit(1); - } - pw = pwin; - apr_file_printf(f, "%s:%s:", user, realm); - - /* Do MD5 stuff */ - sprintf(string, "%s:%s:%s", user, realm, pw); - - apr_md5_init(&context); -#if APR_CHARSET_EBCDIC - apr_md5_set_xlate(&context, to_ascii); -#endif - apr_md5_update(&context, (unsigned char *) string, strlen(string)); - apr_md5_final(digest, &context); - - for (i = 0; i < 16; i++) - apr_file_printf(f, "%02x", digest[i]); - - apr_file_printf(f, "\n"); -} - -static void usage(void) -{ - fprintf(stderr, "Usage: htdigest [-c] passwordfile realm username\n"); - fprintf(stderr, "The -c flag creates a new file.\n"); - exit(1); -} - -static void interrupted(void) -{ - fprintf(stderr, "Interrupted.\n"); - if (tn) - apr_file_remove(tn, cntxt); - exit(1); -} - -static void terminate(void) -{ - apr_terminate(); -} - -int main(int argc, char *argv[]) -{ - apr_file_t *tfp = NULL, *f; - apr_status_t rv; - char user[MAX_STRING_LEN]; - char realm[MAX_STRING_LEN]; - char line[MAX_STRING_LEN]; - char l[MAX_STRING_LEN]; - char w[MAX_STRING_LEN]; - char x[MAX_STRING_LEN]; - char command[MAX_STRING_LEN]; - int found; - - rv = apr_initialize(); - if (rv) { - fprintf(stderr, "apr_initialize(): %s (%d)\n", - apr_strerror(rv, line, sizeof(line)), rv); - exit(1); - } - atexit(terminate); - apr_pool_create(&cntxt, NULL); - -#if APR_CHARSET_EBCDIC - rv = apr_xlate_open(&to_ascii, "ISO8859-1", APR_DEFAULT_CHARSET, cntxt); - if (rv) { - fprintf(stderr, "apr_xlate_open(): %s (%d)\n", - apr_strerror(rv, line, sizeof(line)), rv); - exit(1); - } -#endif - - tn = NULL; - apr_signal(SIGINT, (void (*)(int)) interrupted); - if (argc == 5) { - if (strcmp(argv[1], "-c")) - usage(); - rv = apr_file_open(&tfp, argv[2], APR_WRITE | APR_CREATE, -1, cntxt); - if (rv != APR_SUCCESS) { - char errmsg[120]; - - fprintf(stderr, "Could not open passwd file %s for writing: %s\n", - argv[2], - apr_strerror(rv, errmsg, sizeof errmsg)); - exit(1); - } - printf("Adding password for %s in realm %s.\n", argv[4], argv[3]); - add_password(argv[4], argv[3], tfp); - apr_file_close(tfp); - exit(0); - } - else if (argc != 4) - usage(); - - tn = tmpnam(NULL); - if (apr_file_open(&tfp, tn, APR_WRITE | APR_CREATE, -1, cntxt)!= APR_SUCCESS) { - fprintf(stderr, "Could not open temp file.\n"); - exit(1); - } - - if (apr_file_open(&f, argv[1], APR_READ, -1, cntxt) != APR_SUCCESS) { - fprintf(stderr, - "Could not open passwd file %s for reading.\n", argv[1]); - fprintf(stderr, "Use -c option to create new one.\n"); - exit(1); - } - strcpy(user, argv[3]); - strcpy(realm, argv[2]); - - found = 0; - while (!(getline(line, MAX_STRING_LEN, f))) { - if (found || (line[0] == '#') || (!line[0])) { - putline(tfp, line); - continue; - } - strcpy(l, line); - getword(w, l, ':'); - getword(x, l, ':'); - if (strcmp(user, w) || strcmp(realm, x)) { - putline(tfp, line); - continue; - } - else { - printf("Changing password for user %s in realm %s\n", user, realm); - add_password(user, realm, tfp); - found = 1; - } - } - if (!found) { - printf("Adding user %s in realm %s\n", user, realm); - add_password(user, realm, tfp); - } - apr_file_close(f); - apr_file_close(tfp); -#if defined(OS2) || defined(WIN32) - sprintf(command, "copy \"%s\" \"%s\"", tn, argv[1]); -#else - sprintf(command, "cp %s %s", tn, argv[1]); -#endif - system(command); - apr_file_remove(tn, cntxt); - return 0; -} diff --git a/support/htdigest.dsp b/support/htdigest.dsp deleted file mode 100644 index 2096019b94..0000000000 --- a/support/htdigest.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="htdigest" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=htdigest - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "htdigest.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "htdigest.mak" CFG="htdigest - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "htdigest - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "htdigest - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "htdigest - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fd"Release/htdigest" /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /incremental:no /map /machine:I386 -# ADD LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /incremental:no /map /machine:I386 - -!ELSEIF "$(CFG)" == "htdigest - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fd"Debug/htdigest" /FD /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /incremental:no /map /debug /machine:I386 -# ADD LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /incremental:no /map /debug /machine:I386 - -!ENDIF - -# Begin Target - -# Name "htdigest - Win32 Release" -# Name "htdigest - Win32 Debug" -# Begin Source File - -SOURCE=.\htdigest.c -# End Source File -# End Target -# End Project diff --git a/support/htdigest.mak b/support/htdigest.mak deleted file mode 100644 index 838178174f..0000000000 --- a/support/htdigest.mak +++ /dev/null @@ -1,291 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on htdigest.dsp -!IF "$(CFG)" == "" -CFG=htdigest - Win32 Debug -!MESSAGE No configuration specified. Defaulting to htdigest - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "htdigest - Win32 Release" && "$(CFG)" !=\ - "htdigest - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "htdigest.mak" CFG="htdigest - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "htdigest - Win32 Release" (based on\ - "Win32 (x86) Console Application") -!MESSAGE "htdigest - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "htdigest - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\htdigest.exe" - -!ELSE - -ALL : "aprutil - Win32 Release" "apr - Win32 Release" "$(OUTDIR)\htdigest.exe" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"apr - Win32 ReleaseCLEAN" "aprutil - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\htdigest.idb" - -@erase "$(INTDIR)\htdigest.obj" - -@erase "$(OUTDIR)\htdigest.exe" - -@erase "$(OUTDIR)\htdigest.map" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /I "../srclib/apr/include" /I\ - "../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D\ - "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\"\ - /Fd"$(INTDIR)\htdigest" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\htdigest.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo\ - /subsystem:console /incremental:no /pdb:"$(OUTDIR)\htdigest.pdb"\ - /map:"$(INTDIR)\htdigest.map" /machine:I386 /out:"$(OUTDIR)\htdigest.exe" -LINK32_OBJS= \ - "$(INTDIR)\htdigest.obj" \ - "..\srclib\apr-util\LibR\aprutil.lib" \ - "..\srclib\apr\LibR\apr.lib" - -"$(OUTDIR)\htdigest.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "htdigest - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\htdigest.exe" - -!ELSE - -ALL : "aprutil - Win32 Debug" "apr - Win32 Debug" "$(OUTDIR)\htdigest.exe" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"apr - Win32 DebugCLEAN" "aprutil - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\htdigest.idb" - -@erase "$(INTDIR)\htdigest.obj" - -@erase "$(OUTDIR)\htdigest.exe" - -@erase "$(OUTDIR)\htdigest.map" - -@erase "$(OUTDIR)\htdigest.pdb" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MDd /W3 /GX /Zi /Od /I "../srclib/apr/include" /I\ - "../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D\ - "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\"\ - /Fd"$(INTDIR)\htdigest" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\htdigest.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo\ - /subsystem:console /incremental:no /pdb:"$(OUTDIR)\htdigest.pdb"\ - /map:"$(INTDIR)\htdigest.map" /debug /machine:I386\ - /out:"$(OUTDIR)\htdigest.exe" -LINK32_OBJS= \ - "$(INTDIR)\htdigest.obj" \ - "..\srclib\apr-util\LibD\aprutil.lib" \ - "..\srclib\apr\LibD\apr.lib" - -"$(OUTDIR)\htdigest.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "htdigest - Win32 Release" || "$(CFG)" ==\ - "htdigest - Win32 Debug" - -!IF "$(CFG)" == "htdigest - Win32 Release" - -"apr - Win32 Release" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\apr.mak CFG="apr - Win32 Release" - cd "..\..\support" - -"apr - Win32 ReleaseCLEAN" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\apr.mak CFG="apr - Win32 Release" RECURSE=1\ - - cd "..\..\support" - -!ELSEIF "$(CFG)" == "htdigest - Win32 Debug" - -"apr - Win32 Debug" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\apr.mak CFG="apr - Win32 Debug" - cd "..\..\support" - -"apr - Win32 DebugCLEAN" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\apr.mak CFG="apr - Win32 Debug" RECURSE=1 - cd "..\..\support" - -!ENDIF - -!IF "$(CFG)" == "htdigest - Win32 Release" - -"aprutil - Win32 Release" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release" - cd "..\..\support" - -"aprutil - Win32 ReleaseCLEAN" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\aprutil.mak" CFG="aprutil - Win32 Release"\ - RECURSE=1 - cd "..\..\support" - -!ELSEIF "$(CFG)" == "htdigest - Win32 Debug" - -"aprutil - Win32 Debug" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug" - cd "..\..\support" - -"aprutil - Win32 DebugCLEAN" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\aprutil.mak" CFG="aprutil - Win32 Debug"\ - RECURSE=1 - cd "..\..\support" - -!ENDIF - -SOURCE=.\htdigest.c -DEP_CPP_HTDIG=\ - "..\srclib\apr\include\apr.h"\ - "..\srclib\apr\include\apr_errno.h"\ - "..\srclib\apr\include\apr_file_info.h"\ - "..\srclib\apr\include\apr_file_io.h"\ - "..\srclib\apr\include\apr_general.h"\ - "..\srclib\apr\include\apr_lib.h"\ - "..\srclib\apr\include\apr_md5.h"\ - "..\srclib\apr\include\apr_pools.h"\ - "..\srclib\apr\include\apr_signal.h"\ - "..\srclib\apr\include\apr_time.h"\ - "..\srclib\apr\include\apr_user.h"\ - "..\srclib\apr\include\apr_want.h"\ - "..\srclib\apr\include\apr_xlate.h"\ - - -"$(INTDIR)\htdigest.obj" : $(SOURCE) $(DEP_CPP_HTDIG) "$(INTDIR)" - - - -!ENDIF - diff --git a/support/htpasswd.c b/support/htpasswd.c deleted file mode 100644 index bfbbcabeb1..0000000000 --- a/support/htpasswd.c +++ /dev/null @@ -1,679 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - * - * Portions of this software are based upon public domain software - * originally written at the National Center for Supercomputing Applications, - * University of Illinois, Urbana-Champaign. - */ - -/****************************************************************************** - ****************************************************************************** - * NOTE! This program is not safe as a setuid executable! Do not make it - * setuid! - ****************************************************************************** - *****************************************************************************/ -/* - * htpasswd.c: simple program for manipulating password file for - * the Apache HTTP server - * - * Originally by Rob McCool - * - * Exit values: - * 0: Success - * 1: Failure; file access/permission problem - * 2: Failure; command line syntax problem (usage message issued) - * 3: Failure; password verification failure - * 4: Failure; operation interrupted (such as with CTRL/C) - * 5: Failure; buffer would overflow (username, filename, or computed - * record too long) - * 6: Failure; username contains illegal or reserved characters - */ - -#include "apr.h" -#include "apr_lib.h" -#include "apr_strings.h" -#include "apr_errno.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr_signal.h" - -#if APR_HAVE_STDIO_H -#include <stdio.h> -#endif - -#include "apr_md5.h" -#include "apr_sha1.h" -#include <time.h> - -#if APR_HAVE_CRYPT_H -#include <crypt.h> -#endif -#if APR_HAVE_STDLIB_H -#include <stdlib.h> -#endif -#if APR_HAVE_STRING_H -#include <string.h> -#endif -#if APR_HAVE_UNISTD_H -#include <unistd.h> -#endif - -#ifdef WIN32 -#include <conio.h> -#define unlink _unlink -#endif - -#if !APR_CHARSET_EBCDIC -#define LF 10 -#define CR 13 -#else /*APR_CHARSET_EBCDIC*/ -#define LF '\n' -#define CR '\r' -#endif /*APR_CHARSET_EBCDIC*/ - -#define MAX_STRING_LEN 256 -#define ALG_PLAIN 0 -#define ALG_CRYPT 1 -#define ALG_APMD5 2 -#define ALG_APSHA 3 - -#define ERR_FILEPERM 1 -#define ERR_SYNTAX 2 -#define ERR_PWMISMATCH 3 -#define ERR_INTERRUPTED 4 -#define ERR_OVERFLOW 5 -#define ERR_BADUSER 6 - -/* - * This needs to be declared statically so the signal handler can - * access it. - */ -static char *tempfilename; -/* - * If our platform knows about the tmpnam() external buffer size, create - * a buffer to pass in. This is needed in a threaded environment, or - * one that thinks it is (like HP-UX). - */ -#ifdef L_tmpnam -static char tname_buf[L_tmpnam]; -#else -static char *tname_buf = NULL; -#endif - -/* - * Get a line of input from the user, not including any terminating - * newline. - */ -static int getline(char *s, int n, FILE *f) -{ - register int i = 0; - - while (1) { - s[i] = (char) fgetc(f); - - if (s[i] == CR) { - s[i] = fgetc(f); - } - - if ((s[i] == 0x4) || (s[i] == LF) || (i == (n - 1))) { - s[i] = '\0'; - return (feof(f) ? 1 : 0); - } - ++i; - } -} - -static void putline(FILE *f, char *l) -{ - int x; - - for (x = 0; l[x]; x++) { - fputc(l[x], f); - } - fputc('\n', f); -} - -static void to64(char *s, unsigned long v, int n) -{ - static unsigned char itoa64[] = /* 0 ... 63 => ASCII - 64 */ - "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - - while (--n >= 0) { - *s++ = itoa64[v&0x3f]; - v >>= 6; - } -} - -/* - * Make a password record from the given information. A zero return - * indicates success; failure means that the output buffer contains an - * error message instead. - */ -static int mkrecord(char *user, char *record, size_t rlen, char *passwd, - int alg) -{ - char *pw; - char cpw[120]; - char pwin[MAX_STRING_LEN]; - char pwv[MAX_STRING_LEN]; - char salt[9]; - size_t bufsize; - - if (passwd != NULL) { - pw = passwd; - } - else { - bufsize = sizeof(pwin); - if (apr_password_get("New password: ", pwin, &bufsize) != 0) { - apr_snprintf(record, (rlen - 1), "password too long (>%" APR_SIZE_T_FMT - ")", sizeof(pwin) - 1); - return ERR_OVERFLOW; - } - bufsize = sizeof(pwv); - apr_password_get("Re-type new password: ", pwv, &bufsize); - if (strcmp(pwin, pwv) != 0) { - apr_cpystrn(record, "password verification error", (rlen - 1)); - return ERR_PWMISMATCH; - } - pw = pwin; - memset(pwv, '\0', sizeof(pwin)); - } - switch (alg) { - - case ALG_APSHA: - /* XXX cpw >= 28 + strlen(sha1) chars - fixed len SHA */ - apr_sha1_base64(pw,strlen(pw),cpw); - break; - - case ALG_APMD5: - (void) srand((int) time((time_t *) NULL)); - to64(&salt[0], rand(), 8); - salt[8] = '\0'; - - apr_md5_encode((const char *)pw, (const char *)salt, - cpw, sizeof(cpw)); - break; - - case ALG_PLAIN: - /* XXX this len limitation is not in sync with any HTTPd len. */ - apr_cpystrn(cpw,pw,sizeof(cpw)); - break; - -#ifndef WIN32 - case ALG_CRYPT: - default: - (void) srand((int) time((time_t *) NULL)); - to64(&salt[0], rand(), 8); - salt[8] = '\0'; - - apr_cpystrn(cpw, (char *)crypt(pw, salt), sizeof(cpw) - 1); - break; -#endif - } - memset(pw, '\0', strlen(pw)); - - /* - * Check to see if the buffer is large enough to hold the username, - * hash, and delimiters. - */ - if ((strlen(user) + 1 + strlen(cpw)) > (rlen - 1)) { - apr_cpystrn(record, "resultant record too long", (rlen - 1)); - return ERR_OVERFLOW; - } - strcpy(record, user); - strcat(record, ":"); - strcat(record, cpw); - return 0; -} - -static int usage(void) -{ - fprintf(stderr, "Usage:\n"); - fprintf(stderr, "\thtpasswd [-cmdps] passwordfile username\n"); - fprintf(stderr, "\thtpasswd -b[cmdps] passwordfile username password\n\n"); - fprintf(stderr, "\thtpasswd -n[mdps] username\n"); - fprintf(stderr, "\thtpasswd -nb[mdps] username password\n"); - fprintf(stderr, " -c Create a new file.\n"); - fprintf(stderr, " -n Don't update file; display results on stdout.\n"); - fprintf(stderr, " -m Force MD5 encryption of the password" -#if defined(WIN32) || defined(TPF) - " (default)" -#endif - ".\n"); - fprintf(stderr, " -d Force CRYPT encryption of the password" -#if (!(defined(WIN32) || defined(TPF))) - " (default)" -#endif - ".\n"); - fprintf(stderr, " -p Do not encrypt the password (plaintext).\n"); - fprintf(stderr, " -s Force SHA encryption of the password.\n"); - fprintf(stderr, " -b Use the password from the command line rather " - "than prompting for it.\n"); - fprintf(stderr, - "On Windows and TPF systems the '-m' flag is used by default.\n"); - fprintf(stderr, - "On all other systems, the '-p' flag will probably not work.\n"); - return ERR_SYNTAX; -} - -static void interrupted(void) -{ - fprintf(stderr, "Interrupted.\n"); - if (tempfilename != NULL) { - unlink(tempfilename); - } - exit(ERR_INTERRUPTED); -} - -/* - * Check to see if the specified file can be opened for the given - * access. - */ -static int accessible(char *fname, char *mode) -{ - FILE *s; - - s = fopen(fname, mode); - if (s == NULL) { - return 0; - } - fclose(s); - return 1; -} - -/* - * Return true if a file is readable. - */ -static int readable(char *fname) -{ - return accessible(fname, "r"); -} - -/* - * Return true if the specified file can be opened for write access. - */ -static int writable(char *fname) -{ - return accessible(fname, "a"); -} - -/* - * Return true if the named file exists, regardless of permissions. - */ -static int exists(char *fname) -{ - apr_finfo_t sbuf; - apr_status_t check; - - check = apr_stat(&sbuf, fname, APR_FINFO_NORM, NULL); - return (check ? 0 : 1); -} - -/* - * Copy from the current position of one file to the current position - * of another. - */ -static void copy_file(FILE *target, FILE *source) -{ - static char line[MAX_STRING_LEN]; - - while (fgets(line, sizeof(line), source) != NULL) { - fputs(line, target); - } -} - -/* - * Let's do it. We end up doing a lot of file opening and closing, - * but what do we care? This application isn't run constantly. - */ -int main(int argc, char *argv[]) -{ - FILE *ftemp = NULL; - FILE *fpw = NULL; - char user[MAX_STRING_LEN]; - char password[MAX_STRING_LEN]; - char record[MAX_STRING_LEN]; - char line[MAX_STRING_LEN]; - char pwfilename[MAX_STRING_LEN]; - char *arg; - int found = 0; - int alg = ALG_CRYPT; - int newfile = 0; - int nofile = 0; - int noninteractive = 0; - int i; - int args_left = 2; -#if APR_CHARSET_EBCDIC - apr_pool_t *pool; - apr_status_t rv; - apr_xlate_t *to_ascii; - - apr_initialize(); - atexit(apr_terminate); - apr_pool_create(&pool, NULL); - - rv = apr_xlate_open(&to_ascii, "ISO8859-1", APR_DEFAULT_CHARSET, pool); - if (rv) { - fprintf(stderr, "apr_xlate_open(to ASCII)->%d\n", rv); - exit(1); - } - rv = apr_SHA1InitEBCDIC(to_ascii); - if (rv) { - fprintf(stderr, "apr_SHA1InitEBCDIC()->%d\n", rv); - exit(1); - } - rv = apr_MD5InitEBCDIC(to_ascii); - if (rv) { - fprintf(stderr, "apr_MD5InitEBCDIC()->%d\n", rv); - exit(1); - } -#endif /*APR_CHARSET_EBCDIC*/ - - tempfilename = NULL; - apr_signal(SIGINT, (void (*)(int)) interrupted); - - /* - * Preliminary check to make sure they provided at least - * three arguments, we'll do better argument checking as - * we parse the command line. - */ - if (argc < 3) { - return usage(); - } - - /* - * Go through the argument list and pick out any options. They - * have to precede any other arguments. - */ - for (i = 1; i < argc; i++) { - arg = argv[i]; - if (*arg != '-') { - break; - } - while (*++arg != '\0') { - if (*arg == 'c') { - newfile++; - } - else if (*arg == 'n') { - nofile++; - args_left--; - } - else if (*arg == 'm') { - alg = ALG_APMD5; - } - else if (*arg == 's') { - alg = ALG_APSHA; - } - else if (*arg == 'p') { - alg = ALG_PLAIN; - } - else if (*arg == 'd') { - alg = ALG_CRYPT; - } - else if (*arg == 'b') { - noninteractive++; - args_left++; - } - else { - return usage(); - } - } - } - - /* - * Make sure we still have exactly the right number of arguments left - * (the filename, the username, and possibly the password if -b was - * specified). - */ - if ((argc - i) != args_left) { - return usage(); - } - if (newfile && nofile) { - fprintf(stderr, "%s: -c and -n options conflict\n", argv[0]); - return ERR_SYNTAX; - } - if (nofile) { - i--; - } - else { - if (strlen(argv[i]) > (sizeof(pwfilename) - 1)) { - fprintf(stderr, "%s: filename too long\n", argv[0]); - return ERR_OVERFLOW; - } - strcpy(pwfilename, argv[i]); - if (strlen(argv[i + 1]) > (sizeof(user) - 1)) { - fprintf(stderr, "%s: username too long (>%" APR_SIZE_T_FMT ")\n", - argv[0], sizeof(user) - 1); - return ERR_OVERFLOW; - } - } - strcpy(user, argv[i + 1]); - if ((arg = strchr(user, ':')) != NULL) { - fprintf(stderr, "%s: username contains illegal character '%c'\n", - argv[0], *arg); - return ERR_BADUSER; - } - if (noninteractive) { - if (strlen(argv[i + 2]) > (sizeof(password) - 1)) { - fprintf(stderr, "%s: password too long (>%" APR_SIZE_T_FMT ")\n", - argv[0], sizeof(password) - 1); - return ERR_OVERFLOW; - } - strcpy(password, argv[i + 2]); - } - -#ifdef WIN32 - if (alg == ALG_CRYPT) { - alg = ALG_APMD5; - fprintf(stderr, "Automatically using MD5 format on Windows.\n"); - } -#endif - -#if (!(defined(WIN32) || defined(TPF))) - if (alg == ALG_PLAIN) { - fprintf(stderr,"Warning: storing passwords as plain text might " - "just not work on this platform.\n"); - } -#endif - if (! nofile) { - /* - * Only do the file checks if we're supposed to frob it. - * - * Verify that the file exists if -c was omitted. We give a special - * message if it doesn't. - */ - if ((! newfile) && (! exists(pwfilename))) { - fprintf(stderr, - "%s: cannot modify file %s; use '-c' to create it\n", - argv[0], pwfilename); - perror("fopen"); - exit(ERR_FILEPERM); - } - /* - * Verify that we can read the existing file in the case of an update - * to it (rather than creation of a new one). - */ - if ((! newfile) && (! readable(pwfilename))) { - fprintf(stderr, "%s: cannot open file %s for read access\n", - argv[0], pwfilename); - perror("fopen"); - exit(ERR_FILEPERM); - } - /* - * Now check to see if we can preserve an existing file in case - * of password verification errors on a -c operation. - */ - if (newfile && exists(pwfilename) && (! readable(pwfilename))) { - fprintf(stderr, "%s: cannot open file %s for read access\n" - "%s: existing auth data would be lost on " - "password mismatch", - argv[0], pwfilename, argv[0]); - perror("fopen"); - exit(ERR_FILEPERM); - } - /* - * Now verify that the file is writable! - */ - if (! writable(pwfilename)) { - fprintf(stderr, "%s: cannot open file %s for write access\n", - argv[0], pwfilename); - perror("fopen"); - exit(ERR_FILEPERM); - } - } - - /* - * All the file access checks (if any) have been made. Time to go to work; - * try to create the record for the username in question. If that - * fails, there's no need to waste any time on file manipulations. - * Any error message text is returned in the record buffer, since - * the mkrecord() routine doesn't have access to argv[]. - */ - i = mkrecord(user, record, sizeof(record) - 1, - noninteractive ? password : NULL, - alg); - if (i != 0) { - fprintf(stderr, "%s: %s\n", argv[0], record); - exit(i); - } - if (nofile) { - printf("%s\n", record); - exit(0); - } - - /* - * We can access the files the right way, and we have a record - * to add or update. Let's do it.. - */ - errno = 0; - tempfilename = tmpnam(tname_buf); - if ((tempfilename == NULL) || (*tempfilename == '\0')) { - fprintf(stderr, "%s: unable to generate temporary filename\n", - argv[0]); - if (errno == 0) { - errno = ENOENT; - } - perror("tmpnam"); - exit(ERR_FILEPERM); - } - ftemp = fopen(tempfilename, "w+"); - if (ftemp == NULL) { - fprintf(stderr, "%s: unable to create temporary file '%s'\n", argv[0], - tempfilename); - perror("fopen"); - exit(ERR_FILEPERM); - } - /* - * If we're not creating a new file, copy records from the existing - * one to the temporary file until we find the specified user. - */ - if (! newfile) { - char scratch[MAX_STRING_LEN]; - - fpw = fopen(pwfilename, "r"); - while (! (getline(line, sizeof(line), fpw))) { - char *colon; - - if ((line[0] == '#') || (line[0] == '\0')) { - putline(ftemp, line); - continue; - } - strcpy(scratch, line); - /* - * See if this is our user. - */ - colon = strchr(scratch, ':'); - if (colon != NULL) { - *colon = '\0'; - } - if (strcmp(user, scratch) != 0) { - putline(ftemp, line); - continue; - } - found++; - break; - } - } - if (found) { - fprintf(stderr, "Updating "); - } - else { - fprintf(stderr, "Adding "); - } - fprintf(stderr, "password for user %s\n", user); - /* - * Now add the user record we created. - */ - putline(ftemp, record); - /* - * If we're updating an existing file, there may be additional - * records beyond the one we're updating, so copy them. - */ - if (! newfile) { - copy_file(ftemp, fpw); - fclose(fpw); - } - /* - * The temporary file now contains the information that should be - * in the actual password file. Close the open files, re-open them - * in the appropriate mode, and copy them file to the real one. - */ - fclose(ftemp); - fpw = fopen(pwfilename, "w+"); - ftemp = fopen(tempfilename, "r"); - copy_file(fpw, ftemp); - fclose(fpw); - fclose(ftemp); - unlink(tempfilename); - return 0; -} diff --git a/support/htpasswd.dsp b/support/htpasswd.dsp deleted file mode 100644 index 7d10b60ab5..0000000000 --- a/support/htpasswd.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="htpasswd" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=htpasswd - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "htpasswd.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "htpasswd.mak" CFG="htpasswd - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "htpasswd - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "htpasswd - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "htpasswd - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fd"Release/htpasswd" /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /incremental:no /map /machine:I386 -# ADD LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /incremental:no /map /machine:I386 - -!ELSEIF "$(CFG)" == "htpasswd - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fd"Debug/htpasswd" /FD /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /incremental:no /map /debug /machine:I386 -# ADD LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /incremental:no /map /debug /machine:I386 - -!ENDIF - -# Begin Target - -# Name "htpasswd - Win32 Release" -# Name "htpasswd - Win32 Debug" -# Begin Source File - -SOURCE=.\htpasswd.c -# End Source File -# End Target -# End Project diff --git a/support/htpasswd.mak b/support/htpasswd.mak deleted file mode 100644 index efadbfa010..0000000000 --- a/support/htpasswd.mak +++ /dev/null @@ -1,294 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on htpasswd.dsp -!IF "$(CFG)" == "" -CFG=htpasswd - Win32 Debug -!MESSAGE No configuration specified. Defaulting to htpasswd - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "htpasswd - Win32 Release" && "$(CFG)" !=\ - "htpasswd - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "htpasswd.mak" CFG="htpasswd - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "htpasswd - Win32 Release" (based on\ - "Win32 (x86) Console Application") -!MESSAGE "htpasswd - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "htpasswd - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\htpasswd.exe" - -!ELSE - -ALL : "aprutil - Win32 Release" "apr - Win32 Release" "$(OUTDIR)\htpasswd.exe" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"apr - Win32 ReleaseCLEAN" "aprutil - Win32 ReleaseCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\htpasswd.idb" - -@erase "$(INTDIR)\htpasswd.obj" - -@erase "$(OUTDIR)\htpasswd.exe" - -@erase "$(OUTDIR)\htpasswd.map" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /I "../srclib/apr/include" /I\ - "../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D\ - "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\"\ - /Fd"$(INTDIR)\htpasswd" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\htpasswd.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo\ - /subsystem:console /incremental:no /pdb:"$(OUTDIR)\htpasswd.pdb"\ - /map:"$(INTDIR)\htpasswd.map" /machine:I386 /out:"$(OUTDIR)\htpasswd.exe" -LINK32_OBJS= \ - "$(INTDIR)\htpasswd.obj" \ - "..\srclib\apr-util\LibR\aprutil.lib" \ - "..\srclib\apr\LibR\apr.lib" - -"$(OUTDIR)\htpasswd.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "htpasswd - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\htpasswd.exe" - -!ELSE - -ALL : "aprutil - Win32 Debug" "apr - Win32 Debug" "$(OUTDIR)\htpasswd.exe" - -!ENDIF - -!IF "$(RECURSE)" == "1" -CLEAN :"apr - Win32 DebugCLEAN" "aprutil - Win32 DebugCLEAN" -!ELSE -CLEAN : -!ENDIF - -@erase "$(INTDIR)\htpasswd.idb" - -@erase "$(INTDIR)\htpasswd.obj" - -@erase "$(OUTDIR)\htpasswd.exe" - -@erase "$(OUTDIR)\htpasswd.map" - -@erase "$(OUTDIR)\htpasswd.pdb" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MDd /W3 /GX /Zi /Od /I "../srclib/apr/include" /I\ - "../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D\ - "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\"\ - /Fd"$(INTDIR)\htpasswd" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\htpasswd.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo\ - /subsystem:console /incremental:no /pdb:"$(OUTDIR)\htpasswd.pdb"\ - /map:"$(INTDIR)\htpasswd.map" /debug /machine:I386\ - /out:"$(OUTDIR)\htpasswd.exe" -LINK32_OBJS= \ - "$(INTDIR)\htpasswd.obj" \ - "..\srclib\apr-util\LibD\aprutil.lib" \ - "..\srclib\apr\LibD\apr.lib" - -"$(OUTDIR)\htpasswd.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "htpasswd - Win32 Release" || "$(CFG)" ==\ - "htpasswd - Win32 Debug" - -!IF "$(CFG)" == "htpasswd - Win32 Release" - -"apr - Win32 Release" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\apr.mak CFG="apr - Win32 Release" - cd "..\..\support" - -"apr - Win32 ReleaseCLEAN" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\apr.mak CFG="apr - Win32 Release" RECURSE=1\ - - cd "..\..\support" - -!ELSEIF "$(CFG)" == "htpasswd - Win32 Debug" - -"apr - Win32 Debug" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) /F .\apr.mak CFG="apr - Win32 Debug" - cd "..\..\support" - -"apr - Win32 DebugCLEAN" : - cd "..\srclib\apr" - $(MAKE) /$(MAKEFLAGS) CLEAN /F .\apr.mak CFG="apr - Win32 Debug" RECURSE=1 - cd "..\..\support" - -!ENDIF - -!IF "$(CFG)" == "htpasswd - Win32 Release" - -"aprutil - Win32 Release" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release" - cd "..\..\support" - -"aprutil - Win32 ReleaseCLEAN" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\aprutil.mak" CFG="aprutil - Win32 Release"\ - RECURSE=1 - cd "..\..\support" - -!ELSEIF "$(CFG)" == "htpasswd - Win32 Debug" - -"aprutil - Win32 Debug" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug" - cd "..\..\support" - -"aprutil - Win32 DebugCLEAN" : - cd "..\srclib\apr-util" - $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\aprutil.mak" CFG="aprutil - Win32 Debug"\ - RECURSE=1 - cd "..\..\support" - -!ENDIF - -SOURCE=.\htpasswd.c -DEP_CPP_HTPAS=\ - "..\srclib\apr-util\include\apr_sha1.h"\ - "..\srclib\apr-util\include\apu.h"\ - "..\srclib\apr\include\apr.h"\ - "..\srclib\apr\include\apr_errno.h"\ - "..\srclib\apr\include\apr_file_info.h"\ - "..\srclib\apr\include\apr_file_io.h"\ - "..\srclib\apr\include\apr_general.h"\ - "..\srclib\apr\include\apr_lib.h"\ - "..\srclib\apr\include\apr_md5.h"\ - "..\srclib\apr\include\apr_pools.h"\ - "..\srclib\apr\include\apr_signal.h"\ - "..\srclib\apr\include\apr_strings.h"\ - "..\srclib\apr\include\apr_time.h"\ - "..\srclib\apr\include\apr_user.h"\ - "..\srclib\apr\include\apr_want.h"\ - "..\srclib\apr\include\apr_xlate.h"\ - - -"$(INTDIR)\htpasswd.obj" : $(SOURCE) $(DEP_CPP_HTPAS) "$(INTDIR)" - - - -!ENDIF - diff --git a/support/httpd.exp b/support/httpd.exp deleted file mode 100644 index 04581acf52..0000000000 --- a/support/httpd.exp +++ /dev/null @@ -1,711 +0,0 @@ -#! . -XML_DefaultCurrent -XML_ErrorString -XML_ExternalEntityParserCreate -XML_GetBase -XML_GetBuffer -XML_GetCurrentByteCount -XML_GetCurrentByteIndex -XML_GetCurrentColumnNumber -XML_GetCurrentLineNumber -XML_GetErrorCode -XML_GetSpecifiedAttributeCount -XML_Parse -XML_ParseBuffer -XML_ParserCreate -XML_ParserCreateNS -XML_ParserFree -XML_SetBase -XML_SetCdataSectionHandler -XML_SetCharacterDataHandler -XML_SetCommentHandler -XML_SetDefaultHandler -XML_SetDefaultHandlerExpand -XML_SetElementHandler -XML_SetEncoding -XML_SetExternalEntityRefHandler -XML_SetExternalEntityRefHandlerArg -XML_SetNamespaceDeclHandler -XML_SetNotStandaloneHandler -XML_SetNotationDeclHandler -XML_SetProcessingInstructionHandler -XML_SetUnknownEncodingHandler -XML_SetUnparsedEntityDeclHandler -XML_SetUserData -XML_UseParserAsHandlerArg -XmlGetUtf16InternalEncoding -XmlGetUtf8InternalEncoding -XmlInitEncoding -XmlInitUnknownEncoding -XmlParseXmlDecl -XmlPrologStateInit -XmlSizeOfUnknownEncoding -XmlUtf16Encode -XmlUtf8Encode -ap_add_cgi_vars -ap_add_common_vars -ap_add_input_filter -ap_add_loaded_module -ap_add_module -ap_add_named_module -ap_add_node -ap_add_output_filter -ap_add_per_dir_conf -ap_add_per_url_conf -ap_add_version_component -ap_allow_methods -ap_allow_options -ap_allow_overrides -ap_auth_name -ap_auth_type -ap_basic_http_header -ap_bucket_error_create -ap_bucket_error_make -ap_build_config -ap_build_cont_config -ap_byterange_filter -ap_cfg_closefile -ap_cfg_getc -ap_cfg_getline -ap_check_cmd_context -ap_checkmask -ap_cleanup_scoreboard -ap_clear_method_list -ap_close_piped_log -ap_construct_server -ap_construct_url -ap_content_length_filter -ap_content_type_tolower -ap_copy_method_list -ap_core_reorder_directories -ap_core_translate -ap_coredump_dir -ap_count_dirs -ap_create_conn_config -ap_create_environment -ap_create_per_dir_config -ap_create_request_config -ap_create_scoreboard -ap_custom_response -ap_default_port_for_request -ap_default_port_for_scheme -ap_default_type -ap_destroy_sub_req -ap_die -ap_discard_request_body -ap_document_root -ap_error_log2stderr -ap_escape_html -ap_escape_path_segment -ap_escape_quotes -ap_escape_shell_cmd -ap_exists_config_define -ap_exists_scoreboard_image -ap_extended_status -ap_fflush -ap_field_noparam -ap_filter_flush -ap_finalize_request_protocol -ap_finalize_sub_req_protocol -ap_find_command -ap_find_command_in_modules -ap_find_last_token -ap_find_linked_module -ap_find_list_item -ap_find_module_name -ap_find_path_info -ap_find_token -ap_fini_vhost_config -ap_fixup_virtual_hosts -ap_fprintf -ap_fputstrs -ap_get_basic_auth_pw -ap_get_brigade -ap_get_client_block -ap_get_limit_req_body -ap_get_limit_xml_body -ap_get_list_item -ap_get_local_host -ap_get_remote_host -ap_get_remote_logname -ap_get_server_built -ap_get_server_name -ap_get_server_port -ap_get_server_version -ap_get_status_line -ap_get_token -ap_getparents -ap_getword -ap_getword_conf -ap_getword_conf_nc -ap_getword_nc -ap_getword_nulls -ap_getword_nulls_nc -ap_getword_white -ap_getword_white_nc -ap_gname2id -ap_graceful_stop_signalled -ap_hook_access_checker -ap_hook_auth_checker -ap_hook_check_user_id -ap_hook_child_init -ap_hook_create_request -ap_hook_default_port -ap_hook_fixups -ap_hook_handler -ap_hook_header_parser -ap_hook_http_method -ap_hook_insert_filter -ap_hook_log_transaction -ap_hook_open_logs -ap_hook_optional_fn_retrieve -ap_hook_post_config -ap_hook_post_read_request -ap_hook_pre_connection -ap_hook_process_connection -ap_hook_quick_handler -ap_hook_translate_name -ap_hook_type_checker -ap_ht_time -ap_http_header_filter -ap_increment_counts -ap_ind -ap_index_of_response -ap_init_vhost_config -ap_init_virtual_host -ap_internal_redirect -ap_internal_redirect_handler -ap_invoke_handler -ap_is_directory -ap_is_initial_req -ap_is_matchexp -ap_is_rdirectory -ap_is_url -ap_limit_section -ap_lingering_close -ap_listen_pre_config -ap_listeners -ap_loaded_modules -ap_log_assert -ap_log_error -ap_log_perror -ap_log_pid -ap_log_rerror -ap_make_content_type -ap_make_dirstr_parent -ap_make_dirstr_prefix -ap_make_etag -ap_make_full_path -ap_make_method_list -ap_matches_request_vhost -ap_max_requests_per_child -ap_md5 -ap_md5_binary -ap_md5contextTo64 -ap_md5digest -ap_meets_conditions -ap_merge_per_dir_configs -ap_method_in_list -ap_method_is_limited -ap_method_list_add -ap_method_list_do -ap_method_list_remove -ap_method_list_vdo -ap_method_name_of -ap_method_number_of -ap_mpm_query -ap_mpm_run -ap_my_generation -ap_new_connection -ap_no2slash -ap_note_auth_failure -ap_note_basic_auth_failure -ap_note_digest_auth_failure -ap_old_write_filter -ap_open_logs -ap_open_piped_log -ap_open_stderr_log -ap_os_create_privileged_process -ap_os_escape_path -ap_os_is_path_absolute -ap_parseHTTPdate -ap_parse_hostinfo_components -ap_parse_htaccess -ap_parse_uri -ap_parse_uri_components -ap_parse_vhost_addrs -ap_pass_brigade -ap_pbase64decode -ap_pbase64encode -ap_pcfg_open_custom -ap_pcfg_openfile -ap_pregcomp -ap_pregfree -ap_pregsub -ap_prelinked_modules -ap_preloaded_modules -ap_process_child_status -ap_process_config_tree -ap_process_request -ap_process_resource_config -ap_psignature -ap_rationalize_mtime -ap_read_config -ap_read_request -ap_reclaim_child_processes -ap_regerror -ap_regexec -ap_register_hooks -ap_register_input_filter -ap_register_output_filter -ap_remove_loaded_module -ap_remove_module -ap_remove_output_filter -ap_requires -ap_resolve_env -ap_response_code_string -ap_rfc1413 -ap_rfc1413_timeout -ap_rflush -ap_rind -ap_rprintf -ap_rputc -ap_rputs -ap_run_access_checker -ap_run_auth_checker -ap_run_check_user_id -ap_run_child_init -ap_run_create_request -ap_run_default_port -ap_run_fixups -ap_run_handler -ap_run_header_parser -ap_run_http_method -ap_run_insert_filter -ap_run_log_transaction -ap_run_open_logs -ap_run_optional_fn_retrieve -ap_run_post_read_request -ap_run_pre_config -ap_run_pre_connection -ap_run_process_connection -ap_run_quick_handler -ap_run_rewrite_args -ap_run_sub_req -ap_run_translate_name -ap_run_type_checker -ap_rvputs -ap_rwrite -ap_satisfies -ap_save_brigade -ap_scan_script_header_err -ap_scan_script_header_err_core -ap_scan_script_header_err_strs -ap_scoreboard_fname -ap_scoreboard_image -ap_send_error_response -ap_send_fd -ap_send_http_options -ap_send_http_trace -ap_send_mmap -ap_send_size -ap_server_argv0 -ap_server_config_defines -ap_server_post_read_config -ap_server_pre_read_config -ap_server_root -ap_server_root_relative -ap_set_content_length -ap_set_etag -ap_set_file_slot -ap_set_flag_slot -ap_set_int_slot -ap_set_keepalive -ap_set_last_modified -ap_set_listenbacklog -ap_set_listener -ap_set_name_virtual_host -ap_set_send_buffer_size -ap_set_string_slot -ap_set_string_slot_lower -ap_set_sub_req_protocol -ap_setup_client_block -ap_setup_listeners -ap_setup_prelinked_modules -ap_should_client_block -ap_show_directives -ap_show_modules -ap_single_module_configure -ap_size_list_item -ap_soak_end_container -ap_sock_disable_nagle -ap_some_auth_required -ap_str_tolower -ap_strcasecmp_match -ap_strcasestr -ap_strcmp_match -ap_stripprefix -ap_sub_req_lookup_file -ap_sub_req_lookup_uri -ap_sub_req_method_uri -ap_sync_scoreboard_image -ap_threads_per_child -ap_time_process_request -ap_top_module -ap_uname2id -ap_unescape_url -ap_unparse_uri_components -ap_update_child_status -ap_update_mtime -ap_update_vhost_from_headers -ap_update_vhost_given_ip -ap_vrprintf -ap_wait_or_timeout -ap_walk_config -ap_xml_parse_input -apr_accept -apr_ansi_time_to_apr_time -apr_array_append -apr_array_cat -apr_array_copy -apr_array_copy_hdr -apr_array_make -apr_array_pstrcat -apr_array_push -apr_base64_decode -apr_base64_decode_binary -apr_base64_decode_len -apr_base64_encode -apr_base64_encode_binary -apr_base64_encode_len -apr_bind -apr_brigade_create -apr_brigade_destroy -apr_brigade_length -apr_brigade_partition -apr_brigade_printf -apr_brigade_putc -apr_brigade_puts -apr_brigade_putstrs -apr_brigade_split -apr_brigade_to_iovec -apr_brigade_vprintf -apr_brigade_vputstrs -apr_brigade_write -apr_bucket_destroy_notimpl -apr_bucket_eos_create -apr_bucket_eos_make -apr_bucket_flush_create -apr_bucket_flush_make -apr_bucket_heap_create -apr_bucket_immortal_create -apr_bucket_pipe_create -apr_bucket_setaside_notimpl -apr_bucket_shared_copy -apr_bucket_shared_destroy -apr_bucket_shared_make -apr_bucket_shared_split -apr_bucket_simple_copy -apr_bucket_simple_split -apr_bucket_socket_create -apr_collapse_spaces -apr_connect -apr_cpystrn -apr_ctime -apr_day_snames -apr_dbm_close -apr_dbm_delete -apr_dbm_exists -apr_dbm_fetch -apr_dbm_firstkey -apr_dbm_freedatum -apr_dbm_get_usednames -apr_dbm_geterror -apr_dbm_nextkey -apr_dbm_open -apr_dbm_store -apr_dir_close -apr_dir_make -apr_dir_open -apr_dir_read -apr_dir_remove -apr_dir_rewind -apr_dso_error -apr_dso_load -apr_dso_sym -apr_dso_unload -apr_explode_gmt -apr_explode_localtime -apr_file_close -apr_file_data_get -apr_file_data_set -apr_file_dup -apr_file_eof -apr_file_flush -apr_file_getc -apr_file_gets -apr_file_info_get -apr_file_lock -apr_file_name_get -apr_file_namedpipe_create -apr_file_open -apr_file_open_stderr -apr_file_open_stdout -apr_file_perms_set -apr_file_pipe_create -apr_file_pipe_timeout_get -apr_file_pipe_timeout_set -apr_file_printf -apr_file_putc -apr_file_puts -apr_file_read -apr_file_read_full -apr_file_remove -apr_file_rename -apr_file_seek -apr_file_ungetc -apr_file_unlock -apr_file_write -apr_file_write_full -apr_file_writev -apr_filename_of_pathname -apr_fnmatch -apr_get_groupname -apr_get_home_directory -apr_get_user_passwd -apr_get_userid -apr_get_username -apr_gethostname -apr_getnameinfo -apr_getopt -apr_getopt_init -apr_getopt_long -apr_getservbyname -apr_getsocketopt -apr_global_hook_pool -apr_hash_count -apr_hash_first -apr_hash_get -apr_hash_make -apr_hash_next -apr_hash_set -apr_hash_this -apr_hook_deregister_all -apr_hook_generic_add -apr_hook_generic_get -apr_hook_sort_register -apr_implode_time -apr_initialize -apr_ipsubnet_create -apr_ipsubnet_test -apr_is_fnmatch -apr_listen -apr_lock_acquire -apr_lock_child_init -apr_lock_create -apr_lock_data_get -apr_lock_data_set -apr_lock_destroy -apr_lock_release -apr_lstat -apr_md5_encode -apr_md5_final -apr_md5_init -apr_md5_set_xlate -apr_md5_update -apr_mmap_create -apr_mmap_delete -apr_mmap_offset -apr_month_snames -apr_os_dir_get -apr_os_dir_put -apr_os_exp_time_get -apr_os_exp_time_put -apr_os_file_get -apr_os_file_put -apr_os_imp_time_get -apr_os_imp_time_put -apr_os_lock_get -apr_os_lock_put -apr_os_sock_get -apr_os_sock_make -apr_os_sock_put -apr_os_thread_get -apr_os_thread_put -apr_os_threadkey_get -apr_os_threadkey_put -apr_palloc -apr_parse_addr_port -apr_password_get -apr_password_validate -apr_pcalloc -apr_pmemdup -apr_poll -apr_poll_data_get -apr_poll_data_set -apr_poll_revents_get -apr_poll_setup -apr_poll_socket_add -apr_poll_socket_clear -apr_poll_socket_mask -apr_poll_socket_remove -apr_pool_alloc_init -apr_pool_alloc_term -apr_pool_cleanup_for_exec -apr_pool_cleanup_kill -apr_pool_cleanup_null -apr_pool_cleanup_register -apr_pool_cleanup_run -apr_pool_clear -apr_pool_create -apr_pool_destroy -apr_pool_free_blocks_num_bytes -apr_pool_get_abort -apr_pool_note_subprocess -apr_pool_num_bytes -apr_pool_set_abort -apr_pool_sub_make -apr_pool_userdata_get -apr_pool_userdata_set -apr_proc_create -apr_proc_detach -apr_proc_fork -apr_proc_kill -apr_proc_other_child_check -apr_proc_other_child_read -apr_proc_other_child_register -apr_proc_other_child_unregister -apr_proc_probe_writable_fds -apr_proc_wait -apr_proc_wait_all_procs -apr_procattr_child_err_set -apr_procattr_child_in_set -apr_procattr_child_out_set -apr_procattr_cmdtype_set -apr_procattr_create -apr_procattr_detach_set -apr_procattr_dir_set -apr_procattr_io_set -apr_procattr_limit_set -apr_psprintf -apr_pstrcat -apr_pstrdup -apr_pstrndup -apr_pvsprintf -apr_recv -apr_recvfrom -apr_register_optional_fn -apr_retrieve_optional_fn -apr_rfc822_date -apr_send -apr_sendfile -apr_sendto -apr_sendv -apr_setsocketopt -apr_setup_signal_thread -apr_sha1_base64 -apr_sha1_final -apr_sha1_init -apr_sha1_update -apr_sha1_update_binary -apr_shm_avail -apr_shm_calloc -apr_shm_destroy -apr_shm_free -apr_shm_init -apr_shm_malloc -apr_shm_name_get -apr_shm_name_set -apr_shm_open -apr_show_hook -apr_shutdown -apr_signal -apr_signal_get_description -apr_signal_init -apr_signal_thread -apr_sleep -apr_snprintf -apr_sockaddr_info_get -apr_sockaddr_ip_get -apr_sockaddr_ip_set -apr_sockaddr_port_get -apr_sockaddr_port_set -apr_socket_addr_get -apr_socket_close -apr_socket_create -apr_socket_data_get -apr_socket_data_set -apr_socket_from_file -apr_sort_hooks -apr_stat -apr_strerror -apr_strftime -apr_strnatcasecmp -apr_strnatcmp -apr_table_add -apr_table_addn -apr_table_clear -apr_table_copy -apr_table_do -apr_table_get -apr_table_make -apr_table_merge -apr_table_mergen -apr_table_overlap -apr_table_overlay -apr_table_set -apr_table_setn -apr_table_unset -apr_table_vdo -apr_terminate -apr_text_append -apr_thread_create -apr_thread_data_get -apr_thread_data_set -apr_thread_detach -apr_thread_exit -apr_thread_join -apr_threadattr_create -apr_threadattr_detach_get -apr_threadattr_detach_set -apr_threadkey_data_get -apr_threadkey_data_set -apr_threadkey_private_create -apr_threadkey_private_delete -apr_threadkey_private_get -apr_threadkey_private_set -apr_time_now -apr_tokenize_to_argv -apr_uuid_format -apr_uuid_get -apr_uuid_parse -apr_vformatter -apr_vsnprintf -apr_xlate_close -apr_xlate_conv_buffer -apr_xlate_get_sb -apr_xlate_open -apr_xml_empty_elem -apr_xml_insert_uri -apr_xml_parser_create -apr_xml_parser_done -apr_xml_parser_feed -apr_xml_parser_geterror -apr_xml_quote_elem -apr_xml_quote_string -apr_xml_to_text -pcre_compile -pcre_copy_substring -pcre_exec -pcre_free -pcre_get_substring -pcre_get_substring_list -pcre_info -pcre_maketables -pcre_malloc -pcre_study -pcre_version -regcomp -regerror -regexec -regfree diff --git a/support/log_server_status b/support/log_server_status deleted file mode 100644 index e32280c912..0000000000 --- a/support/log_server_status +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/perl -# ==================================================================== -# The Apache Software License, Version 1.1 -# -# Copyright (c) 2000-2001 The Apache Software Foundation. All rights -# reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# -# 3. The end-user documentation included with the redistribution, -# if any, must include the following acknowledgment: -# "This product includes software developed by the -# Apache Software Foundation (http://www.apache.org/)." -# Alternately, this acknowledgment may appear in the software itself, -# if and wherever such third-party acknowledgments normally appear. -# -# 4. The names "Apache" and "Apache Software Foundation" must -# not be used to endorse or promote products derived from this -# software without prior written permission. For written -# permission, please contact apache@apache.org. -# -# 5. Products derived from this software may not be called "Apache", -# nor may "Apache" appear in their name, without prior written -# permission of the Apache Software Foundation. -# -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR -# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# ==================================================================== -# -# This software consists of voluntary contributions made by many -# individuals on behalf of the Apache Software Foundation. For more -# information on the Apache Software Foundation, please see -# <http://www.apache.org/>. -# -# Log Server Status -# Mark J Cox, UK Web Ltd 1996, mark@ukweb.com -# -# This script is designed to be run at a frequent interval by something -# like cron. It connects to the server and downloads the status -# information. It reformats the information to a single line and logs -# it to a file. Make sure the directory $wherelog is writable by the -# user who runs this script. -# -require 'sys/socket.ph'; - -$wherelog = "/var/log/graph/"; # Logs will be like "/var/log/graph/19960312" -$server = "localhost"; # Name of server, could be "www.foo.com" -$port = "80"; # Port on server -$request = "/status/?auto"; # Request to send - -sub tcp_connect -{ - local($host,$port) =@_; - $sockaddr='S n a4 x8'; - chop($hostname=`hostname`); - $port=(getservbyname($port, 'tcp'))[2] unless $port =~ /^\d+$/; - $me=pack($sockaddr,&AF_INET,0,(gethostbyname($hostname))[4]); - $them=pack($sockaddr,&AF_INET,$port,(gethostbyname($host))[4]); - socket(S,&PF_INET,&SOCK_STREAM,(getprotobyname('tcp'))[2]) || - die "socket: $!"; - bind(S,$me) || return "bind: $!"; - connect(S,$them) || return "connect: $!"; - select(S); - $| = 1; - select(stdout); - return ""; -} - -### Main - -{ - $year=`date +%y`; - chomp($year); - $year += ($year < 70) ? 2000 : 1900; - $date = $year . `date +%m%d:%H%M%S`; - chomp($date); - ($day,$time)=split(/:/,$date); - $res=&tcp_connect($server,$port); - open(OUT,">>$wherelog$day"); - if ($res) { - print OUT "$time:-1:-1:-1:-1:$res\n"; - exit 1; - } - print S "GET $request\n"; - while (<S>) { - $requests=$1 if ( m|^BusyServers:\ (\S+)|); - $idle=$1 if ( m|^IdleServers:\ (\S+)|); - $number=$1 if ( m|sses:\ (\S+)|); - $cpu=$1 if (m|^CPULoad:\ (\S+)|); - } - print OUT "$time:$requests:$idle:$number:$cpu\n"; -} - - diff --git a/support/log_server_status.in b/support/log_server_status.in deleted file mode 100644 index f301604b76..0000000000 --- a/support/log_server_status.in +++ /dev/null @@ -1,114 +0,0 @@ -#!@perlbin@ -# ==================================================================== -# The Apache Software License, Version 1.1 -# -# Copyright (c) 2000-2001 The Apache Software Foundation. All rights -# reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# -# 3. The end-user documentation included with the redistribution, -# if any, must include the following acknowledgment: -# "This product includes software developed by the -# Apache Software Foundation (http://www.apache.org/)." -# Alternately, this acknowledgment may appear in the software itself, -# if and wherever such third-party acknowledgments normally appear. -# -# 4. The names "Apache" and "Apache Software Foundation" must -# not be used to endorse or promote products derived from this -# software without prior written permission. For written -# permission, please contact apache@apache.org. -# -# 5. Products derived from this software may not be called "Apache", -# nor may "Apache" appear in their name, without prior written -# permission of the Apache Software Foundation. -# -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR -# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# ==================================================================== -# -# This software consists of voluntary contributions made by many -# individuals on behalf of the Apache Software Foundation. For more -# information on the Apache Software Foundation, please see -# <http://www.apache.org/>. -# -# Log Server Status -# Mark J Cox, UK Web Ltd 1996, mark@ukweb.com -# -# This script is designed to be run at a frequent interval by something -# like cron. It connects to the server and downloads the status -# information. It reformats the information to a single line and logs -# it to a file. Make sure the directory $wherelog is writable by the -# user who runs this script. -# -require 'sys/socket.ph'; - -$wherelog = "/var/log/graph/"; # Logs will be like "/var/log/graph/19960312" -$server = "localhost"; # Name of server, could be "www.foo.com" -$port = "80"; # Port on server -$request = "/status/?auto"; # Request to send - -sub tcp_connect -{ - local($host,$port) =@_; - $sockaddr='S n a4 x8'; - chop($hostname=`hostname`); - $port=(getservbyname($port, 'tcp'))[2] unless $port =~ /^\d+$/; - $me=pack($sockaddr,&AF_INET,0,(gethostbyname($hostname))[4]); - $them=pack($sockaddr,&AF_INET,$port,(gethostbyname($host))[4]); - socket(S,&PF_INET,&SOCK_STREAM,(getprotobyname('tcp'))[2]) || - die "socket: $!"; - bind(S,$me) || return "bind: $!"; - connect(S,$them) || return "connect: $!"; - select(S); - $| = 1; - select(stdout); - return ""; -} - -### Main - -{ - $year=`date +%y`; - chomp($year); - $year += ($year < 70) ? 2000 : 1900; - $date = $year . `date +%m%d:%H%M%S`; - chomp($date); - ($day,$time)=split(/:/,$date); - $res=&tcp_connect($server,$port); - open(OUT,">>$wherelog$day"); - if ($res) { - print OUT "$time:-1:-1:-1:-1:$res\n"; - exit 1; - } - print S "GET $request\n"; - while (<S>) { - $requests=$1 if ( m|^BusyServers:\ (\S+)|); - $idle=$1 if ( m|^IdleServers:\ (\S+)|); - $number=$1 if ( m|sses:\ (\S+)|); - $cpu=$1 if (m|^CPULoad:\ (\S+)|); - } - print OUT "$time:$requests:$idle:$number:$cpu\n"; -} - - diff --git a/support/logresolve.c b/support/logresolve.c deleted file mode 100644 index 237e091b2c..0000000000 --- a/support/logresolve.c +++ /dev/null @@ -1,378 +0,0 @@ -/* - * logresolve 1.1 - * - * Tom Rathborne - tomr@uunet.ca - http://www.uunet.ca/~tomr/ - * UUNET Canada, April 16, 1995 - * - * Rewritten by David Robinson. (drtr@ast.cam.ac.uk) - * - * Usage: logresolve [-s filename] [-c] < access_log > new_log - * - * Arguments: - * -s filename name of a file to record statistics - * -c check the DNS for a matching A record for the host. - * - * Notes: - * - * To generate meaningful statistics from an HTTPD log file, it's good - * to have the domain name of each machine that accessed your site, but - * doing this on the fly can slow HTTPD down. - * - * Compiling NCSA HTTPD with the -DMINIMAL_DNS flag turns IP#->hostname - * resolution off. Before running your stats program, just run your log - * file through this program (logresolve) and all of your IP numbers will - * be resolved into hostnames (where possible). - * - * logresolve takes an HTTPD access log (in the COMMON log file format, - * or any other format that has the IP number/domain name as the first - * field for that matter), and outputs the same file with all of the - * domain names looked up. Where no domain name can be found, the IP - * number is left in. - * - * To minimize impact on your nameserver, logresolve has its very own - * internal hash-table cache. This means that each IP number will only - * be looked up the first time it is found in the log file. - * - * The -c option causes logresolve to apply the same check as httpd - * compiled with -DMAXIMUM_DNS; after finding the hostname from the IP - * address, it looks up the IP addresses for the hostname and checks - * that one of these matches the original address. - */ - -#include "apr_lib.h" -#if APR_HAVE_STDIO_H -#include <stdio.h> -#endif -#if APR_HAVE_STDLIB_H -#include <stdlib.h> -#endif -#if APR_HAVE_CTYPE_H -#include <ctype.h> -#endif -#if APR_HAVE_NETDB_H -#include <netdb.h> -#endif -#if APR_HAVE_NETINET_IN_H -#include <netinet/in.h> -#endif -#if APR_HAVE_STRING_H -#include <string.h> -#endif -#if APR_HAVE_SYS_SOCKET_H -#include <sys/socket.h> -#endif -#if APR_HAVE_ARPA_INET_H -#include <arpa/inet.h> -#endif - -static void cgethost(struct in_addr ipnum, char *string, int check); -static int getline(char *s, int n); -static void stats(FILE *output); - -#ifdef BEOS -#define NO_ADDRESS NO_DATA -#endif - - -/* maximum line length */ -#define MAXLINE 1024 - -/* maximum length of a domain name */ -#ifndef MAXDNAME -#define MAXDNAME 256 -#endif - -/* number of buckets in cache hash apr_table_t */ -#define BUCKETS 256 - -#if !APR_HAVE_STRDUP -char *strdup (const char *str) -{ - char *dup; - - if (!(dup = (char *) malloc(strlen(str) + 1))) - return NULL; - dup = strcpy(dup, str); - - return dup; -} -#endif - -/* - * struct nsrec - record of nameservice for cache linked list - * - * ipnum - IP number hostname - hostname noname - nonzero if IP number has no - * hostname, i.e. hostname=IP number - */ - -struct nsrec { - struct in_addr ipnum; - char *hostname; - int noname; - struct nsrec *next; -} *nscache[BUCKETS]; - -/* - * statistics - obvious - */ - -#ifndef h_errno -extern int h_errno; /* some machines don't have this in their headers */ -#endif - -/* largest value for h_errno */ - -#define MAX_ERR (NO_ADDRESS) -#define UNKNOWN_ERR (MAX_ERR+1) -#define NO_REVERSE (MAX_ERR+2) - -static int cachehits = 0; -static int cachesize = 0; -static int entries = 0; -static int resolves = 0; -static int withname = 0; -static int errors[MAX_ERR + 3]; - -/* - * cgethost - gets hostname by IP address, caching, and adding unresolvable - * IP numbers with their IP number as hostname, setting noname flag - */ - -static void cgethost (struct in_addr ipnum, char *string, int check) -{ - struct nsrec **current, *new; - struct hostent *hostdata; - char *name; - - current = &nscache[((ipnum.s_addr + (ipnum.s_addr >> 8) + - (ipnum.s_addr >> 16) + (ipnum.s_addr >> 24)) % BUCKETS)]; - - while (*current != NULL && ipnum.s_addr != (*current)->ipnum.s_addr) - current = &(*current)->next; - - if (*current == NULL) { - cachesize++; - new = (struct nsrec *) malloc(sizeof(struct nsrec)); - if (new == NULL) { - perror("malloc"); - fprintf(stderr, "Insufficient memory\n"); - exit(1); - } - *current = new; - new->next = NULL; - - new->ipnum = ipnum; - - hostdata = gethostbyaddr((const char *) &ipnum, sizeof(struct in_addr), - AF_INET); - if (hostdata == NULL) { - if (h_errno > MAX_ERR) - errors[UNKNOWN_ERR]++; - else - errors[h_errno]++; - new->noname = h_errno; - name = strdup(inet_ntoa(ipnum)); - } - else { - new->noname = 0; - name = strdup(hostdata->h_name); - if (check) { - if (name == NULL) { - perror("strdup"); - fprintf(stderr, "Insufficient memory\n"); - exit(1); - } - hostdata = gethostbyname(name); - if (hostdata != NULL) { - char **hptr; - - for (hptr = hostdata->h_addr_list; *hptr != NULL; hptr++) - if (((struct in_addr *) (*hptr))->s_addr == ipnum.s_addr) - break; - if (*hptr == NULL) - hostdata = NULL; - } - if (hostdata == NULL) { - fprintf(stderr, "Bad host: %s != %s\n", name, - inet_ntoa(ipnum)); - new->noname = NO_REVERSE; - free(name); - name = strdup(inet_ntoa(ipnum)); - errors[NO_REVERSE]++; - } - } - } - new->hostname = name; - if (new->hostname == NULL) { - perror("strdup"); - fprintf(stderr, "Insufficient memory\n"); - exit(1); - } - } - else - cachehits++; - - /* size of string == MAXDNAME +1 */ - strncpy(string, (*current)->hostname, MAXDNAME); - string[MAXDNAME] = '\0'; -} - -/* - * prints various statistics to output - */ - -static void stats (FILE *output) -{ - int i; - char *ipstring; - struct nsrec *current; - char *errstring[MAX_ERR + 3]; - - for (i = 0; i < MAX_ERR + 3; i++) - errstring[i] = "Unknown error"; - errstring[HOST_NOT_FOUND] = "Host not found"; - errstring[TRY_AGAIN] = "Try again"; - errstring[NO_RECOVERY] = "Non recoverable error"; - errstring[NO_DATA] = "No data record"; - errstring[NO_ADDRESS] = "No address"; - errstring[NO_REVERSE] = "No reverse entry"; - - fprintf(output, "logresolve Statistics:\n"); - - fprintf(output, "Entries: %d\n", entries); - fprintf(output, " With name : %d\n", withname); - fprintf(output, " Resolves : %d\n", resolves); - if (errors[HOST_NOT_FOUND]) - fprintf(output, " - Not found : %d\n", errors[HOST_NOT_FOUND]); - if (errors[TRY_AGAIN]) - fprintf(output, " - Try again : %d\n", errors[TRY_AGAIN]); - if (errors[NO_DATA]) - fprintf(output, " - No data : %d\n", errors[NO_DATA]); - if (errors[NO_ADDRESS]) - fprintf(output, " - No address: %d\n", errors[NO_ADDRESS]); - if (errors[NO_REVERSE]) - fprintf(output, " - No reverse: %d\n", errors[NO_REVERSE]); - fprintf(output, "Cache hits : %d\n", cachehits); - fprintf(output, "Cache size : %d\n", cachesize); - fprintf(output, "Cache buckets : IP number * hostname\n"); - - for (i = 0; i < BUCKETS; i++) - for (current = nscache[i]; current != NULL; current = current->next) { - ipstring = inet_ntoa(current->ipnum); - if (current->noname == 0) - fprintf(output, " %3d %15s - %s\n", i, ipstring, - current->hostname); - else { - if (current->noname > MAX_ERR + 2) - fprintf(output, " %3d %15s : Unknown error\n", i, - ipstring); - else - fprintf(output, " %3d %15s : %s\n", i, ipstring, - errstring[current->noname]); - } - } -} - - -/* - * gets a line from stdin - */ - -static int getline (char *s, int n) -{ - char *cp; - - if (!fgets(s, n, stdin)) - return (0); - cp = strchr(s, '\n'); - if (cp) - *cp = '\0'; - return (1); -} - -int main (int argc, char *argv[]) -{ - struct in_addr ipnum; - char *bar, hoststring[MAXDNAME + 1], line[MAXLINE], *statfile; - int i, check; - -#ifdef WIN32 - /* If we apr'ify this code, apr_pool_create/apr_pool_destroy - * should perform the WSAStartup/WSACleanup for us. - */ - WSADATA wsaData; - WSAStartup(0x101, &wsaData); -#endif - - check = 0; - statfile = NULL; - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-c") == 0) - check = 1; - else if (strcmp(argv[i], "-s") == 0) { - if (i == argc - 1) { - fprintf(stderr, "logresolve: missing filename to -s\n"); - exit(1); - } - i++; - statfile = argv[i]; - } - else { - fprintf(stderr, "Usage: logresolve [-s statfile] [-c] < input > output\n"); - exit(0); - } - } - - for (i = 0; i < BUCKETS; i++) - nscache[i] = NULL; - for (i = 0; i < MAX_ERR + 2; i++) - errors[i] = 0; - - while (getline(line, MAXLINE)) { - if (line[0] == '\0') - continue; - entries++; - if (!apr_isdigit(line[0])) { /* short cut */ - puts(line); - withname++; - continue; - } - bar = strchr(line, ' '); - if (bar != NULL) - *bar = '\0'; - ipnum.s_addr = inet_addr(line); - if (ipnum.s_addr == 0xffffffffu) { - if (bar != NULL) - *bar = ' '; - puts(line); - withname++; - continue; - } - - resolves++; - - cgethost(ipnum, hoststring, check); - if (bar != NULL) - printf("%s %s\n", hoststring, bar + 1); - else - puts(hoststring); - } - -#ifdef WIN32 - WSACleanup(); -#endif - - if (statfile != NULL) { - FILE *fp; - fp = fopen(statfile, "w"); - if (fp == NULL) { - fprintf(stderr, "logresolve: could not open statistics file '%s'\n" - ,statfile); - exit(1); - } - stats(fp); - fclose(fp); - } - - return (0); -} diff --git a/support/logresolve.dsp b/support/logresolve.dsp deleted file mode 100644 index f8ccbb2121..0000000000 --- a/support/logresolve.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="logresolve" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=logresolve - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "logresolve.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "logresolve.mak" CFG="logresolve - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "logresolve - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "logresolve - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "logresolve - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fd"Release/logresolve" /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /incremental:no /map /machine:I386 -# ADD LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /incremental:no /map /machine:I386 - -!ELSEIF "$(CFG)" == "logresolve - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fd"Debug/logresolve" /FD /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /incremental:no /map /debug /machine:I386 -# ADD LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /incremental:no /map /debug /machine:I386 - -!ENDIF - -# Begin Target - -# Name "logresolve - Win32 Release" -# Name "logresolve - Win32 Debug" -# Begin Source File - -SOURCE=.\logresolve.c -# End Source File -# End Target -# End Project diff --git a/support/logresolve.mak b/support/logresolve.mak deleted file mode 100644 index 278daf8a32..0000000000 --- a/support/logresolve.mak +++ /dev/null @@ -1,214 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on logresolve.dsp -!IF "$(CFG)" == "" -CFG=logresolve - Win32 Debug -!MESSAGE No configuration specified. Defaulting to logresolve - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "logresolve - Win32 Release" && "$(CFG)" !=\ - "logresolve - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "logresolve.mak" CFG="logresolve - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "logresolve - Win32 Release" (based on\ - "Win32 (x86) Console Application") -!MESSAGE "logresolve - Win32 Debug" (based on\ - "Win32 (x86) Console Application") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "logresolve - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\logresolve.exe" - -!ELSE - -ALL : "$(OUTDIR)\logresolve.exe" - -!ENDIF - -CLEAN : - -@erase "$(INTDIR)\logresolve.idb" - -@erase "$(INTDIR)\logresolve.obj" - -@erase "$(OUTDIR)\logresolve.exe" - -@erase "$(OUTDIR)\logresolve.map" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /I "../srclib/apr/include" /I\ - "../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D\ - "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\"\ - /Fd"$(INTDIR)\logresolve" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\logresolve.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo\ - /subsystem:console /incremental:no /pdb:"$(OUTDIR)\logresolve.pdb"\ - /map:"$(INTDIR)\logresolve.map" /machine:I386 /out:"$(OUTDIR)\logresolve.exe" -LINK32_OBJS= \ - "$(INTDIR)\logresolve.obj" - -"$(OUTDIR)\logresolve.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "logresolve - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\logresolve.exe" - -!ELSE - -ALL : "$(OUTDIR)\logresolve.exe" - -!ENDIF - -CLEAN : - -@erase "$(INTDIR)\logresolve.idb" - -@erase "$(INTDIR)\logresolve.obj" - -@erase "$(OUTDIR)\logresolve.exe" - -@erase "$(OUTDIR)\logresolve.map" - -@erase "$(OUTDIR)\logresolve.pdb" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MDd /W3 /GX /Zi /Od /I "../srclib/apr/include" /I\ - "../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D\ - "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\"\ - /Fd"$(INTDIR)\logresolve" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\logresolve.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo\ - /subsystem:console /incremental:no /pdb:"$(OUTDIR)\logresolve.pdb"\ - /map:"$(INTDIR)\logresolve.map" /debug /machine:I386\ - /out:"$(OUTDIR)\logresolve.exe" -LINK32_OBJS= \ - "$(INTDIR)\logresolve.obj" - -"$(OUTDIR)\logresolve.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "logresolve - Win32 Release" || "$(CFG)" ==\ - "logresolve - Win32 Debug" -SOURCE=.\logresolve.c -DEP_CPP_LOGRE=\ - "..\srclib\apr\include\apr.h"\ - "..\srclib\apr\include\apr_errno.h"\ - "..\srclib\apr\include\apr_lib.h"\ - - -"$(INTDIR)\logresolve.obj" : $(SOURCE) $(DEP_CPP_LOGRE) "$(INTDIR)" - - - -!ENDIF - diff --git a/support/logresolve.pl b/support/logresolve.pl deleted file mode 100644 index ab5a7322ab..0000000000 --- a/support/logresolve.pl +++ /dev/null @@ -1,261 +0,0 @@ -#!/usr/bin/perl -# ==================================================================== -# The Apache Software License, Version 1.1 -# -# Copyright (c) 2000-2001 The Apache Software Foundation. All rights -# reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# -# 3. The end-user documentation included with the redistribution, -# if any, must include the following acknowledgment: -# "This product includes software developed by the -# Apache Software Foundation (http://www.apache.org/)." -# Alternately, this acknowledgment may appear in the software itself, -# if and wherever such third-party acknowledgments normally appear. -# -# 4. The names "Apache" and "Apache Software Foundation" must -# not be used to endorse or promote products derived from this -# software without prior written permission. For written -# permission, please contact apache@apache.org. -# -# 5. Products derived from this software may not be called "Apache", -# nor may "Apache" appear in their name, without prior written -# permission of the Apache Software Foundation. -# -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR -# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# ==================================================================== -# -# This software consists of voluntary contributions made by many -# individuals on behalf of the Apache Software Foundation. For more -# information on the Apache Software Foundation, please see -# <http://www.apache.org/>. -# -# logresolve.pl -# -# v 1.2 by robh @ imdb.com -# -# usage: logresolve.pl <infile >outfile -# -# input = Apache/NCSA/.. logfile with IP numbers at start of lines -# output = same logfile with IP addresses resolved to hostnames where -# name lookups succeeded. -# -# this differs from the C based 'logresolve' in that this script -# spawns a number ($CHILDREN) of subprocesses to resolve addresses -# concurrently and sets a short timeout ($TIMEOUT) for each lookup in -# order to keep things moving quickly. -# -# the parent process handles caching of IP->hostnames using a Perl hash -# it also avoids sending the same IP to multiple child processes to be -# resolved multiple times concurrently. -# -# Depending on the settings of $CHILDREN and $TIMEOUT you should see -# significant reductions in the overall time taken to resolve your -# logfiles. With $CHILDREN=40 and $TIMEOUT=5 I've seen 200,000 - 300,000 -# logfile lines processed per hour compared to ~45,000 per hour -# with 'logresolve'. -# -# I haven't yet seen any noticable reduction in the percentage of IPs -# that fail to get resolved. Your mileage will no doubt vary. 5s is long -# enough to wait IMO. -# -# Known to work with FreeBSD 2.2 -# Known to have problems with Solaris -# -# 980417 - use 'sockaddr_un' for bind/connect to make the script work -# with linux. Fix from Luuk de Boer <luuk_de_boer@pi.net> - -require 5.004; - -$|=1; - -use FileHandle; -use Socket; - -use strict; -no strict 'refs'; - -use vars qw($PROTOCOL); -$PROTOCOL = 0; - -my $CHILDREN = 40; -my $TIMEOUT = 5; - -my $filename; -my %hash = (); -my $parent = $$; - -my @children = (); -for (my $child = 1; $child <=$CHILDREN; $child++) { - my $f = fork(); - if (!$f) { - $filename = "./.socket.$parent.$child"; - if (-e $filename) { unlink($filename) || warn "$filename .. $!\n";} - &child($child); - exit(0); - } - push(@children, $f); -} - -&parent; -&cleanup; - -## remove all temporary files before shutting down -sub cleanup { - # die kiddies, die - kill(15, @children); - for (my $child = 1; $child <=$CHILDREN; $child++) { - if (-e "./.socket.$parent.$child") { - unlink("./.socket.$parent.$child") - || warn ".socket.$parent.$child $!"; - } - } -} - -sub parent { - # Trap some possible signals to trigger temp file cleanup - $SIG{'KILL'} = $SIG{'INT'} = $SIG{'PIPE'} = \&cleanup; - - my %CHILDSOCK; - my $filename; - - ## fork child processes. Each child will create a socket connection - ## to this parent and use an unique temp filename to do so. - for (my $child = 1; $child <=$CHILDREN; $child++) { - $CHILDSOCK{$child}= FileHandle->new; - - if (!socket($CHILDSOCK{$child}, AF_UNIX, SOCK_STREAM, $PROTOCOL)) { - warn "parent socket to child failed $!"; - } - $filename = "./.socket.$parent.$child"; - my $response; - do { - $response = connect($CHILDSOCK{$child}, sockaddr_un($filename)); - if ($response != 1) { - sleep(1); - } - } while ($response != 1); - $CHILDSOCK{$child}->autoflush; - } - ## All child processes should now be ready or at worst warming up - - my (@buffer, $child, $ip, $rest, $hostname, $response); - ## read the logfile lines from STDIN - while(<STDIN>) { - @buffer = (); # empty the logfile line buffer array. - $child = 1; # children are numbered 1..N, start with #1 - - # while we have a child to talk to and data to give it.. - do { - push(@buffer, $_); # buffer the line - ($ip, $rest) = split(/ /, $_, 2); # separate IP form rest - - unless ($hash{$ip}) { # resolve if unseen IP - $CHILDSOCK{$child}->print("$ip\n"); # pass IP to next child - $hash{$ip} = $ip; # don't look it up again. - $child++; - } - } while (($child < ($CHILDREN-1)) and ($_ = <STDIN>)); - - ## now poll each child for a response - while (--$child > 0) { - $response = $CHILDSOCK{$child}->getline; - chomp($response); - # child sends us back both the IP and HOSTNAME, no need for us - # to remember what child received any given IP, and no worries - # what order we talk to the children - ($ip, $hostname) = split(/\|/, $response, 2); - $hash{$ip} = $hostname; - } - - # resolve all the logfiles lines held in the log buffer array.. - for (my $line = 0; $line <=$#buffer; $line++) { - # get next buffered line - ($ip, $rest) = split(/ /, $buffer[$line], 2); - # separate IP from rest and replace with cached hostname - printf STDOUT ("%s %s", $hash{$ip}, $rest); - } - } -} - -######################################## - -sub child { - # arg = numeric ID - how the parent refers to me - my $me = shift; - - # add trap for alarm signals. - $SIG{'ALRM'} = sub { die "alarmed"; }; - - # create a socket to communicate with parent - socket(INBOUND, AF_UNIX, SOCK_STREAM, $PROTOCOL) - || die "Error with Socket: !$\n"; - $filename = "./.socket.$parent.$me"; - bind(INBOUND, sockaddr_un($filename)) - || die "Error Binding $filename: $!\n"; - listen(INBOUND, 5) || die "Error Listening: $!\n"; - - my ($ip, $send_back); - my $talk = FileHandle->new; - - # accept a connection from the parent process. We only ever have - # have one connection where we exchange 1 line of info with the - # parent.. 1 line in (IP address), 1 line out (IP + hostname). - accept($talk, INBOUND) || die "Error Accepting: $!\n"; - # disable I/O buffering just in case - $talk->autoflush; - # while the parent keeps sending data, we keep responding.. - while(($ip = $talk->getline)) { - chomp($ip); - # resolve the IP if time permits and send back what we found.. - $send_back = sprintf("%s|%s", $ip, &nslookup($ip)); - $talk->print($send_back."\n"); - } -} - -# perform a time restricted hostname lookup. -sub nslookup { - # get the IP as an arg - my $ip = shift; - my $hostname = undef; - - # do the hostname lookup inside an eval. The eval will use the - # already configured SIGnal handler and drop out of the {} block - # regardless of whether the alarm occured or not. - eval { - alarm($TIMEOUT); - $hostname = gethostbyaddr(gethostbyname($ip), AF_INET); - alarm(0); - }; - if ($@ =~ /alarm/) { - # useful for debugging perhaps.. - # print "alarming, isn't it? ($ip)"; - } - - # return the hostname or the IP address itself if there is no hostname - $hostname ne "" ? $hostname : $ip; -} - - diff --git a/support/logresolve.pl.in b/support/logresolve.pl.in deleted file mode 100644 index c2142f161d..0000000000 --- a/support/logresolve.pl.in +++ /dev/null @@ -1,261 +0,0 @@ -#!@perlbin@ -# ==================================================================== -# The Apache Software License, Version 1.1 -# -# Copyright (c) 2000-2001 The Apache Software Foundation. All rights -# reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# -# 3. The end-user documentation included with the redistribution, -# if any, must include the following acknowledgment: -# "This product includes software developed by the -# Apache Software Foundation (http://www.apache.org/)." -# Alternately, this acknowledgment may appear in the software itself, -# if and wherever such third-party acknowledgments normally appear. -# -# 4. The names "Apache" and "Apache Software Foundation" must -# not be used to endorse or promote products derived from this -# software without prior written permission. For written -# permission, please contact apache@apache.org. -# -# 5. Products derived from this software may not be called "Apache", -# nor may "Apache" appear in their name, without prior written -# permission of the Apache Software Foundation. -# -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR -# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# ==================================================================== -# -# This software consists of voluntary contributions made by many -# individuals on behalf of the Apache Software Foundation. For more -# information on the Apache Software Foundation, please see -# <http://www.apache.org/>. -# -# logresolve.pl -# -# v 1.2 by robh @ imdb.com -# -# usage: logresolve.pl <infile >outfile -# -# input = Apache/NCSA/.. logfile with IP numbers at start of lines -# output = same logfile with IP addresses resolved to hostnames where -# name lookups succeeded. -# -# this differs from the C based 'logresolve' in that this script -# spawns a number ($CHILDREN) of subprocesses to resolve addresses -# concurrently and sets a short timeout ($TIMEOUT) for each lookup in -# order to keep things moving quickly. -# -# the parent process handles caching of IP->hostnames using a Perl hash -# it also avoids sending the same IP to multiple child processes to be -# resolved multiple times concurrently. -# -# Depending on the settings of $CHILDREN and $TIMEOUT you should see -# significant reductions in the overall time taken to resolve your -# logfiles. With $CHILDREN=40 and $TIMEOUT=5 I've seen 200,000 - 300,000 -# logfile lines processed per hour compared to ~45,000 per hour -# with 'logresolve'. -# -# I haven't yet seen any noticable reduction in the percentage of IPs -# that fail to get resolved. Your mileage will no doubt vary. 5s is long -# enough to wait IMO. -# -# Known to work with FreeBSD 2.2 -# Known to have problems with Solaris -# -# 980417 - use 'sockaddr_un' for bind/connect to make the script work -# with linux. Fix from Luuk de Boer <luuk_de_boer@pi.net> - -require 5.004; - -$|=1; - -use FileHandle; -use Socket; - -use strict; -no strict 'refs'; - -use vars qw($PROTOCOL); -$PROTOCOL = 0; - -my $CHILDREN = 40; -my $TIMEOUT = 5; - -my $filename; -my %hash = (); -my $parent = $$; - -my @children = (); -for (my $child = 1; $child <=$CHILDREN; $child++) { - my $f = fork(); - if (!$f) { - $filename = "./.socket.$parent.$child"; - if (-e $filename) { unlink($filename) || warn "$filename .. $!\n";} - &child($child); - exit(0); - } - push(@children, $f); -} - -&parent; -&cleanup; - -## remove all temporary files before shutting down -sub cleanup { - # die kiddies, die - kill(15, @children); - for (my $child = 1; $child <=$CHILDREN; $child++) { - if (-e "./.socket.$parent.$child") { - unlink("./.socket.$parent.$child") - || warn ".socket.$parent.$child $!"; - } - } -} - -sub parent { - # Trap some possible signals to trigger temp file cleanup - $SIG{'KILL'} = $SIG{'INT'} = $SIG{'PIPE'} = \&cleanup; - - my %CHILDSOCK; - my $filename; - - ## fork child processes. Each child will create a socket connection - ## to this parent and use an unique temp filename to do so. - for (my $child = 1; $child <=$CHILDREN; $child++) { - $CHILDSOCK{$child}= FileHandle->new; - - if (!socket($CHILDSOCK{$child}, AF_UNIX, SOCK_STREAM, $PROTOCOL)) { - warn "parent socket to child failed $!"; - } - $filename = "./.socket.$parent.$child"; - my $response; - do { - $response = connect($CHILDSOCK{$child}, sockaddr_un($filename)); - if ($response != 1) { - sleep(1); - } - } while ($response != 1); - $CHILDSOCK{$child}->autoflush; - } - ## All child processes should now be ready or at worst warming up - - my (@buffer, $child, $ip, $rest, $hostname, $response); - ## read the logfile lines from STDIN - while(<STDIN>) { - @buffer = (); # empty the logfile line buffer array. - $child = 1; # children are numbered 1..N, start with #1 - - # while we have a child to talk to and data to give it.. - do { - push(@buffer, $_); # buffer the line - ($ip, $rest) = split(/ /, $_, 2); # separate IP form rest - - unless ($hash{$ip}) { # resolve if unseen IP - $CHILDSOCK{$child}->print("$ip\n"); # pass IP to next child - $hash{$ip} = $ip; # don't look it up again. - $child++; - } - } while (($child < ($CHILDREN-1)) and ($_ = <STDIN>)); - - ## now poll each child for a response - while (--$child > 0) { - $response = $CHILDSOCK{$child}->getline; - chomp($response); - # child sends us back both the IP and HOSTNAME, no need for us - # to remember what child received any given IP, and no worries - # what order we talk to the children - ($ip, $hostname) = split(/\|/, $response, 2); - $hash{$ip} = $hostname; - } - - # resolve all the logfiles lines held in the log buffer array.. - for (my $line = 0; $line <=$#buffer; $line++) { - # get next buffered line - ($ip, $rest) = split(/ /, $buffer[$line], 2); - # separate IP from rest and replace with cached hostname - printf STDOUT ("%s %s", $hash{$ip}, $rest); - } - } -} - -######################################## - -sub child { - # arg = numeric ID - how the parent refers to me - my $me = shift; - - # add trap for alarm signals. - $SIG{'ALRM'} = sub { die "alarmed"; }; - - # create a socket to communicate with parent - socket(INBOUND, AF_UNIX, SOCK_STREAM, $PROTOCOL) - || die "Error with Socket: !$\n"; - $filename = "./.socket.$parent.$me"; - bind(INBOUND, sockaddr_un($filename)) - || die "Error Binding $filename: $!\n"; - listen(INBOUND, 5) || die "Error Listening: $!\n"; - - my ($ip, $send_back); - my $talk = FileHandle->new; - - # accept a connection from the parent process. We only ever have - # have one connection where we exchange 1 line of info with the - # parent.. 1 line in (IP address), 1 line out (IP + hostname). - accept($talk, INBOUND) || die "Error Accepting: $!\n"; - # disable I/O buffering just in case - $talk->autoflush; - # while the parent keeps sending data, we keep responding.. - while(($ip = $talk->getline)) { - chomp($ip); - # resolve the IP if time permits and send back what we found.. - $send_back = sprintf("%s|%s", $ip, &nslookup($ip)); - $talk->print($send_back."\n"); - } -} - -# perform a time restricted hostname lookup. -sub nslookup { - # get the IP as an arg - my $ip = shift; - my $hostname = undef; - - # do the hostname lookup inside an eval. The eval will use the - # already configured SIGnal handler and drop out of the {} block - # regardless of whether the alarm occured or not. - eval { - alarm($TIMEOUT); - $hostname = gethostbyaddr(gethostbyname($ip), AF_INET); - alarm(0); - }; - if ($@ =~ /alarm/) { - # useful for debugging perhaps.. - # print "alarming, isn't it? ($ip)"; - } - - # return the hostname or the IP address itself if there is no hostname - $hostname ne "" ? $hostname : $ip; -} - - diff --git a/support/phf_abuse_log.cgi b/support/phf_abuse_log.cgi deleted file mode 100644 index 87543ce5f4..0000000000 --- a/support/phf_abuse_log.cgi +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/perl - -# This script is used to detect people trying to abuse the security hole which -# existed in A CGI script direstributed with Apache 1.0.3 and earlier versions. -# You can redirect them to here using the "<Location /cgi-bin/phf*>" suggestion -# in httpd.conf. -# -# The format logged to is -# "[date] remote_addr remote_host [date] referrer user_agent". - -$LOG = "/var/log/phf_log"; - -require "ctime.pl"; -$when = &ctime(time); -$when =~ s/\n//go; -$ENV{HTTP_USER_AGENT} .= " via $ENV{HTTP_VIA}" if($ENV{HTTP_VIA}); - -open(LOG, ">>$LOG") || die "boo hoo, phf_log $!"; -print LOG "[$when] $ENV{REMOTE_ADDR} $ENV{REMOTE_HOST} $ENV{$HTTP_REFERER} $ENV{HTTP_USER_AGENT}\n"; -close(LOG); - -print "Content-type: text/html\r\n\r\n<BLINK>Smile, you're on Candid Camera.</BLINK>\n"; diff --git a/support/phf_abuse_log.cgi.in b/support/phf_abuse_log.cgi.in deleted file mode 100644 index 723f553bac..0000000000 --- a/support/phf_abuse_log.cgi.in +++ /dev/null @@ -1,22 +0,0 @@ -#!@perlbin@ - -# This script is used to detect people trying to abuse the security hole which -# existed in A CGI script direstributed with Apache 1.0.3 and earlier versions. -# You can redirect them to here using the "<Location /cgi-bin/phf*>" suggestion -# in httpd.conf. -# -# The format logged to is -# "[date] remote_addr remote_host [date] referrer user_agent". - -$LOG = "/var/log/phf_log"; - -require "ctime.pl"; -$when = &ctime(time); -$when =~ s/\n//go; -$ENV{HTTP_USER_AGENT} .= " via $ENV{HTTP_VIA}" if($ENV{HTTP_VIA}); - -open(LOG, ">>$LOG") || die "boo hoo, phf_log $!"; -print LOG "[$when] $ENV{REMOTE_ADDR} $ENV{REMOTE_HOST} $ENV{$HTTP_REFERER} $ENV{HTTP_USER_AGENT}\n"; -close(LOG); - -print "Content-type: text/html\r\n\r\n<BLINK>Smile, you're on Candid Camera.</BLINK>\n"; diff --git a/support/rotatelogs.c b/support/rotatelogs.c deleted file mode 100644 index dab94408c5..0000000000 --- a/support/rotatelogs.c +++ /dev/null @@ -1,208 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ - -/* - * Simple program to rotate Apache logs without having to kill the server. - * - * Contributed by Ben Laurie <ben@algroup.co.uk> - * - * 12 Mar 1996 - */ - - -#include "apr.h" -#include <string.h> -#include <stdlib.h> -#include <time.h> -#include <errno.h> -#if APR_HAVE_STDIO_H -#include <stdio.h> -#endif -#if APR_HAVE_UNISTD_H -#include <unistd.h> -#endif -#if APR_HAVE_IO_H -#include <io.h> -#endif -#if APR_HAVE_FCNTL_H -#include <fcntl.h> -#endif - -#define BUFSIZE 65536 -#define ERRMSGSZ 82 - -#ifndef MAX_PATH -#define MAX_PATH 1024 -#endif - -int main (int argc, char *argv[]) -{ - char buf[BUFSIZE], buf2[MAX_PATH], errbuf[ERRMSGSZ]; - time_t tLogEnd = 0, tRotation; - int nLogFD = -1, nLogFDprev = -1, nMessCount = 0, nRead, nWrite; - int utc_offset = 0; - int use_strftime = 0; - time_t now; - char *szLogRoot; - - if (argc < 3) { - fprintf(stderr, - "Usage: %s <logfile> <rotation time in seconds> " - "[offset minutes from UTC]\n\n", - argv[0]); -#ifdef OS2 - fprintf(stderr, - "Add this:\n\nTransferLog \"|%s.exe /some/where 86400\"\n\n", - argv[0]); -#else - fprintf(stderr, - "Add this:\n\nTransferLog \"|%s /some/where 86400\"\n\n", - argv[0]); -#endif - fprintf(stderr, - "to httpd.conf. The generated name will be /some/where.nnnn " - "where nnnn is the\nsystem time at which the log nominally " - "starts (N.B. this time will always be a\nmultiple of the " - "rotation time, so you can synchronize cron scripts with it).\n" - "At the end of each rotation time a new log is started.\n"); - exit(1); - } - - szLogRoot = argv[1]; - if (argc >= 4) { - utc_offset = atoi(argv[3]) * 60; - } - tRotation = atoi(argv[2]); - if (tRotation <= 0) { - fprintf(stderr, "Rotation time must be > 0\n"); - exit(6); - } - - use_strftime = (strstr(szLogRoot, "%") != NULL); - for (;;) { - nRead = read(0, buf, sizeof buf); - now = time(NULL) + utc_offset; - if (nRead == 0) - exit(3); - if (nRead < 0) - if (errno != EINTR) - exit(4); - if (nLogFD >= 0 && (now >= tLogEnd || nRead < 0)) { - nLogFDprev = nLogFD; - nLogFD = -1; - } - if (nLogFD < 0) { - time_t tLogStart = (now / tRotation) * tRotation; - if (use_strftime) { - struct tm *tm_now; - tm_now = gmtime(&tLogStart); - strftime(buf2, sizeof(buf2), szLogRoot, tm_now); - } - else { - sprintf(buf2, "%s.%010d", szLogRoot, (int) tLogStart); - } - tLogEnd = tLogStart + tRotation; - nLogFD = open(buf2, O_WRONLY | O_CREAT | O_APPEND, 0666); - if (nLogFD < 0) { - /* Uh-oh. Failed to open the new log file. Try to clear - * the previous log file, note the lost log entries, - * and keep on truckin'. */ - if (nLogFDprev == -1) { - perror(buf2); - exit(2); - } - else { - nLogFD = nLogFDprev; - sprintf(errbuf, - "Resetting log file due to error opening " - "new log file. %10d messages lost.\n", - nMessCount); - nWrite = strlen(errbuf); -#ifdef WIN32 - chsize(nLogFD, 0); -#else - ftruncate(nLogFD, 0); -#endif - write(nLogFD, errbuf, nWrite); - } - } - else { - close(nLogFDprev); - } - nMessCount = 0; - } - do { - nWrite = write(nLogFD, buf, nRead); - } while (nWrite < 0 && errno == EINTR); - if (nWrite != nRead) { - nMessCount++; - sprintf(errbuf, - "Error writing to log file. " - "%10d messages lost.\n", - nMessCount); - nWrite = strlen(errbuf); -#ifdef WIN32 - chsize(nLogFD, 0); -#else - ftruncate(nLogFD, 0); -#endif - write (nLogFD, errbuf, nWrite); - } - else { - nMessCount++; - } - } - /* Of course we never, but prevent compiler warnings */ - return 0; -} diff --git a/support/rotatelogs.dsp b/support/rotatelogs.dsp deleted file mode 100644 index 876092d869..0000000000 --- a/support/rotatelogs.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="rotatelogs" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=rotatelogs - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "rotatelogs.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "rotatelogs.mak" CFG="rotatelogs - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "rotatelogs - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "rotatelogs - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "rotatelogs - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fd"Release/rotatelogs" /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /map /machine:I386 - -!ELSEIF "$(CFG)" == "rotatelogs - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /FD /c -# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fd"Debug/rotatelogs" /FD /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /incremental:no /map /debug /machine:I386 -# ADD LINK32 kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo /subsystem:console /incremental:no /map /debug /machine:I386 - -!ENDIF - -# Begin Target - -# Name "rotatelogs - Win32 Release" -# Name "rotatelogs - Win32 Debug" -# Begin Source File - -SOURCE=.\rotatelogs.c -# End Source File -# End Target -# End Project diff --git a/support/rotatelogs.mak b/support/rotatelogs.mak deleted file mode 100644 index e96167867a..0000000000 --- a/support/rotatelogs.mak +++ /dev/null @@ -1,212 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on rotatelogs.dsp -!IF "$(CFG)" == "" -CFG=rotatelogs - Win32 Debug -!MESSAGE No configuration specified. Defaulting to rotatelogs - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "rotatelogs - Win32 Release" && "$(CFG)" !=\ - "rotatelogs - Win32 Debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "rotatelogs.mak" CFG="rotatelogs - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "rotatelogs - Win32 Release" (based on\ - "Win32 (x86) Console Application") -!MESSAGE "rotatelogs - Win32 Debug" (based on\ - "Win32 (x86) Console Application") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "rotatelogs - Win32 Release" - -OUTDIR=.\Release -INTDIR=.\Release -# Begin Custom Macros -OutDir=.\Release -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\rotatelogs.exe" - -!ELSE - -ALL : "$(OUTDIR)\rotatelogs.exe" - -!ENDIF - -CLEAN : - -@erase "$(INTDIR)\rotatelogs.idb" - -@erase "$(INTDIR)\rotatelogs.obj" - -@erase "$(OUTDIR)\rotatelogs.exe" - -@erase "$(OUTDIR)\rotatelogs.map" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /I "../srclib/apr/include" /I\ - "../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D\ - "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\"\ - /Fd"$(INTDIR)\rotatelogs" /FD /c -CPP_OBJS=.\Release/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\rotatelogs.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo\ - /subsystem:console /incremental:no /pdb:"$(OUTDIR)\rotatelogs.pdb"\ - /map:"$(INTDIR)\rotatelogs.map" /machine:I386 /out:"$(OUTDIR)\rotatelogs.exe" -LINK32_OBJS= \ - "$(INTDIR)\rotatelogs.obj" - -"$(OUTDIR)\rotatelogs.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "rotatelogs - Win32 Debug" - -OUTDIR=.\Debug -INTDIR=.\Debug -# Begin Custom Macros -OutDir=.\Debug -# End Custom Macros - -!IF "$(RECURSE)" == "0" - -ALL : "$(OUTDIR)\rotatelogs.exe" - -!ELSE - -ALL : "$(OUTDIR)\rotatelogs.exe" - -!ENDIF - -CLEAN : - -@erase "$(INTDIR)\rotatelogs.idb" - -@erase "$(INTDIR)\rotatelogs.obj" - -@erase "$(OUTDIR)\rotatelogs.exe" - -@erase "$(OUTDIR)\rotatelogs.map" - -@erase "$(OUTDIR)\rotatelogs.pdb" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MDd /W3 /GX /Zi /Od /I "../srclib/apr/include" /I\ - "../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D\ - "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\"\ - /Fd"$(INTDIR)\rotatelogs" /FD /c -CPP_OBJS=.\Debug/ -CPP_SBRS=. - -.c{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_OBJS)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(CPP_SBRS)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\rotatelogs.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=kernel32.lib advapi32.lib wsock32.lib ws2_32.lib /nologo\ - /subsystem:console /incremental:no /pdb:"$(OUTDIR)\rotatelogs.pdb"\ - /map:"$(INTDIR)\rotatelogs.map" /debug /machine:I386\ - /out:"$(OUTDIR)\rotatelogs.exe" -LINK32_OBJS= \ - "$(INTDIR)\rotatelogs.obj" - -"$(OUTDIR)\rotatelogs.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(CFG)" == "rotatelogs - Win32 Release" || "$(CFG)" ==\ - "rotatelogs - Win32 Debug" -SOURCE=.\rotatelogs.c -DEP_CPP_ROTAT=\ - "..\srclib\apr\include\apr.h"\ - - -"$(INTDIR)\rotatelogs.obj" : $(SOURCE) $(DEP_CPP_ROTAT) "$(INTDIR)" - - - -!ENDIF - diff --git a/support/split-logfile b/support/split-logfile deleted file mode 100644 index c0f34861aa..0000000000 --- a/support/split-logfile +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/perl -# ==================================================================== -# The Apache Software License, Version 1.1 -# -# Copyright (c) 2000-2001 The Apache Software Foundation. All rights -# reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# -# 3. The end-user documentation included with the redistribution, -# if any, must include the following acknowledgment: -# "This product includes software developed by the -# Apache Software Foundation (http://www.apache.org/)." -# Alternately, this acknowledgment may appear in the software itself, -# if and wherever such third-party acknowledgments normally appear. -# -# 4. The names "Apache" and "Apache Software Foundation" must -# not be used to endorse or promote products derived from this -# software without prior written permission. For written -# permission, please contact apache@apache.org. -# -# 5. Products derived from this software may not be called "Apache", -# nor may "Apache" appear in their name, without prior written -# permission of the Apache Software Foundation. -# -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR -# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# ==================================================================== -# -# This software consists of voluntary contributions made by many -# individuals on behalf of the Apache Software Foundation. For more -# information on the Apache Software Foundation, please see -# <http://www.apache.org/>. - -# This script will take a combined Web server access -# log file and break its contents into separate files. -# It assumes that the first field of each line is the -# virtual host identity (put there by "%v"), and that -# the logfiles should be named that+".log" in the current -# directory. -# -# The combined log file is read from stdin. Records read -# will be appended to any existing log files. -# -%is_open = (); - -while ($log_line = <STDIN>) { - # - # Get the first token from the log record; it's the - # identity of the virtual host to which the record - # applies. - # - ($vhost) = split (/\s/, $log_line); - # - # Normalize the virtual host name to all lowercase. - # If it's blank, the request was handled by the default - # server, so supply a default name. This shouldn't - # happen, but caution rocks. - # - $vhost = lc ($vhost) or "access"; - # - # If the log file for this virtual host isn't opened - # yet, do it now. - # - if (! $is_open{$vhost}) { - open $vhost, ">>${vhost}.log" - or die ("Can't open ${vhost}.log"); - $is_open{$vhost} = 1; - } - # - # Strip off the first token (which may be null in the - # case of the default server), and write the edited - # record to the current log file. - # - $log_line =~ s/^\S*\s+//; - printf $vhost "%s", $log_line; -} -exit 0; diff --git a/support/split-logfile.in b/support/split-logfile.in deleted file mode 100644 index 66de2ebfdd..0000000000 --- a/support/split-logfile.in +++ /dev/null @@ -1,98 +0,0 @@ -#!@perlbin@ -# ==================================================================== -# The Apache Software License, Version 1.1 -# -# Copyright (c) 2000-2001 The Apache Software Foundation. All rights -# reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# -# 3. The end-user documentation included with the redistribution, -# if any, must include the following acknowledgment: -# "This product includes software developed by the -# Apache Software Foundation (http://www.apache.org/)." -# Alternately, this acknowledgment may appear in the software itself, -# if and wherever such third-party acknowledgments normally appear. -# -# 4. The names "Apache" and "Apache Software Foundation" must -# not be used to endorse or promote products derived from this -# software without prior written permission. For written -# permission, please contact apache@apache.org. -# -# 5. Products derived from this software may not be called "Apache", -# nor may "Apache" appear in their name, without prior written -# permission of the Apache Software Foundation. -# -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR -# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# ==================================================================== -# -# This software consists of voluntary contributions made by many -# individuals on behalf of the Apache Software Foundation. For more -# information on the Apache Software Foundation, please see -# <http://www.apache.org/>. - -# This script will take a combined Web server access -# log file and break its contents into separate files. -# It assumes that the first field of each line is the -# virtual host identity (put there by "%v"), and that -# the logfiles should be named that+".log" in the current -# directory. -# -# The combined log file is read from stdin. Records read -# will be appended to any existing log files. -# -%is_open = (); - -while ($log_line = <STDIN>) { - # - # Get the first token from the log record; it's the - # identity of the virtual host to which the record - # applies. - # - ($vhost) = split (/\s/, $log_line); - # - # Normalize the virtual host name to all lowercase. - # If it's blank, the request was handled by the default - # server, so supply a default name. This shouldn't - # happen, but caution rocks. - # - $vhost = lc ($vhost) or "access"; - # - # If the log file for this virtual host isn't opened - # yet, do it now. - # - if (! $is_open{$vhost}) { - open $vhost, ">>${vhost}.log" - or die ("Can't open ${vhost}.log"); - $is_open{$vhost} = 1; - } - # - # Strip off the first token (which may be null in the - # case of the default server), and write the edited - # record to the current log file. - # - $log_line =~ s/^\S*\s+//; - printf $vhost "%s", $log_line; -} -exit 0; diff --git a/support/suexec.c b/support/suexec.c deleted file mode 100644 index 8550ba9abe..0000000000 --- a/support/suexec.c +++ /dev/null @@ -1,634 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ - -/* - * suexec.c -- "Wrapper" support program for suEXEC behaviour for Apache - * - *********************************************************************** - * - * NOTE! : DO NOT edit this code!!! Unless you know what you are doing, - * editing this code might open up your system in unexpected - * ways to would-be crackers. Every precaution has been taken - * to make this code as safe as possible; alter it at your own - * risk. - * - *********************************************************************** - * - * - */ - -#include "ap_config.h" -#include <sys/param.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <string.h> -#include <time.h> -#include <unistd.h> - -#include <stdio.h> -#include <stdarg.h> -#include <stdlib.h> - -#include "suexec.h" - -#ifdef HAVE_PWD_H -#include <pwd.h> -#endif - -#ifdef HAVE_GRP_H -#include <grp.h> -#endif - -/* - *********************************************************************** - * There is no initgroups() in QNX, so I believe this is safe :-) - * Use cc -osuexec -3 -O -mf -DQNX suexec.c to compile. - * - * May 17, 1997. - * Igor N. Kovalenko -- infoh@mail.wplus.net - *********************************************************************** - */ - -#if defined(NEED_INITGROUPS) -int initgroups(const char *name, gid_t basegid) -{ -/* QNX and MPE do not appear to support supplementary groups. */ - return 0; -} -#endif - -#if defined(PATH_MAX) -#define AP_MAXPATH PATH_MAX -#elif defined(MAXPATHLEN) -#define AP_MAXPATH MAXPATHLEN -#else -#define AP_MAXPATH 8192 -#endif - -#define AP_ENVBUF 256 - -extern char **environ; -static FILE *log = NULL; - -char *safe_env_lst[] = -{ - "AUTH_TYPE", - "CONTENT_LENGTH", - "CONTENT_TYPE", - "DATE_GMT", - "DATE_LOCAL", - "DOCUMENT_NAME", - "DOCUMENT_PATH_INFO", - "DOCUMENT_ROOT", - "DOCUMENT_URI", - "FILEPATH_INFO", - "GATEWAY_INTERFACE", - "LAST_MODIFIED", - "PATH_INFO", - "PATH_TRANSLATED", - "QUERY_STRING", - "QUERY_STRING_UNESCAPED", - "REMOTE_ADDR", - "REMOTE_HOST", - "REMOTE_IDENT", - "REMOTE_PORT", - "REMOTE_USER", - "REDIRECT_QUERY_STRING", - "REDIRECT_STATUS", - "REDIRECT_URL", - "REQUEST_METHOD", - "REQUEST_URI", - "SCRIPT_FILENAME", - "SCRIPT_NAME", - "SCRIPT_URI", - "SCRIPT_URL", - "SERVER_ADMIN", - "SERVER_NAME", - "SERVER_ADDR", - "SERVER_PORT", - "SERVER_PROTOCOL", - "SERVER_SOFTWARE", - "UNIQUE_ID", - "USER_NAME", - "TZ", - NULL -}; - - -static void err_output(const char *fmt, va_list ap) -{ -#ifdef AP_LOG_EXEC - time_t timevar; - struct tm *lt; - - if (!log) { - if ((log = fopen(AP_LOG_EXEC, "a")) == NULL) { - fprintf(stderr, "failed to open log file\n"); - perror("fopen"); - exit(1); - } - } - - time(&timevar); - lt = localtime(&timevar); - - fprintf(log, "[%d-%.2d-%.2d %.2d:%.2d:%.2d]: ", - lt->tm_year + 1900, lt->tm_mon + 1, lt->tm_mday, - lt->tm_hour, lt->tm_min, lt->tm_sec); - - vfprintf(log, fmt, ap); - - fflush(log); -#endif /* AP_LOG_EXEC */ - return; -} - -static void log_err(const char *fmt,...) -{ -#ifdef AP_LOG_EXEC - va_list ap; - - va_start(ap, fmt); - err_output(fmt, ap); - va_end(ap); -#endif /* AP_LOG_EXEC */ - return; -} - -static void clean_env(void) -{ - char pathbuf[512]; - char **cleanenv; - char **ep; - int cidx = 0; - int idx; - - - if ((cleanenv = (char **) calloc(AP_ENVBUF, sizeof(char *))) == NULL) { - log_err("failed to malloc memory for environment\n"); - exit(120); - } - - sprintf(pathbuf, "PATH=%s", AP_SAFE_PATH); - cleanenv[cidx] = strdup(pathbuf); - cidx++; - - for (ep = environ; *ep && cidx < AP_ENVBUF-1; ep++) { - if (!strncmp(*ep, "HTTP_", 5)) { - cleanenv[cidx] = *ep; - cidx++; - } - else { - for (idx = 0; safe_env_lst[idx]; idx++) { - if (!strncmp(*ep, safe_env_lst[idx], - strlen(safe_env_lst[idx]))) { - cleanenv[cidx] = *ep; - cidx++; - break; - } - } - } - } - - cleanenv[cidx] = NULL; - - environ = cleanenv; -} - -int main(int argc, char *argv[]) -{ - int userdir = 0; /* ~userdir flag */ - uid_t uid; /* user information */ - gid_t gid; /* target group placeholder */ - char *target_uname; /* target user name */ - char *target_gname; /* target group name */ - char *target_homedir; /* target home directory */ - char *actual_uname; /* actual user name */ - char *actual_gname; /* actual group name */ - char *prog; /* name of this program */ - char *cmd; /* command to be executed */ - char cwd[AP_MAXPATH]; /* current working directory */ - char dwd[AP_MAXPATH]; /* docroot working directory */ - struct passwd *pw; /* password entry holder */ - struct group *gr; /* group entry holder */ - struct stat dir_info; /* directory info holder */ - struct stat prg_info; /* program info holder */ - - prog = argv[0]; - /* - * Check existence/validity of the UID of the user - * running this program. Error out if invalid. - */ - uid = getuid(); - if ((pw = getpwuid(uid)) == NULL) { - log_err("crit: invalid uid: (%ld)\n", uid); - exit(102); - } - /* - * See if this is a 'how were you compiled' request, and - * comply if so. - */ - if ((argc > 1) - && (! strcmp(argv[1], "-V")) - && ((uid == 0) -#ifdef _OSD_POSIX - /* User name comparisons are case insensitive on BS2000/OSD */ - || (! strcasecmp(AP_HTTPD_USER, pw->pw_name))) -#else /* _OSD_POSIX */ - || (! strcmp(AP_HTTPD_USER, pw->pw_name))) -#endif /* _OSD_POSIX */ - ) { -#ifdef AP_DOC_ROOT - fprintf(stderr, " -D AP_DOC_ROOT=\"%s\"\n", AP_DOC_ROOT); -#endif -#ifdef AP_GID_MIN - fprintf(stderr, " -D AP_GID_MID=%d\n", AP_GID_MIN); -#endif -#ifdef AP_HTTPD_USER - fprintf(stderr, " -D AP_HTTPD_USER=\"%s\"\n", AP_HTTPD_USER); -#endif -#ifdef AP_LOG_EXEC - fprintf(stderr, " -D AP_LOG_EXEC=\"%s\"\n", AP_LOG_EXEC); -#endif -#ifdef AP_SAFE_PATH - fprintf(stderr, " -D AP_SAFE_PATH=\"%s\"\n", AP_SAFE_PATH); -#endif -#ifdef AP_SUEXEC_UMASK - fprintf(stderr, " -D AP_SUEXEC_UMASK=%03o\n", AP_SUEXEC_UMASK); -#endif -#ifdef AP_UID_MIN - fprintf(stderr, " -D AP_UID_MID=%d\n", AP_UID_MIN); -#endif -#ifdef AP_USERDIR_SUFFIX - fprintf(stderr, " -D AP_USERDIR_SUFFIX=\"%s\"\n", AP_USERDIR_SUFFIX); -#endif - exit(0); - } - /* - * If there are a proper number of arguments, set - * all of them to variables. Otherwise, error out. - */ - if (argc < 4) { - log_err("too few arguments\n"); - exit(101); - } - target_uname = argv[1]; - target_gname = argv[2]; - cmd = argv[3]; - - /* - * Check to see if the user running this program - * is the user allowed to do so as defined in - * suexec.h. If not the allowed user, error out. - */ -#ifdef _OSD_POSIX - /* User name comparisons are case insensitive on BS2000/OSD */ - if (strcasecmp(AP_HTTPD_USER, pw->pw_name)) { - log_err("user mismatch (%s instead of %s)\n", pw->pw_name, AP_HTTPD_USER); - exit(103); - } -#else /*_OSD_POSIX*/ - if (strcmp(AP_HTTPD_USER, pw->pw_name)) { - log_err("user mismatch (%s instead of %s)\n", pw->pw_name, AP_HTTPD_USER); - exit(103); - } -#endif /*_OSD_POSIX*/ - - /* - * Check for a leading '/' (absolute path) in the command to be executed, - * or attempts to back up out of the current directory, - * to protect against attacks. If any are - * found, error out. Naughty naughty crackers. - */ - if ((cmd[0] == '/') || (!strncmp(cmd, "../", 3)) - || (strstr(cmd, "/../") != NULL)) { - log_err("invalid command (%s)\n", cmd); - exit(104); - } - - /* - * Check to see if this is a ~userdir request. If - * so, set the flag, and remove the '~' from the - * target username. - */ - if (!strncmp("~", target_uname, 1)) { - target_uname++; - userdir = 1; - } - - /* - * Error out if the target username is invalid. - */ - if (strspn(target_uname, "1234567890") != strlen(target_uname)) { - if ((pw = getpwnam(target_uname)) == NULL) { - log_err("invalid target user name: (%s)\n", target_uname); - exit(105); - } - } - else { - if ((pw = getpwuid(atoi(target_uname))) == NULL) { - log_err("invalud target user id: (%s)\n", target_uname); - exit(121); - } - } - - /* - * Error out if the target group name is invalid. - */ - if (strspn(target_gname, "1234567890") != strlen(target_gname)) { - if ((gr = getgrnam(target_gname)) == NULL) { - log_err("invalid target group name: (%s)\n", target_gname); - exit(106); - } - gid = gr->gr_gid; - actual_gname = strdup(gr->gr_name); - } - else { - gid = atoi(target_gname); - actual_gname = strdup(target_gname); - } - -#ifdef _OSD_POSIX - /* - * Initialize BS2000 user environment - */ - { - pid_t pid; - int status; - - switch (pid = ufork(target_uname)) - { - case -1: /* Error */ - log_err("failed to setup bs2000 environment for user %s: %s\n", - target_uname, strerror(errno)); - exit(150); - case 0: /* Child */ - break; - default: /* Father */ - while (pid != waitpid(pid, &status, 0)) - ; - /* @@@ FIXME: should we deal with STOP signals as well? */ - if (WIFSIGNALED(status)) - kill (getpid(), WTERMSIG(status)); - exit(WEXITSTATUS(status)); - } - } -#endif /*_OSD_POSIX*/ - - /* - * Save these for later since initgroups will hose the struct - */ - uid = pw->pw_uid; - actual_uname = strdup(pw->pw_name); - target_homedir = strdup(pw->pw_dir); - - /* - * Log the transaction here to be sure we have an open log - * before we setuid(). - */ - log_err("uid: (%s/%s) gid: (%s/%s) cmd: %s\n", - target_uname, actual_uname, - target_gname, actual_gname, - cmd); - - /* - * Error out if attempt is made to execute as root or as - * a UID less than AP_UID_MIN. Tsk tsk. - */ - if ((uid == 0) || (uid < AP_UID_MIN)) { - log_err("cannot run as forbidden uid (%d/%s)\n", uid, cmd); - exit(107); - } - - /* - * Error out if attempt is made to execute as root group - * or as a GID less than AP_GID_MIN. Tsk tsk. - */ - if ((gid == 0) || (gid < AP_GID_MIN)) { - log_err("cannot run as forbidden gid (%d/%s)\n", gid, cmd); - exit(108); - } - - /* - * Change UID/GID here so that the following tests work over NFS. - * - * Initialize the group access list for the target user, - * and setgid() to the target group. If unsuccessful, error out. - */ - if (((setgid(gid)) != 0) || (initgroups(actual_uname, gid) != 0)) { - log_err("failed to setgid (%ld: %s)\n", gid, cmd); - exit(109); - } - - /* - * setuid() to the target user. Error out on fail. - */ - if ((setuid(uid)) != 0) { - log_err("failed to setuid (%ld: %s)\n", uid, cmd); - exit(110); - } - - /* - * Get the current working directory, as well as the proper - * document root (dependant upon whether or not it is a - * ~userdir request). Error out if we cannot get either one, - * or if the current working directory is not in the docroot. - * Use chdir()s and getcwd()s to avoid problems with symlinked - * directories. Yuck. - */ - if (getcwd(cwd, AP_MAXPATH) == NULL) { - log_err("cannot get current working directory\n"); - exit(111); - } - - if (userdir) { - if (((chdir(target_homedir)) != 0) || - ((chdir(AP_USERDIR_SUFFIX)) != 0) || - ((getcwd(dwd, AP_MAXPATH)) == NULL) || - ((chdir(cwd)) != 0)) { - log_err("cannot get docroot information (%s)\n", target_homedir); - exit(112); - } - } - else { - if (((chdir(AP_DOC_ROOT)) != 0) || - ((getcwd(dwd, AP_MAXPATH)) == NULL) || - ((chdir(cwd)) != 0)) { - log_err("cannot get docroot information (%s)\n", AP_DOC_ROOT); - exit(113); - } - } - - if ((strncmp(cwd, dwd, strlen(dwd))) != 0) { - log_err("command not in docroot (%s/%s)\n", cwd, cmd); - exit(114); - } - - /* - * Stat the cwd and verify it is a directory, or error out. - */ - if (((lstat(cwd, &dir_info)) != 0) || !(S_ISDIR(dir_info.st_mode))) { - log_err("cannot stat directory: (%s)\n", cwd); - exit(115); - } - - /* - * Error out if cwd is writable by others. - */ - if ((dir_info.st_mode & S_IWOTH) || (dir_info.st_mode & S_IWGRP)) { - log_err("directory is writable by others: (%s)\n", cwd); - exit(116); - } - - /* - * Error out if we cannot stat the program. - */ - if (((lstat(cmd, &prg_info)) != 0) || (S_ISLNK(prg_info.st_mode))) { - log_err("cannot stat program: (%s)\n", cmd); - exit(117); - } - - /* - * Error out if the program is writable by others. - */ - if ((prg_info.st_mode & S_IWOTH) || (prg_info.st_mode & S_IWGRP)) { - log_err("file is writable by others: (%s/%s)\n", cwd, cmd); - exit(118); - } - - /* - * Error out if the file is setuid or setgid. - */ - if ((prg_info.st_mode & S_ISUID) || (prg_info.st_mode & S_ISGID)) { - log_err("file is either setuid or setgid: (%s/%s)\n", cwd, cmd); - exit(119); - } - - /* - * Error out if the target name/group is different from - * the name/group of the cwd or the program. - */ - if ((uid != dir_info.st_uid) || - (gid != dir_info.st_gid) || - (uid != prg_info.st_uid) || - (gid != prg_info.st_gid)) { - log_err("target uid/gid (%ld/%ld) mismatch " - "with directory (%ld/%ld) or program (%ld/%ld)\n", - uid, gid, - dir_info.st_uid, dir_info.st_gid, - prg_info.st_uid, prg_info.st_gid); - exit(120); - } - /* - * Error out if the program is not executable for the user. - * Otherwise, she won't find any error in the logs except for - * "[error] Premature end of script headers: ..." - */ - if (!(prg_info.st_mode & S_IXUSR)) { - log_err("file has no execute permission: (%s/%s)\n", cwd, cmd); - exit(121); - } - -#ifdef AP_SUEXEC_UMASK - /* - * umask() uses inverse logic; bits are CLEAR for allowed access. - */ - if ((~AP_SUEXEC_UMASK) & 0022) { - log_err("notice: AP_SUEXEC_UMASK of %03o allows " - "write permission to group and/or other\n", AP_SUEXEC_UMASK); - } - umask(AP_SUEXEC_UMASK); -#endif /* AP_SUEXEC_UMASK */ - clean_env(); - - /* - * Be sure to close the log file so the CGI can't - * mess with it. If the exec fails, it will be reopened - * automatically when log_err is called. Note that the log - * might not actually be open if AP_LOG_EXEC isn't defined. - * However, the "log" cell isn't ifdef'd so let's be defensive - * and assume someone might have done something with it - * outside an ifdef'd AP_LOG_EXEC block. - */ - if (log != NULL) { - fclose(log); - log = NULL; - } - - /* - * Execute the command, replacing our image with its own. - */ -#ifdef NEED_HASHBANG_EMUL - /* We need the #! emulation when we want to execute scripts */ - { - extern char **environ; - - ap_execve(cmd, &argv[3], environ); - } -#else /*NEED_HASHBANG_EMUL*/ - execv(cmd, &argv[3]); -#endif /*NEED_HASHBANG_EMUL*/ - - /* - * (I can't help myself...sorry.) - * - * Uh oh. Still here. Where's the kaboom? There was supposed to be an - * EARTH-shattering kaboom! - * - * Oh well, log the failure and error out. - */ - log_err("(%d)%s: exec failed (%s)\n", errno, - strerror(errno), cmd); - exit(255); -} diff --git a/support/suexec.h b/support/suexec.h deleted file mode 100644 index aa95425f57..0000000000 --- a/support/suexec.h +++ /dev/null @@ -1,140 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ - -/* - * suexec.h -- user-definable variables for the suexec wrapper code. - * (See README.configure on how to customize these variables.) - */ - - -#ifndef _SUEXEC_H -#define _SUEXEC_H - -/* - * HTTPD_USER -- Define as the username under which Apache normally - * runs. This is the only user allowed to execute - * this program. - */ -#ifndef AP_HTTPD_USER -#define AP_HTTPD_USER "www" -#endif - -/* - * UID_MIN -- Define this as the lowest UID allowed to be a target user - * for suEXEC. For most systems, 500 or 100 is common. - */ -#ifndef AP_UID_MIN -#define AP_UID_MIN 100 -#endif - -/* - * GID_MIN -- Define this as the lowest GID allowed to be a target group - * for suEXEC. For most systems, 100 is common. - */ -#ifndef AP_GID_MIN -#define AP_GID_MIN 100 -#endif - -/* - * USERDIR_SUFFIX -- Define to be the subdirectory under users' - * home directories where suEXEC access should - * be allowed. All executables under this directory - * will be executable by suEXEC as the user so - * they should be "safe" programs. If you are - * using a "simple" UserDir directive (ie. one - * without a "*" in it) this should be set to - * the same value. suEXEC will not work properly - * in cases where the UserDir directive points to - * a location that is not the same as the user's - * home directory as referenced in the passwd file. - * - * If you have VirtualHosts with a different - * UserDir for each, you will need to define them to - * all reside in one parent directory; then name that - * parent directory here. IF THIS IS NOT DEFINED - * PROPERLY, ~USERDIR CGI REQUESTS WILL NOT WORK! - * See the suEXEC documentation for more detailed - * information. - */ -#ifndef AP_USERDIR_SUFFIX -#define AP_USERDIR_SUFFIX "public_html" -#endif - -/* - * LOG_EXEC -- Define this as a filename if you want all suEXEC - * transactions and errors logged for auditing and - * debugging purposes. - */ -#ifndef AP_LOG_EXEC -#define AP_LOG_EXEC "/usr/local/apache/logs/cgi.log" /* Need me? */ -#endif - -/* - * DOC_ROOT -- Define as the DocumentRoot set for Apache. This - * will be the only hierarchy (aside from UserDirs) - * that can be used for suEXEC behavior. - */ -#ifndef AP_DOC_ROOT -#define AP_DOC_ROOT "/usr/local/apache/htdocs" -#endif - -/* - * SAFE_PATH -- Define a safe PATH environment to pass to CGI executables. - * - */ -#ifndef AP_SAFE_PATH -#define AP_SAFE_PATH "/usr/local/bin:/usr/bin:/bin" -#endif - -#endif /* _SUEXEC_H */ |