r6549: a simple ldap test script
authorAndrew Tridgell <tridge@samba.org>
Sun, 1 May 2005 09:58:27 +0000 (09:58 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:16:25 +0000 (13:16 -0500)
source/script/tests/test_ldap.sh [new file with mode: 0755]

diff --git a/source/script/tests/test_ldap.sh b/source/script/tests/test_ldap.sh
new file mode 100755 (executable)
index 0000000..1aeb74b
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+SERVER="$1"
+
+# test some simple LDAP operations
+
+echo "Testing RootDSE"
+ldbsearch -b '' -H ldap://$SERVER -s base DUMMY=x dnsHostName highestCommittedUSN || exit 1
+
+echo "Getting defaultNamingContext"
+BASEDN=`ldbsearch -b '' -H ldap://$SERVER -s base DUMMY=x defaultNamingContext | grep ^defaultNamingContext | awk '{print $2}'`
+echo "BASEDN is $BASEDN"
+
+
+echo "Listing Users"
+ldbsearch -H ldap://$SERVER -b "$BASEDN" '(objectclass=user)' sAMAccountName
+
+echo "Listing Groups"
+ldbsearch -H ldap://$SERVER -b "$BASEDN" '(objectclass=group)' sAMAccountName
+