mirror of
https://github.com/samba-team/samba.git
synced 2025-11-05 04:23:51 +03:00
This changes the main selftest code to be in perl rather than in shell script. The selftest script is now no longer a black box but a regular executable that takes --help. This adds the following features: * "make test TESTS=foo" will run only the tests that match the regex "foo" * ability to deal with expected failures. the suite will not warn about tests that fail and are known to fail, but will warn about other failing tests and tests that are succeeding tests but incorrectly marked as failing. * ability to print a summary with all failures at the end of the run It also opens up the way to the following features, which I hope to implement later: * "environments", for example having a complete domains with DCs and domain members in a testenvironment * only set up smbd if necessary (not when running LOCAL tests, for example) * different mktestsetup scripts per target. except for the mktestsetup script, we can use the same infrastructure for samba 3 or windows.
123 lines
2.5 KiB
Bash
Executable File
123 lines
2.5 KiB
Bash
Executable File
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
|
|
|