Blame SOURCES/openldap-cbinding-Convert-test077-to-LDIF-config.patch

4404fd
From 59bdc8158f51fc22cc3c6d6dd2db9e5aa4bcfdc4 Mon Sep 17 00:00:00 2001
4404fd
From: Ryan Tandy <ryan@nardis.ca>
4404fd
Date: Mon, 27 Apr 2020 23:24:16 -0700
4404fd
Subject: [PATCH] Convert test077 to LDIF config
4404fd
4404fd
---
4404fd
 tests/data/slapd-sasl-gssapi.conf | 68 -------------------------------
4404fd
 tests/scripts/defines.sh          |  1 -
4404fd
 tests/scripts/test077-sasl-gssapi | 35 +++++++++++++---
4404fd
 3 files changed, 30 insertions(+), 74 deletions(-)
4404fd
 delete mode 100644 tests/data/slapd-sasl-gssapi.conf
4404fd
4404fd
diff --git a/tests/data/slapd-sasl-gssapi.conf b/tests/data/slapd-sasl-gssapi.conf
4404fd
deleted file mode 100644
4404fd
index 29ab6040b..000000000
4404fd
--- a/tests/data/slapd-sasl-gssapi.conf
4404fd
+++ /dev/null
4404fd
@@ -1,68 +0,0 @@
4404fd
-# stand-alone slapd config -- for testing (with indexing)
4404fd
-# $OpenLDAP$
4404fd
-## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4404fd
-##
4404fd
-## Copyright 1998-2020 The OpenLDAP Foundation.
4404fd
-## All rights reserved.
4404fd
-##
4404fd
-## Redistribution and use in source and binary forms, with or without
4404fd
-## modification, are permitted only as authorized by the OpenLDAP
4404fd
-## Public License.
4404fd
-##
4404fd
-## A copy of this license is available in the file LICENSE in the
4404fd
-## top-level directory of the distribution or, alternatively, at
4404fd
-## <http://www.OpenLDAP.org/license.html>.
4404fd
-
4404fd
-#
4404fd
-include		@SCHEMADIR@/core.schema
4404fd
-include		@SCHEMADIR@/cosine.schema
4404fd
-#
4404fd
-include		@SCHEMADIR@/corba.schema
4404fd
-include		@SCHEMADIR@/java.schema
4404fd
-include		@SCHEMADIR@/inetorgperson.schema
4404fd
-include		@SCHEMADIR@/misc.schema
4404fd
-include		@SCHEMADIR@/nis.schema
4404fd
-include		@SCHEMADIR@/openldap.schema
4404fd
-#
4404fd
-include		@SCHEMADIR@/duaconf.schema
4404fd
-include		@SCHEMADIR@/dyngroup.schema
4404fd
-
4404fd
-#
4404fd
-pidfile		@TESTDIR@/slapd.1.pid
4404fd
-argsfile	@TESTDIR@/slapd.1.args
4404fd
-
4404fd
-# SSL configuration
4404fd
-TLSCACertificateFile @TESTDIR@/tls/ca/certs/testsuiteCA.crt
4404fd
-TLSCertificateKeyFile @TESTDIR@/tls/private/localhost.key
4404fd
-TLSCertificateFile @TESTDIR@/tls/certs/localhost.crt
4404fd
-
4404fd
-#
4404fd
-rootdse 	@DATADIR@/rootdse.ldif
4404fd
-
4404fd
-#mod#modulepath	../servers/slapd/back-@BACKEND@/
4404fd
-#mod#moduleload	back_@BACKEND@.la
4404fd
-#monitormod#modulepath ../servers/slapd/back-monitor/
4404fd
-#monitormod#moduleload back_monitor.la
4404fd
-
4404fd
-
4404fd
-#######################################################################
4404fd
-# database definitions
4404fd
-#######################################################################
4404fd
-
4404fd
-database	@BACKEND@
4404fd
-suffix          "dc=example,dc=com"
4404fd
-rootdn          "cn=Manager,dc=example,dc=com"
4404fd
-rootpw          secret
4404fd
-#~null~#directory	@TESTDIR@/db.1.a
4404fd
-#indexdb#index		objectClass eq
4404fd
-#indexdb#index		mail eq
4404fd
-#ndb#dbname db_1_a
4404fd
-#ndb#include @DATADIR@/ndb.conf
4404fd
-
4404fd
-#monitor#database	monitor
4404fd
-
4404fd
-sasl-realm	@KRB5REALM@
4404fd
-sasl-host	localhost
4404fd
-
4404fd
-database	config
4404fd
-rootpw		secret
4404fd
diff --git a/tests/scripts/defines.sh b/tests/scripts/defines.sh
4404fd
index f9e5578ee..a84fd0a65 100755
4404fd
--- a/tests/scripts/defines.sh
4404fd
+++ b/tests/scripts/defines.sh
4404fd
@@ -114,7 +114,6 @@ REFSLAVECONF=$DATADIR/slapd-ref-slave.conf
4404fd
 SCHEMACONF=$DATADIR/slapd-schema.conf
4404fd
 TLSCONF=$DATADIR/slapd-tls.conf
4404fd
 TLSSASLCONF=$DATADIR/slapd-tls-sasl.conf
4404fd
-SASLGSSAPICONF=$DATADIR/slapd-sasl-gssapi.conf
4404fd
 GLUECONF=$DATADIR/slapd-glue.conf
4404fd
 REFINTCONF=$DATADIR/slapd-refint.conf
4404fd
 RETCODECONF=$DATADIR/slapd-retcode.conf
4404fd
diff --git a/tests/scripts/test077-sasl-gssapi b/tests/scripts/test077-sasl-gssapi
4404fd
index 20c414600..322df60a4 100755
4404fd
--- a/tests/scripts/test077-sasl-gssapi
4404fd
+++ b/tests/scripts/test077-sasl-gssapi
4404fd
@@ -21,15 +21,40 @@ if test $WITH_SASL = no ; then
4404fd
         exit 0
4404fd
 fi
4404fd
 
4404fd
+CONFDIR=$TESTDIR/slapd.d
4404fd
+CONFLDIF=$TESTDIR/slapd.ldif
4404fd
+
4404fd
 mkdir -p $TESTDIR $DBDIR1 $CONFDIR
4404fd
 cp -r $DATADIR/tls $TESTDIR
4404fd
+$SLAPPASSWD -g -n >$CONFIGPWF
4404fd
 
4404fd
 echo "Starting KDC for SASL/GSSAPI tests..."
4404fd
 . $SRCDIR/scripts/setup_kdc.sh
4404fd
 
4404fd
-echo "Running slapadd to build slapd database..."
4404fd
-. $CONFFILTER $BACKEND $MONITORDB < $SASLGSSAPICONF > $CONF1
4404fd
-$SLAPADD -f $CONF1 -l $LDIFORDERED
4404fd
+echo "Configuring slapd..."
4404fd
+cat > $CONFLDIF <
4404fd
+dn: cn=config
4404fd
+objectClass: olcGlobal
4404fd
+cn: config
4404fd
+olcSaslHost: localhost
4404fd
+olcSaslRealm: $KRB5REALM
4404fd
+olcTLSCACertificateFile: $TESTDIR/tls/ca/certs/testsuiteCA.crt
4404fd
+olcTLSCertificateFile: $TESTDIR/tls/certs/localhost.crt
4404fd
+olcTLSCertificateKeyFile: $TESTDIR/tls/private/localhost.key
4404fd
+
4404fd
+dn: cn=schema,cn=config
4404fd
+objectClass: olcSchemaConfig
4404fd
+cn: schema
4404fd
+
4404fd
+include: file://$ABS_SCHEMADIR/core.ldif
4404fd
+
4404fd
+dn: olcDatabase={0}config,cn=config
4404fd
+objectClass: olcDatabaseConfig
4404fd
+olcDatabase: {0}config
4404fd
+olcRootPW:< file://$TESTDIR/configpw
4404fd
+
4404fd
+EOF
4404fd
+$SLAPADD -F $CONFDIR -n 0 -l $CONFLDIF
4404fd
 RC=$?
4404fd
 if test $RC != 0 ; then
4404fd
 	echo "slapadd failed ($RC)!"
4404fd
@@ -38,7 +63,7 @@ if test $RC != 0 ; then
4404fd
 fi
4404fd
 
4404fd
 echo "Starting ldap:/// slapd on TCP/IP port $PORT1 and ldaps:/// slapd on $PORT2..."
4404fd
-$SLAPD -f $CONF1 -h "$URI1 $SURI2" -d $LVL $TIMING > $LOG1 2>&1 &
4404fd
+$SLAPD -F $CONFDIR -h "$URI1 $SURI2" -d $LVL $TIMING > $LOG1 2>&1 &
4404fd
 PID=$!
4404fd
 if test $WAIT != 0 ; then
4404fd
     echo PID $PID
4404fd
@@ -151,7 +176,7 @@ else
4404fd
 	for acb in "none" "tls-unique" "tls-endpoint" ; do
4404fd
 
4404fd
 		echo "Modifying slapd's olcSaslCBinding to ${acb} ..."
4404fd
-		$LDAPMODIFY -D cn=config -H $URI1 -w secret <<EOF > $TESTOUT 2>&1
4404fd
+		$LDAPMODIFY -D cn=config -H $URI1 -y $CONFIGPWF <<EOF > $TESTOUT 2>&1
4404fd
 dn: cn=config
4404fd
 changetype: modify
4404fd
 replace: olcSaslCBinding
4404fd
-- 
4404fd
2.26.2
4404fd