From ae174faf36dbe28b24069bafe5836b6271c87e12 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 31 Jan 2007 05:11:19 +0000 Subject: r21069: Try to split up the mktestsetup.sh script into parts to deal with each LDAP implementation, and another to hold the key blobs. Also fix the OpenLDAP test. Andrew Bartlett (This used to be commit ec511c592bbb7df513fe6f62e06e1fa984431550) --- source4/script/tests/mk-fedora-ds.sh | 73 +++++++ source4/script/tests/mk-keyblobs.sh | 155 +++++++++++++++ source4/script/tests/mk-openldap.sh | 122 ++++++++++++ source4/script/tests/mktestsetup.sh | 341 +-------------------------------- source4/script/tests/test_functions.sh | 2 +- 5 files changed, 356 insertions(+), 337 deletions(-) create mode 100644 source4/script/tests/mk-fedora-ds.sh create mode 100644 source4/script/tests/mk-keyblobs.sh create mode 100644 source4/script/tests/mk-openldap.sh diff --git a/source4/script/tests/mk-fedora-ds.sh b/source4/script/tests/mk-fedora-ds.sh new file mode 100644 index 0000000000..b10d46881c --- /dev/null +++ b/source4/script/tests/mk-fedora-ds.sh @@ -0,0 +1,73 @@ +FEDORA_DS_INF=$LDAPDIR/fedorads.inf +export FEDORA_DS_INF +FEDORA_DS_INITIAL_LDIF=$LDAPDIR/fedorads-initial-ldif.inf +FEDORA_DS_LDAP_PORT=3389 + +LDAP_URI="ldap://127.0.0.1:$FEDORA_DS_LDAP_PORT" + +$srcdir/bin/ad2oLschema $CONFIGURATION -H $PRIVATEDIR/sam.ldb --option=convert:target=fedora-ds -I $srcdir/setup/schema-map-fedora-ds-1.0 -O $LDAPDIR/99_ad.ldif >&2 + +cat >$FEDORA_DS_INF <$FEDORA_DS_INITIAL_LDIF<$DHFILE<$KEYFILE<$ADMINKEYFILE<$CAFILE<$CERTFILE<$KDCCERTFILE<$ADMINCERTFILE<$SLAPD_CONF < $LDAPDIR/db/DB_CONFIG <&2 + +#Now create an LDAP baseDN +$srcdir/bin/smbscript $srcdir/setup/provision $PROVISION_OPTIONS --ldap-base >&2 + +OLDPATH=$PATH +PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH +export PATH + +MODCONF=$LDAPDIR/modules.conf +rm -f $MODCONF +touch $MODCONF + +slaptest -u -f $SLAPD_CONF >&2 || { + echo "enabling slapd modules" >&2 + cat > $MODCONF </dev/null || { + echo "slapadd failed" >&2 + } + + slaptest -f $SLAPD_CONF >/dev/null || { + echo "slaptest after database load failed" >&2 + } +fi + +PATH=$OLDPATH +export PATH + diff --git a/source4/script/tests/mktestsetup.sh b/source4/script/tests/mktestsetup.sh index 7dd35672dc..2e6c6537a2 100755 --- a/source4/script/tests/mktestsetup.sh +++ b/source4/script/tests/mktestsetup.sh @@ -74,14 +74,9 @@ ADMINCERTFILE=$TLSDIR/admincert.pem WINBINDD_SOCKET_DIR=$PREFIX_ABS/winbind_socket CONFIGURATION="--configfile=$CONFFILE" LDAPDIR=$PREFIX_ABS/ldap -SLAPD_CONF=$LDAPDIR/slapd.conf -FEDORA_DS_INF=$LDAPDIR/fedorads.inf -FEDORA_DS_INITIAL_LDIF=$LDAPDIR/fedorads-initial-ldif.inf -FEDORA_DS_LDAP_PORT=3389 export CONFIGURATION export CONFFILE -export SLAPD_CONF export PIDDIR export AUTH export SERVER @@ -158,7 +153,7 @@ cat >$CONFFILE<$PRIVATEDIR/share.ldif<$KRB5_CONFIG<$DHFILE<$KEYFILE<$ADMINKEYFILE<$CAFILE<$CERTFILE<$KDCCERTFILE<$ADMINCERTFILE<$SLAPD_CONF < $LDAPDIR/db/DB_CONFIG <$FEDORA_DS_INF <$FEDORA_DS_INITIAL_LDIF<&2 -if test -z "$FEDORA_DS_PREFIX"; then - LDAP_URI="ldapi://$LDAPDIR/ldapi" - LDAP_URI_ESCAPE="ldapi://"`echo $LDAPDIR/ldapi | sed 's|/|%2F|g'` -export LDAPI -export LDAPI_ESCAPE -else - LDAP_URI=$FEDORA_DS_LDAP_URI; - LDAP_URI_ESCAPE=$FEDORA_DS_LDAP_URI; - PROVISION_OPTIONS="$PROVISION_OPTIONS --ldap-module=nsuniqueid" - #it is easier to base64 encode this than correctly escape it: - # (targetattr = "*") (version 3.0;acl "full access to all by all";allow (all)(userdn = "ldap:///anyone");) - PROVISION_ACI="--aci=aci:: KHRhcmdldGF0dHIgPSAiKiIpICh2ZXJzaW9uIDMuMDthY2wgImZ1bGwgYWNjZXNzIHRvIGFsbCBieSBhbGwiO2FsbG93IChhbGwpKHVzZXJkbiA9ICJsZGFwOi8vL2FueW9uZSIpOykK" -fi - - -#This uses the provision we just did, to read out the schema -$srcdir/bin/ad2oLschema $CONFIGURATION -H $PRIVATEDIR/sam.ldb -I $srcdir/setup/schema-map-openldap-2.3 -O $LDAPDIR/ad.schema >&2 -$srcdir/bin/ad2oLschema $CONFIGURATION -H $PRIVATEDIR/sam.ldb --option=convert:target=fedora-ds -I $srcdir/setup/schema-map-fedora-ds-1.0 -O $LDAPDIR/99_ad.ldif >&2 - -#Now create an LDAP baseDN -$srcdir/bin/smbscript $srcdir/setup/provision $PROVISION_OPTIONS "$PROVISION_ACI" --ldap-base >&2 - -OLDPATH=$PATH -PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH -export PATH +. `dirname $0`/mk-openldap.sh -MODCONF=$LDAPDIR/modules.conf -rm -f $MODCONF -touch $MODCONF - -slaptest -u -f $SLAPD_CONF >&2 || { - echo "enabling slapd modules" >&2 - cat > $MODCONF </dev/null || { - echo "slapadd failed" >&2 - } - - slaptest -f $SLAPD_CONF >/dev/null || { - echo "slaptest after database load failed" >&2 - } -fi - -PATH=$OLDPATH -export PATH - cat >$PRIVATEDIR/wins_config.ldif<