summaryrefslogtreecommitdiff
path: root/source4/script/tests/mk-openldap.sh
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2007-01-31 05:11:19 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:44:27 -0500
commitae174faf36dbe28b24069bafe5836b6271c87e12 (patch)
tree5aa18849fe38ce4b99cca36078e2552ae9fa9f2e /source4/script/tests/mk-openldap.sh
parent5e12e0024934c074ad5141f67fb95550e8aac69c (diff)
downloadsamba-ae174faf36dbe28b24069bafe5836b6271c87e12.tar.gz
samba-ae174faf36dbe28b24069bafe5836b6271c87e12.tar.bz2
samba-ae174faf36dbe28b24069bafe5836b6271c87e12.zip
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)
Diffstat (limited to 'source4/script/tests/mk-openldap.sh')
-rw-r--r--source4/script/tests/mk-openldap.sh122
1 files changed, 122 insertions, 0 deletions
diff --git a/source4/script/tests/mk-openldap.sh b/source4/script/tests/mk-openldap.sh
new file mode 100644
index 0000000000..0759532d3f
--- /dev/null
+++ b/source4/script/tests/mk-openldap.sh
@@ -0,0 +1,122 @@
+SLAPD_CONF=$LDAPDIR/slapd.conf
+export SLAPD_CONF
+
+cat >$SLAPD_CONF <<EOF
+loglevel 0
+
+include $LDAPDIR/ad.schema
+
+pidfile $PIDDIR/slapd.pid
+argsfile $LDAPDIR/slapd.args
+sasl-realm $DNSNAME
+access to * by * write
+
+allow update_anon
+
+authz-regexp
+ uid=([^,]*),cn=$DNSNAME,cn=digest-md5,cn=auth
+ ldap:///$BASEDN??sub?(samAccountName=\$1)
+
+authz-regexp
+ uid=([^,]*),cn=([^,]*),cn=digest-md5,cn=auth
+ ldap:///$BASEDN??sub?(samAccountName=\$1)
+
+include $LDAPDIR/modules.conf
+
+defaultsearchbase "$BASEDN"
+
+backend bdb
+database bdb
+suffix "$BASEDN"
+rootdn "cn=Manager,$BASEDN"
+rootpw $PASSWORD
+directory $LDAPDIR/db
+index objectClass eq
+index samAccountName eq
+index name eq
+index objectSid eq
+index objectCategory eq
+index member eq
+index uidNumber eq
+index gidNumber eq
+index unixName eq
+index privilege eq
+index nCName eq pres
+index lDAPDisplayName eq
+index subClassOf eq
+index dnsRoot eq
+index nETBIOSName eq pres
+
+overlay syncprov
+syncprov-checkpoint 100 10
+syncprov-sessionlog 100
+
+EOF
+
+cat > $LDAPDIR/db/DB_CONFIG <<EOF
+#
+ # Set the database in memory cache size.
+ #
+ set_cachesize 0 524288 0
+
+
+ #
+ # Set database flags (this is a test environment, we don't need to fsync()).
+ #
+ set_flags DB_TXN_NOSYNC
+
+ #
+ # Set log values.
+ #
+ set_lg_regionmax 104857
+ set_lg_max 1048576
+ set_lg_bsize 209715
+ set_lg_dir $LDAPDIR/db/bdb-logs
+
+
+ #
+ # Set temporary file creation directory.
+ #
+ set_tmp_dir $LDAPDIR/db/tmp
+EOF
+
+LDAP_URI="ldapi://$LDAPDIR/ldapi"
+LDAP_URI_ESCAPE="ldapi://"`echo $LDAPDIR/ldapi | sed 's|/|%2F|g'`
+export LDAP_URI
+export LDAP_URI_ESCAPE
+
+#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
+
+#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 <<EOF
+modulepath /usr/lib/ldap
+moduleload back_bdb
+EOF
+}
+
+if slaptest -u -f $SLAPD_CONF; then
+ slapadd -f $SLAPD_CONF < $PRIVATEDIR/$DNSNAME.ldif >/dev/null || {
+ echo "slapadd failed" >&2
+ }
+
+ slaptest -f $SLAPD_CONF >/dev/null || {
+ echo "slaptest after database load failed" >&2
+ }
+fi
+
+PATH=$OLDPATH
+export PATH
+