mrc0mmand / rpms / openldap

Forked from rpms/openldap 3 years ago
Clone

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

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