diff options
author | hongbotian <hongbo.tianhongbo@huawei.com> | 2015-11-30 01:35:09 -0500 |
---|---|---|
committer | hongbotian <hongbo.tianhongbo@huawei.com> | 2015-11-30 01:36:35 -0500 |
commit | cc40af334e619bb549038238507407866f774f8f (patch) | |
tree | 43ddc1974f72997a57173151eafb23e6025a13c9 /rubbos/app/apache2/bin | |
parent | 68e74fd78b2485e5914ce34a5b30f4485029e021 (diff) |
upload apache
JIRA: BOTTLENECK-10
Change-Id: I67eae31de6dc824097dfa56ab454ba36fdd23a2c
Signed-off-by: hongbotian <hongbo.tianhongbo@huawei.com>
Diffstat (limited to 'rubbos/app/apache2/bin')
-rwxr-xr-x | rubbos/app/apache2/bin/ab | bin | 0 -> 104358 bytes | |||
-rwxr-xr-x | rubbos/app/apache2/bin/apachectl | 103 | ||||
-rwxr-xr-x | rubbos/app/apache2/bin/apr-config | 249 | ||||
-rwxr-xr-x | rubbos/app/apache2/bin/apu-config | 205 | ||||
-rwxr-xr-x | rubbos/app/apache2/bin/apxs | 778 | ||||
-rwxr-xr-x | rubbos/app/apache2/bin/checkgid | bin | 0 -> 13697 bytes | |||
-rwxr-xr-x | rubbos/app/apache2/bin/dbmmanage | 312 | ||||
-rw-r--r-- | rubbos/app/apache2/bin/envvars | 24 | ||||
-rw-r--r-- | rubbos/app/apache2/bin/envvars-std | 24 | ||||
-rwxr-xr-x | rubbos/app/apache2/bin/htdbm | bin | 0 -> 44199 bytes | |||
-rwxr-xr-x | rubbos/app/apache2/bin/htdigest | bin | 0 -> 30574 bytes | |||
-rwxr-xr-x | rubbos/app/apache2/bin/htpasswd | bin | 0 -> 38642 bytes | |||
-rwxr-xr-x | rubbos/app/apache2/bin/httpd | bin | 0 -> 2192464 bytes | |||
-rwxr-xr-x | rubbos/app/apache2/bin/httxt2dbm | bin | 0 -> 23394 bytes | |||
-rwxr-xr-x | rubbos/app/apache2/bin/logresolve | bin | 0 -> 29935 bytes | |||
-rwxr-xr-x | rubbos/app/apache2/bin/rotatelogs | bin | 0 -> 26569 bytes |
16 files changed, 1695 insertions, 0 deletions
diff --git a/rubbos/app/apache2/bin/ab b/rubbos/app/apache2/bin/ab Binary files differnew file mode 100755 index 00000000..e5b37b70 --- /dev/null +++ b/rubbos/app/apache2/bin/ab diff --git a/rubbos/app/apache2/bin/apachectl b/rubbos/app/apache2/bin/apachectl new file mode 100755 index 00000000..5eb2fe95 --- /dev/null +++ b/rubbos/app/apache2/bin/apachectl @@ -0,0 +1,103 @@ +#!/bin/sh +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# 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: +# XXX this doc is no longer correct now that the interesting +# XXX functions are handled by httpd +# 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 +# +ARGV="$@" +# +# |||||||||||||||||||| START CONFIGURATION SECTION |||||||||||||||||||| +# -------------------- -------------------- +# +# the path to your httpd binary, including options if necessary +HTTPD='/bottlenecks/rubbos/app/apache2/bin/httpd' +# +# pick up any necessary environment variables +if test -f /bottlenecks/rubbos/app/apache2/bin/envvars; then + . /bottlenecks/rubbos/app/apache2/bin/envvars +fi +# +# 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:80/server-status" +# +# Set this variable to a command that increases the maximum +# number of file descriptors allowed per child process. This is +# critical for configurations that use many file descriptors, +# such as mass vhosting, or a multithreaded server. +ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`" +# -------------------- -------------------- +# |||||||||||||||||||| END CONFIGURATION SECTION |||||||||||||||||||| + +# Set the maximum number of file descriptors allowed per child process. +if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then + $ULIMIT_MAX_FILES +fi + +ERROR=0 +if [ "x$ARGV" = "x" ] ; then + ARGV="-h" +fi + +case $ARGV in +start|stop|restart|graceful) + $HTTPD -k $ARGV + ERROR=$? + ;; +startssl|sslstart|start-SSL) + $HTTPD -k start -DSSL + ERROR=$? + ;; +configtest) + $HTTPD -t + ERROR=$? + ;; +status) + $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } ' + ;; +fullstatus) + $LYNX $STATUSURL + ;; +*) + $HTTPD $ARGV + ERROR=$? +esac + +exit $ERROR + diff --git a/rubbos/app/apache2/bin/apr-config b/rubbos/app/apache2/bin/apr-config new file mode 100755 index 00000000..84f95e73 --- /dev/null +++ b/rubbos/app/apache2/bin/apr-config @@ -0,0 +1,249 @@ +#!/bin/sh +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# APR script designed to allow easy command line access to APR configuration +# parameters. + +APR_MAJOR_VERSION="0" +APR_DOTTED_VERSION="0.9.19" + +prefix="/bottlenecks/rubbos/app/apache2" +exec_prefix="/bottlenecks/rubbos/app/apache2" +bindir="${prefix}/bin" +libdir="${prefix}/lib" +datarootdir="/bottlenecks/rubbos/app/apache2" +datadir="/bottlenecks/rubbos/app/apache2" +installbuilddir="${prefix}/build" +includedir="/bottlenecks/rubbos/app/apache2/include" + +CC="gcc" +CPP="gcc -E" +SHELL="/bin/bash" +CPPFLAGS="-D_REENTRANT -D_GNU_SOURCE" +CFLAGS="-g -O2 -pthread" +LDFLAGS="" +LIBS="-lrt -lm -lcrypt -lnsl -lpthread -ldl" +EXTRA_INCLUDES="" +SHLIBPATH_VAR="LD_LIBRARY_PATH" +APR_SOURCE_DIR="/bottlenecks/rubbos/app/httpd-2.0.64/srclib/apr" +APR_BUILD_DIR="/bottlenecks/rubbos/app/httpd-2.0.64/srclib/apr" +APR_SO_EXT="lo" +APR_LIB_TARGET="-rpath \$(libdir) \$\$objects" +APR_LIBNAME="apr-${APR_MAJOR_VERSION}" + +# NOTE: the following line is modified during 'make install': alter with care! +location=installed + +show_usage() +{ + cat << EOF +Usage: apr-config [OPTION] + +Known values for OPTION are: + --prefix[=DIR] change prefix to DIR + --bindir print location where binaries are installed + --includedir print location where headers are installed + --cc print C compiler name + --cpp print C preprocessor name and any required options + --cflags print C compiler flags + --cppflags print cpp flags + --includes print include information + --ldflags print linker flags + --libs print additional libraries to link against + --srcdir print APR source directory + --installbuilddir print APR build helper directory + --link-ld print link switch(es) for linking to APR + --link-libtool print the libtool inputs for linking to APR + --shlib-path-var print the name of the shared library path env var + --apr-la-file print the path to the .la file, if available + --apr-so-ext print the extensions of shared objects on this platform + --apr-lib-target print the libtool target information + --apr-libtool print the path to APR's libtool + --version print the APR's version as a dotted triple + --help print this help + +When linking with libtool, an application should do something like: + APR_LIBS="\`apr-config --link-libtool --libs\`" +or when linking directly: + APR_LIBS="\`apr-config --link-ld --libs\`" + +An application should use the results of --cflags, --cppflags, --includes, +and --ldflags in their build process. +EOF +} + +if test $# -eq 0; then + show_usage + exit 1 +fi + +if test "$location" = "installed"; then + LA_FILE="$libdir/lib${APR_LIBNAME}.la" +else + LA_FILE="$APR_BUILD_DIR/lib${APR_LIBNAME}.la" +fi + +flags="" + +while test $# -gt 0; do + # Normalize the prefix. + case "$1" in + -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case "$1" in + # It is possible for the user to override our prefix. + --prefix=*) + prefix=$optarg + ;; + --prefix) + echo $prefix + exit 0 + ;; + --bindir) + echo $bindir + exit 0 + ;; + --includedir) + if test "$location" = "installed"; then + flags="$includedir" + elif test "$location" = "source"; then + flags="$APR_SOURCE_DIR/include" + else + # this is for VPATH builds + flags="$APR_BUILD_DIR/include $APR_SOURCE_DIR/include" + fi + echo $flags + exit 0 + ;; + --cc) + echo $CC + exit 0 + ;; + --cpp) + echo $CPP + exit 0 + ;; + --cflags) + flags="$flags $CFLAGS" + ;; + --cppflags) + flags="$flags $CPPFLAGS" + ;; + --libs) + flags="$flags $LIBS" + ;; + --ldflags) + flags="$flags $LDFLAGS" + ;; + --includes) + if test "$location" = "installed"; then + flags="$flags -I$includedir $EXTRA_INCLUDES" + elif test "$location" = "source"; then + flags="$flags -I$APR_SOURCE_DIR/include $EXTRA_INCLUDES" + else + # this is for VPATH builds + flags="$flags -I$APR_BUILD_DIR/include -I$APR_SOURCE_DIR/include $EXTRA_INCLUDES" + fi + ;; + --srcdir) + echo $APR_SOURCE_DIR + exit 0 + ;; + --installbuilddir) + if test "$location" = "installed"; then + echo "${installbuilddir}" + elif test "$location" = "source"; then + echo "$APR_SOURCE_DIR/build" + else + # this is for VPATH builds + echo "$APR_BUILD_DIR/build" + fi + exit 0 + ;; + --version) + echo $APR_DOTTED_VERSION + exit 0 + ;; + --link-ld) + if test "$location" = "installed"; then + ### avoid using -L if libdir is a "standard" location like /usr/lib + flags="$flags -L$libdir -l${APR_LIBNAME}" + else + ### this surely can't work since the library is in .libs? + flags="$flags -L$APR_BUILD_DIR -l${APR_LIBNAME}" + fi + ;; + --link-libtool) + # If the LA_FILE exists where we think it should be, use it. If we're + # installed and the LA_FILE does not exist, assume to use -L/-l + # (the LA_FILE may not have been installed). If we're building ourselves, + # we'll assume that at some point the .la file be created. + if test -f "$LA_FILE"; then + flags="$flags $LA_FILE" + elif test "$location" = "installed"; then + ### avoid using -L if libdir is a "standard" location like /usr/lib + flags="$flags -L$libdir -l${APR_LIBNAME}" + else + flags="$flags $LA_FILE" + fi + ;; + --shlib-path-var) + echo "$SHLIBPATH_VAR" + exit 0 + ;; + --apr-la-file) + if test -f "$LA_FILE"; then + flags="$flags $LA_FILE" + fi + ;; + --apr-so-ext) + echo "$APR_SO_EXT" + exit 0 + ;; + --apr-lib-target) + echo "$APR_LIB_TARGET" + exit 0 + ;; + --apr-libtool) + if test "$location" = "installed"; then + echo "${installbuilddir}/libtool" + else + echo "$APR_BUILD_DIR/libtool" + fi + exit 0 + ;; + --help) + show_usage + exit 0 + ;; + *) + show_usage + exit 1 + ;; + esac + + # Next please. + shift +done + +if test -n "$flags"; then + echo "$flags" +fi + +exit 0 diff --git a/rubbos/app/apache2/bin/apu-config b/rubbos/app/apache2/bin/apu-config new file mode 100755 index 00000000..92633b3a --- /dev/null +++ b/rubbos/app/apache2/bin/apu-config @@ -0,0 +1,205 @@ +#!/bin/sh +# Copyright 2001-2005 The Apache Software Foundation or its licensors, as +# applicable. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# APR-util script designed to allow easy command line access to APR-util +# configuration parameters. + +APRUTIL_MAJOR_VERSION="0" +APRUTIL_DOTTED_VERSION="0.9.19" + +prefix="/bottlenecks/rubbos/app/apache2" +exec_prefix="/bottlenecks/rubbos/app/apache2" +bindir="${prefix}/bin" +libdir="${prefix}/lib" +includedir="/bottlenecks/rubbos/app/apache2/include" + +LIBS="/bottlenecks/rubbos/app/httpd-2.0.64/srclib/apr-util/xml/expat/libexpat.la" +INCLUDES="-I/bottlenecks/rubbos/app/httpd-2.0.64/srclib/apr-util/xml/expat/lib" +LDFLAGS="-L/bottlenecks/rubbos/app/httpd-2.0.64/srclib/apr-util/xml/expat/lib" + +APRUTIL_LIBNAME="aprutil-${APRUTIL_MAJOR_VERSION}" + +APU_SOURCE_DIR="/bottlenecks/rubbos/app/httpd-2.0.64/srclib/apr-util" +APU_BUILD_DIR="/bottlenecks/rubbos/app/httpd-2.0.64/srclib/apr-util" +APR_XML_EXPAT_OLD="" +APU_DB_VERSION="0" + +# NOTE: the following line is modified during 'make install': alter with care! +location=installed + +show_usage() +{ + cat << EOF +Usage: apu-config [OPTION] + +Known values for OPTION are: + --prefix[=DIR] change prefix to DIR + --bindir print location where binaries are installed + --includes print include information + --includedir print location where headers are installed + --ldflags print linker flags + --libs print library information + --srcdir print APR-util source directory + --link-ld print link switch(es) for linking to APR-util + --link-libtool print the libtool inputs for linking to APR-util + --apu-la-file print the path to the .la file, if available + --old-expat indicate if APR-util was built against an old expat + --db-version print the DB version + --version print APR-util's version as a dotted triple + --help print this help + +When linking with libtool, an application should do something like: + APU_LIBS="\`apu-config --link-libtool --libs\`" +or when linking directly: + APU_LIBS="\`apu-config --link-ld --libs\`" + +An application should use the results of --includes, and --ldflags in +their build process. +EOF +} + +if test $# -eq 0; then + show_usage + exit 1 +fi + +if test "$location" = "installed"; then + LA_FILE="$libdir/lib${APRUTIL_LIBNAME}.la" + + LIBS=`echo "$LIBS" | sed -e "s $APU_BUILD_DIR/xml/expat $prefix g" -e "s $prefix/libexpat.la -lexpat g"` + LDFLAGS=`echo "$LDFLAGS" | sed -e "s $APU_BUILD_DIR/xml/expat $prefix g"` + INCLUDES=`echo "$INCLUDES" | sed -e "s $APU_BUILD_DIR/xml/expat $prefix g" -e "s -I$prefix/lib g"` +else + LA_FILE="$APU_BUILD_DIR/lib${APRUTIL_LIBNAME}.la" +fi + +flags="" + +while test $# -gt 0; do + # Normalize the prefix. + case "$1" in + -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case "$1" in + # It is possible for the user to override our prefix. + --prefix=*) + prefix=$optarg + ;; + --prefix) + echo $prefix + exit 0 + ;; + --bindir) + echo $bindir + exit 0 + ;; + --libs) + flags="$flags $LIBS" + ;; + --includedir) + if test "$location" = "installed"; then + flags="$includedir" + elif test "$location" = "source"; then + flags="$APU_SOURCE_DIR/include" + else + # this is for VPATH builds + flags="$APU_BUILD_DIR/include $APU_SOURCE_DIR/include" + fi + echo $flags + exit 0 + ;; + --includes) + if test "$location" = "installed"; then + flags="$flags -I$includedir $INCLUDES" + elif test "$location" = "source"; then + flags="$flags -I$APU_SOURCE_DIR/include $INCLUDES" + else + # this is for VPATH builds + flags="$flags -I$APU_BUILD_DIR/include -I$APU_SOURCE_DIR/include $INCLUDES" + fi + ;; + --ldflags) + flags="$flags $LDFLAGS" + ;; + --srcdir) + echo $APU_SOURCE_DIR + exit 0 + ;; + --version) + echo $APRUTIL_DOTTED_VERSION + exit 0 + ;; + --link-ld) + if test "$location" = "installed"; then + ### avoid using -L if libdir is a "standard" location like /usr/lib + flags="$flags -L$libdir -l$APRUTIL_LIBNAME" + else + flags="$flags -L$APU_BUILD_DIR -l$APRUTIL_LIBNAME" + fi + ;; + --link-libtool) + # If the LA_FILE exists where we think it should be, use it. If we're + # installed and the LA_FILE does not exist, assume to use -L/-l + # (the LA_FILE may not have been installed). If we're building ourselves, + # we'll assume that at some point the .la file be created. + if test -f "$LA_FILE"; then + flags="$flags $LA_FILE" + elif test "$location" = "installed"; then + ### avoid using -L if libdir is a "standard" location like /usr/lib + flags="$flags -L$libdir -l$APRUTIL_LIBNAME" + else + flags="$flags $LA_FILE" + fi + ;; + --apu-la-file) + if test -f "$LA_FILE"; then + flags="$flags $LA_FILE" + fi + ;; + --old-expat) + if test ! -n "$APR_XML_EXPAT_OLD"; then + echo "no" + else + echo "$APR_XML_EXPAT_OLD" + fi + exit 0 + ;; + --db-version) + echo $APU_DB_VERSION + exit 0 + ;; + --help) + show_usage + exit 0 + ;; + *) + show_usage + exit 1 + ;; + esac + + # Next please. + shift +done + +if test -n "$flags"; then + echo "$flags" +fi + +exit 0 diff --git a/rubbos/app/apache2/bin/apxs b/rubbos/app/apache2/bin/apxs new file mode 100755 index 00000000..4b3b702d --- /dev/null +++ b/rubbos/app/apache2/bin/apxs @@ -0,0 +1,778 @@ +#!/usr/bin/perl -w +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +require 5.003; +use strict; +package apxs; + +## +## Configuration +## + +my %config_vars = (); + +my $installbuilddir = "/bottlenecks/rubbos/app/apache2/build"; +get_config_vars("$installbuilddir/config_vars.mk",\%config_vars); + +# read the configuration variables once + +my $prefix = get_vars("prefix"); +my $CFG_PREFIX = $prefix; +my $exec_prefix = get_vars("exec_prefix"); +my $datadir = get_vars("datadir"); +my $localstatedir = get_vars("localstatedir"); +my $CFG_TARGET = get_vars("progname"); +my $CFG_SYSCONFDIR = get_vars("sysconfdir"); +my $CFG_CFLAGS = join ' ', map { get_vars($_) } + qw(SHLTCFLAGS CFLAGS NOTEST_CPPFLAGS EXTRA_CPPFLAGS EXTRA_CFLAGS); +my $includedir = get_vars("includedir"); +my $CFG_INCLUDEDIR = eval qq("$includedir"); +my $CFG_CC = get_vars("CC"); +my $libexecdir = get_vars("libexecdir"); +my $CFG_LIBEXECDIR = eval qq("$libexecdir"); +my $sbindir = get_vars("sbindir"); +my $CFG_SBINDIR = eval qq("$sbindir"); +my $ltflags = $ENV{'LTFLAGS'}; +$ltflags or $ltflags = "--silent"; + +my %internal_vars = map {$_ => 1} + qw(TARGET CC CFLAGS CFLAGS_SHLIB LD_SHLIB LDFLAGS_SHLIB LIBS_SHLIB + PREFIX SBINDIR INCLUDEDIR LIBEXECDIR SYSCONFDIR); + +## +## 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; +my $opt_h = 0; +my $opt_p = 0; + +# this subroutine is derived from Perl's getopts.pl with the enhancement of +# the "+" metacharacter at the format string to allow a list to be built by +# subsequent occurrences of the same option. +sub Getopts { + my ($argumentative, @ARGV) = @_; + my $errs = 0; + local $_; + local $[ = 0; + + my @args = split / */, $argumentative; + while (@ARGV && ($_ = $ARGV[0]) =~ /^-(.)(.*)/) { + my ($first, $rest) = ($1,$2); + if ($_ =~ m|^--$|) { + shift @ARGV; + last; + } + my $pos = index($argumentative,$first); + if ($pos >= $[) { + if ($pos < $#args && $args[$pos+1] eq ':') { + shift @ARGV; + if ($rest eq '') { + unless (@ARGV) { + error("Incomplete option: $first (needs an argument)"); + $errs++; + } + $rest = shift(@ARGV); + } + eval "\$opt_$first = \$rest;"; + } + elsif ($pos < $#args && $args[$pos+1] eq '+') { + shift @ARGV; + if ($rest eq '') { + unless (@ARGV) { + error("Incomplete option: $first (needs an argument)"); + $errs++; + } + $rest = shift(@ARGV); + } + eval "push(\@opt_$first, \$rest);"; + } + else { + eval "\$opt_$first = 1"; + if ($rest eq '') { + shift(@ARGV); + } + else { + $ARGV[0] = "-$rest"; + } + } + } + else { + error("Unknown option: $first"); + $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>] [-p] <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+eiaAp", @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 = get_vars("sbindir") . "/" . get_vars("progname"); +$httpd = eval qq("$httpd"); +$httpd = eval qq("$httpd"); +my $envvars = get_vars("sbindir") . "/envvars"; +$envvars = eval qq("$envvars"); +$envvars = eval qq("$envvars"); + +#allow apxs to be run from the source tree, before installation +if ($0 =~ m:support/apxs$:) { + ($httpd = $0) =~ s:support/apxs$::; +} + +unless (-x "$httpd") { + error("$httpd not found or not executable"); + exit 1; +} + +unless (grep /mod_so/, `. $envvars && $httpd -l`) { + error("Sorry, no shared object support for Apache"); + error("available under your platform. Make sure"); + error("the Apache module mod_so is compiled into"); + error("your server binary `$httpd'."); + exit 1; +} + +sub get_config_vars{ + my ($file, $rh_config) = @_; + + open IN, $file or die "cannot open $file: $!"; + while (<IN>){ + if (/^\s*(.*?)\s*=\s*(.*)$/){ + $rh_config->{$1} = $2; + } + } + close IN; +} + +sub get_vars { + my $result = ''; + my $ok = 0; + my $arg; + foreach $arg (@_) { + if (exists $config_vars{$arg} or exists $config_vars{lc $arg}) { + my $val = exists $config_vars{$arg} + ? $config_vars{$arg} + : $config_vars{lc $arg}; + $val =~ s/[()]//g; + $result .= eval "qq($val)" if defined $val; + $result .= ";;"; + $ok = 1; + } + if (not $ok) { + if (exists $internal_vars{$arg} or exists $internal_vars{lc $arg}) { + my $val = exists $internal_vars{$arg} ? $arg : lc $arg; + $val = eval "\$CFG_$val"; + $result .= eval "qq($val)" if defined $val; + $result .= ";;"; + $ok = 1; + } + if (not $ok) { + error("Invalid query string `$arg'"); + exit(1); + } + } + } + $result =~ s|;;$||; + $result =~ s|:| |; + return $result; +} + +## +## 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) { + notice($cmd); + $rc = system $cmd; + if ($rc) { + error(sprintf "Command failed with rc=%d\n", $rc << 8); + exit 1 ; + } + } +} + +if ($opt_g) { + ## + ## SAMPLE MODULE SOURCE GENERATION + ## + + if (-d $name) { + error("Directory `$name' already exists. Remove first"); + exit(1); + } + + my $data = join('', <DATA>); + $data =~ s|%NAME%|$name|sg; + $data =~ s|%TARGET%|$CFG_TARGET|sg; + $data =~ s|%PREFIX%|$prefix|sg; + $data =~ s|%INSTALLBUILDDIR%|$installbuilddir|sg; + + my ($mkf, $mods, $src) = ($data =~ m|^(.+)-=#=-\n(.+)-=#=-\n(.+)|s); + + notice("Creating [DIR] $name"); + system("mkdir $name"); + notice("Creating [FILE] $name/Makefile"); + open(FP, ">${name}/Makefile") || die; + print FP $mkf; + close(FP); + notice("Creating [FILE] $name/modules.mk"); + open(FP, ">${name}/modules.mk") || die; + print FP $mods; + close(FP); + notice("Creating [FILE] $name/mod_$name.c"); + open(FP, ">${name}/mod_${name}.c") || die; + print FP $src; + close(FP); + notice("Creating [FILE] $name/.deps"); + system("touch ${name}/.deps"); + + exit(0); +} + + +if ($opt_q) { + ## + ## QUERY INFORMATION + ## + my $result = get_vars(@args); + print "$result\n"; +} + +my $apr_bindir = get_vars("APR_BINDIR"); + +if (! -x "$apr_bindir/apr-config") { + error("$apr_bindir/apr-config not found!"); + exit(1); +} + +my $apu_bindir = get_vars("APU_BINDIR"); + +if (! -x "$apu_bindir/apu-config") { + error("$apu_bindir/apu-config not found!"); + exit(1); +} + +my $libtool = `$apr_bindir/apr-config --installbuilddir`; +chomp($libtool); +$libtool = "$libtool/libtool"; + +my $apr_includedir = `$apr_bindir/apr-config --includes`; +chomp($apr_includedir); +my $apu_includedir = `$apu_bindir/apu-config --includes`; +chomp($apu_includedir); + +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.la"; + } + } + else { + $dso_file = $opt_o; + $dso_file =~ s|\.[^.]+$|.la|; + } + + # 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 $ltflags --mode=compile $CFG_CC $cflags -I$CFG_INCLUDEDIR $apr_includedir $apu_includedir $opt -c -o $lo $s && touch $slo"); + unshift(@objs, $lo); + } + + # create link command + my $o; + my $lo; + foreach $o (@objs) { + $lo .= " $o"; + } + my ($opt_Wl, $opt_L, $opt_l); + $opt = ''; + foreach $opt_Wl (@opt_W) { + $opt .= "$1 " if ($opt_Wl =~ m|^\s*l,(.*)$|); + } + foreach $opt_L (@opt_L) { + $opt .= " -L$opt_L"; + } + foreach $opt_l (@opt_l) { + $opt .= " -l$opt_l"; + } + + if ($opt_p == 1) { + + my $apr_libs=`$apr_bindir/apr-config --ldflags --link-libtool --libs`; + chomp($apr_libs); + my $apu_libs=`$apu_bindir/apu-config --ldflags --link-libtool --libs`; + chomp($apu_libs); + + $opt .= " ".$apu_libs." ".$apr_libs; + } + else { + my $apr_ldflags=`$apr_bindir/apr-config --ldflags`; + chomp($apr_ldflags); + $opt .= " -rpath $CFG_LIBEXECDIR -module -avoid-version $apr_ldflags"; + } + + push(@cmds, "$libtool $ltflags --mode=link $CFG_CC -o $dso_file $opt $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$)#) { + error("file $f is not a shared object"); + exit(1); + } + my $t = $f; + $t =~ s|^.+/([^/]+)$|$1|; + $t =~ s|\.la$|\.so|; + if ($opt_i) { + push(@cmds, "$installbuilddir/instdso.sh SH_LIBTOOL='" . + "$libtool' $f $CFG_LIBEXECDIR"); + 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 '') { + error("Sorry, cannot determine bootstrap symbol name"); + error("Please specify one with option `-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") { + error("Config file $CFG_SYSCONFDIR/$CFG_TARGET.conf not found"); + exit(1); + } + + open(FP, "<$CFG_SYSCONFDIR/$CFG_TARGET.conf") || die; + my $content = join('', <FP>); + close(FP); + + if ($content !~ m|\n#?\s*LoadModule\s+|) { + error("Activation failed for custom $CFG_SYSCONFDIR/$CFG_TARGET.conf file."); + error("At least one `LoadModule' directive already has to exist."); + exit(1); + } + + my $lmd; + my $c = ''; + $c = '#' if ($opt_A); + foreach $lmd (@lmd) { + my $what = $opt_A ? "preparing" : "activating"; + my $lmd_re = $lmd; + $lmd_re =~ s/\s+/\\s+/g; + + if ($content !~ m|\n#?\s*$lmd_re|) { + # check for open <containers>, so that the new LoadModule + # directive always appears *outside* of an <container>. + + my $before = ($content =~ m|^(.*\n)#?\s*LoadModule\s+[^\n]+\n|s)[0]; + + # the '()=' trick forces list context and the scalar + # assignment counts the number of list members (aka number + # of matches) then + my $cntopen = () = ($before =~ m|^\s*<[^/].*$|mg); + my $cntclose = () = ($before =~ m|^\s*</.*$|mg); + + if ($cntopen == $cntclose) { + # fine. Last LoadModule is contextless. + $content =~ s|^(.*\n#?\s*LoadModule\s+[^\n]+\n)|$1$c$lmd\n|s; + } + elsif ($cntopen < $cntclose) { + error('Configuration file is not valid. There are sections' + . ' closed before opened.'); + exit(1); + } + else { + # put our cmd after the section containing the last + # LoadModule. + my $found = + $content =~ s!\A ( # string and capture start + (?:(?: + ^\s* # start of conf line with a + (?:[^<]|<[^/]) # directive which does not + # start with '</' + + .*(?:$)\n # rest of the line. + # the '$' is in parentheses + # to avoid misinterpreting + # the string "$\" as + # perl variable. + + )* # catch as much as possible + # of such lines. (including + # zero) + + ^\s*</.*(?:$)\n? # after the above, we + # expect a config line with + # a closing container (</) + + ) {$cntopen} # the whole pattern (bunch + # of lines that end up with + # a closing directive) must + # be repeated $cntopen + # times. That's it. + # Simple, eh? ;-) + + ) # capture end + !$1$c$lmd\n!mx; + + unless ($found) { + error('Configuration file is not valid. There are ' + . 'sections opened and not closed.'); + exit(1); + } + } + } else { + # replace already existing LoadModule line + $content =~ s|^(.*\n)#?\s*$lmd_re[^\n]*\n|$1$c$lmd\n|s; + } + $lmd =~ m|LoadModule\s+(.+?)_module.*|; + notice("[$what module `$1' in $CFG_SYSCONFDIR/$CFG_TARGET.conf]"); + } + 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 { + notice("unable to open configuration file"); + } + } + } +} + +sub error{ + print STDERR "apxs:Error: $_[0].\n"; +} + +sub notice{ + print STDERR "$_[0]\n"; +} + +##EOF## +__DATA__ +## +## Makefile -- Build procedure for sample %NAME% Apache module +## Autogenerated via ``apxs -n %NAME% -g''. +## + +builddir=. +top_srcdir=%PREFIX% +top_builddir=%PREFIX% +include %INSTALLBUILDDIR%/special.mk + +# the used tools +APXS=apxs +APACHECTL=apachectl + +# additional defines, includes and libraries +#DEFS=-Dmy_define=my_value +#INCLUDES=-Imy/include/dir +#LIBS=-Lmy/lib/dir -lmylib + +# the default target +all: local-shared-build + +# install the shared object file into Apache +install: install-modules + +# 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%.la: mod_%NAME%.slo + $(SH_LINK) -rpath $(libexecdir) -module -avoid-version mod_%NAME%.lo +DISTCLEAN_TARGETS = modules.mk +shared = mod_%NAME%.la +-=#=- +/* +** 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"; + + 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/rubbos/app/apache2/bin/checkgid b/rubbos/app/apache2/bin/checkgid Binary files differnew file mode 100755 index 00000000..7c0f5e49 --- /dev/null +++ b/rubbos/app/apache2/bin/checkgid diff --git a/rubbos/app/apache2/bin/dbmmanage b/rubbos/app/apache2/bin/dbmmanage new file mode 100755 index 00000000..436e824f --- /dev/null +++ b/rubbos/app/apache2/bin/dbmmanage @@ -0,0 +1,312 @@ +#!/usr/bin/perl +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#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/rubbos/app/apache2/bin/envvars b/rubbos/app/apache2/bin/envvars new file mode 100644 index 00000000..771c6c59 --- /dev/null +++ b/rubbos/app/apache2/bin/envvars @@ -0,0 +1,24 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# envvars-std - default environment variables for apachectl +# +# This file is generated from envvars-std.in +# +LD_LIBRARY_PATH="/bottlenecks/rubbos/app/apache2/lib:$LD_LIBRARY_PATH" +export LD_LIBRARY_PATH +# + diff --git a/rubbos/app/apache2/bin/envvars-std b/rubbos/app/apache2/bin/envvars-std new file mode 100644 index 00000000..771c6c59 --- /dev/null +++ b/rubbos/app/apache2/bin/envvars-std @@ -0,0 +1,24 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# envvars-std - default environment variables for apachectl +# +# This file is generated from envvars-std.in +# +LD_LIBRARY_PATH="/bottlenecks/rubbos/app/apache2/lib:$LD_LIBRARY_PATH" +export LD_LIBRARY_PATH +# + diff --git a/rubbos/app/apache2/bin/htdbm b/rubbos/app/apache2/bin/htdbm Binary files differnew file mode 100755 index 00000000..815389da --- /dev/null +++ b/rubbos/app/apache2/bin/htdbm diff --git a/rubbos/app/apache2/bin/htdigest b/rubbos/app/apache2/bin/htdigest Binary files differnew file mode 100755 index 00000000..25b27d18 --- /dev/null +++ b/rubbos/app/apache2/bin/htdigest diff --git a/rubbos/app/apache2/bin/htpasswd b/rubbos/app/apache2/bin/htpasswd Binary files differnew file mode 100755 index 00000000..48ca8792 --- /dev/null +++ b/rubbos/app/apache2/bin/htpasswd diff --git a/rubbos/app/apache2/bin/httpd b/rubbos/app/apache2/bin/httpd Binary files differnew file mode 100755 index 00000000..94f33200 --- /dev/null +++ b/rubbos/app/apache2/bin/httpd diff --git a/rubbos/app/apache2/bin/httxt2dbm b/rubbos/app/apache2/bin/httxt2dbm Binary files differnew file mode 100755 index 00000000..b8a48382 --- /dev/null +++ b/rubbos/app/apache2/bin/httxt2dbm diff --git a/rubbos/app/apache2/bin/logresolve b/rubbos/app/apache2/bin/logresolve Binary files differnew file mode 100755 index 00000000..e658dc23 --- /dev/null +++ b/rubbos/app/apache2/bin/logresolve diff --git a/rubbos/app/apache2/bin/rotatelogs b/rubbos/app/apache2/bin/rotatelogs Binary files differnew file mode 100755 index 00000000..9775a25e --- /dev/null +++ b/rubbos/app/apache2/bin/rotatelogs |