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

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