summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrcritten <>2005-05-25 21:01:13 +0000
committerrcritten <>2005-05-25 21:01:13 +0000
commitb2aee9265a8f8b98a2e3a24a269c2b4b97882d08 (patch)
treec93c5bf799d3bf1c7a9f144e0b8cfc7cf5a024eb
parentd4ead13624e36b4f622b3f4c5e540427976dac4f (diff)
Generate gencert so we can set the NSS and NSPR directories and make
things easier for the user. Also try really, really hard to get the FQDN so we can create a host-specific self-signed certificate.
-rw-r--r--Makefile.in10
-rwxr-xr-xconfigure13
-rw-r--r--configure.in9
-rwxr-xr-xgencert.in (renamed from gencert)45
4 files changed, 66 insertions, 11 deletions
diff --git a/Makefile.in b/Makefile.in
index 5e5429f..1166181 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -83,8 +83,10 @@ apache_conf = @apache_conf@
apache_inc = @apache_inc@
apache_prefix = @apache_prefix@
apr_inc = @apr_inc@
+nspr_dir = @nspr_dir@
nspr_inc = @nspr_inc@
nspr_lib = @nspr_lib@
+nss_dir = @nss_dir@
nss_inc = @nss_inc@
nss_lib = @nss_lib@
@@ -109,7 +111,7 @@ LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_CLEAN_FILES = nss.conf
+CONFIG_CLEAN_FILES = nss.conf gencert
LTLIBRARIES = $(lib_LTLIBRARIES)
@@ -136,8 +138,8 @@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CF
CCLD = $(CC)
DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
Makefile.in NEWS TODO aclocal.m4 config.guess config.sub configure \
-configure.in install-sh ltmain.sh missing mkinstalldirs nss.conf.in \
-ssl_expr_parse.c ssl_expr_scan.c
+configure.in gencert.in install-sh ltmain.sh missing mkinstalldirs \
+nss.conf.in ssl_expr_parse.c ssl_expr_scan.c
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
@@ -172,6 +174,8 @@ $(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCI
cd $(srcdir) && $(AUTOCONF)
nss.conf: $(top_builddir)/config.status nss.conf.in
cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
+gencert: $(top_builddir)/config.status gencert.in
+ cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-libLTLIBRARIES:
diff --git a/configure b/configure
index e62a9bc..18d9515 100755
--- a/configure
+++ b/configure
@@ -5782,6 +5782,9 @@ fi
fi
fi
+nspr_dir=`echo "$nspr_lib" | sed 's/\/lib[/]*$//' | sed 's/-L//'`
+nss_dir=`echo "$nss_lib" | sed 's/\/lib[/]*$//' | sed 's/-L//'`
+
# Substitute values
@@ -5794,6 +5797,8 @@ fi
+
+
# Write config.status and the Makefile
trap '' 1 2 15
cat > confcache <<\EOF
@@ -5908,7 +5913,7 @@ done
ac_given_srcdir=$srcdir
ac_given_INSTALL="$INSTALL"
-trap 'rm -fr `echo "Makefile nss.conf" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+trap 'rm -fr `echo "Makefile nss.conf gencert" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
@@ -5986,6 +5991,8 @@ s%@nspr_inc@%$nspr_inc%g
s%@nspr_lib@%$nspr_lib%g
s%@nss_inc@%$nss_inc%g
s%@nss_lib@%$nss_lib%g
+s%@nspr_dir@%$nspr_dir%g
+s%@nss_dir@%$nss_dir%g
CEOF
EOF
@@ -6027,7 +6034,7 @@ EOF
cat >> $CONFIG_STATUS <<EOF
-CONFIG_FILES=\${CONFIG_FILES-"Makefile nss.conf"}
+CONFIG_FILES=\${CONFIG_FILES-"Makefile nss.conf gencert"}
EOF
cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
@@ -6098,3 +6105,5 @@ chmod +x $CONFIG_STATUS
rm -fr confdefs* $ac_clean_files
test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
+chmod +x gencert
diff --git a/configure.in b/configure.in
index 9abb916..bd7e8e5 100644
--- a/configure.in
+++ b/configure.in
@@ -161,6 +161,9 @@ if test -z "$NSSDIR"; then
fi
fi
+nspr_dir=`echo "$nspr_lib" | sed 's/\/lib[[/]]*$//' | sed 's/-L//'`
+nss_dir=`echo "$nss_lib" | sed 's/\/lib[[/]]*$//' | sed 's/-L//'`
+
# Substitute values
AC_SUBST(APXS)
AC_SUBST(apr_inc)
@@ -172,6 +175,10 @@ AC_SUBST(nspr_inc)
AC_SUBST(nspr_lib)
AC_SUBST(nss_inc)
AC_SUBST(nss_lib)
+AC_SUBST(nspr_dir)
+AC_SUBST(nss_dir)
# Write config.status and the Makefile
-AC_OUTPUT(Makefile nss.conf)
+AC_OUTPUT(Makefile nss.conf gencert)
+
+chmod +x gencert
diff --git a/gencert b/gencert.in
index d9a3582..3134d6b 100755
--- a/gencert
+++ b/gencert.in
@@ -1,13 +1,28 @@
#!/bin/ksh
+# Copyright 2001-2004 The Apache Software Foundation
+#
+# 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.
+#
+
# $Header$
#
# gencert - generate new CA, server and user certificates for NSS testing.
#
# Note that this script requires the Korn shell.
-NSSDIR=/path/to/NSS_3_9_RTM/
-NSPRDIR=/path/to/nspr4.4.1/
+NSSDIR=@nss_dir@
+NSPRDIR=@nspr_dir@
export LD_LIBRARY_PATH=$NSPRDIR/lib:$NSSDIR/lib
CERTUTIL=$NSSDIR/bin/certutil
@@ -17,9 +32,29 @@ CERTUTIL=$NSSDIR/bin/certutil
# the server is the same as your domain. Otherwise you will get an error message
# like -12776 (requested domain name does not match the server's certificate).
-CA_CERTDN="CN=Certificate Shack, O=TestCentral, C=US"
-SERVER_CERTDN="CN=www.testcentral.com, O=TestCentral, C=US"
-ALPHA_CERTDN="E=alpha@testcentral.com, CN=Frank Alpha, UID=alpha, OU=People, O=TestCentral, C=US"
+getFQDN() {
+ max=0
+ maxhost=
+ defhost=`hostname`
+ hosthost=`host $defhost | grep -v "not found" | awk '{print $1}'`
+ for host in $defhost $hosthost `hostname -f` `hostname -a` ; do
+ len=`echo $host | wc -c`
+ if [ $len -gt $max ]; then
+ max=$len
+ maxhost=$host
+ fi
+ done
+ echo $maxhost
+}
+
+FQDN=`getFQDN`
+if [ "x${FQDN}" = "x" ]; then
+ FQDN=localhost.localdomain
+fi
+
+CA_CERTDN="CN=Certificate Shack, O=example.com, C=US"
+SERVER_CERTDN="CN=${FQDN}, O=example.com, C=US"
+ALPHA_CERTDN="E=alpha@${FQDN}, CN=Frank Alpha, UID=alpha, OU=People, O=example.com, C=US"
# size of the keys - this needs to be 512 for export servers
KEYSIZE=1024