mirror of
https://github.com/samba-team/samba.git
synced 2025-11-11 00:23:51 +03:00
- 'make quicktest' for running only quick tests. Finishes in 20 seconds or so. - 'make valgrindtest' runs smbd under valgrind in a xterm window and runs the quick tests. Also disables tls as that slows down valgrind too much to be usable
54 lines
1.8 KiB
Bash
Executable File
54 lines
1.8 KiB
Bash
Executable File
#!/bin/sh
|
|
# test some simple LDAP and CLDAP operations
|
|
|
|
if [ $# -lt 3 ]; then
|
|
cat <<EOF
|
|
Usage: test_ldap.sh SERVER USERNAME PASSWORD
|
|
EOF
|
|
exit 1;
|
|
fi
|
|
|
|
# see if we support ldaps
|
|
if grep HAVE_LIBGNUTLS.1 include/config.h > /dev/null &&
|
|
grep tls.enabled.=yes $CONFFILE > /dev/null; then
|
|
PROTOCOLS="ldap ldaps"
|
|
else
|
|
PROTOCOLS="ldap"
|
|
fi
|
|
|
|
SERVER="$1"
|
|
USERNAME="$2"
|
|
PASSWORD="$3"
|
|
|
|
incdir=`dirname $0`
|
|
. $incdir/test_functions.sh
|
|
|
|
for p in $PROTOCOLS; do
|
|
for options in "" "-U$USERNAME%$PASSWORD"; do
|
|
echo "TESTING PROTOCOL $p with options $options"
|
|
|
|
testit "RootDSE" bin/ldbsearch $CONFIGURATION $options --basedn='' -H $p://$SERVER -s base DUMMY=x dnsHostName highestCommittedUSN || failed=`expr $failed + 1`
|
|
|
|
echo "Getting defaultNamingContext"
|
|
BASEDN=`bin/ldbsearch $CONFIGURATION $options --basedn='' -H $p://$SERVER -s base DUMMY=x defaultNamingContext | grep defaultNamingContext | awk '{print $2}'`
|
|
echo "BASEDN is $BASEDN"
|
|
|
|
testit "Listing Users" bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER '(objectclass=user)' sAMAccountName || failed=`expr $failed + 1`
|
|
|
|
testit "Listing Groups" bin/ldbsearch $options $CONFIGURATION -H $p://$SERVER '(objectclass=group)' sAMAccountName || failed=`expr $failed + 1`
|
|
|
|
nusers=`bin/ldbsearch $options -H $p://$SERVER $CONFIGURATION '(|(|(&(!(groupType:1.2.840.113556.1.4.803:=1))(groupType:1.2.840.113556.1.4.803:=2147483648)(groupType:1.2.840.113556.1.4.804:=10))(samAccountType=805306368))(samAccountType=805306369))' sAMAccountName | grep sAMAccountName | wc -l`
|
|
echo "Found $nusers users"
|
|
if [ $nusers -lt 10 ]; then
|
|
echo "Should have found at least 10 users"
|
|
failed=`expr $failed + 1`
|
|
fi
|
|
done
|
|
done
|
|
|
|
testit "CLDAP" bin/smbtorture $TORTURE_OPTIONS //$SERVER/_none_ LDAP-CLDAP || failed=`expr $failed + 1`
|
|
|
|
LDBDIR=lib/ldb
|
|
export LDBDIR
|
|
testit "ldb tests" $LDBDIR/tests/test-tdb.sh
|