summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-05-28 08:48:57 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:09 -0500
commit2e315315e58b666b89ae205cc60c6a39a20915fe (patch)
tree919fb82866a54b73ccdaa7573420d097e7a20b15
parentcab11d1fa52a84e4d3651c32f9f7bf55db0e2dcb (diff)
downloadsamba-2e315315e58b666b89ae205cc60c6a39a20915fe.tar.gz
samba-2e315315e58b666b89ae205cc60c6a39a20915fe.tar.bz2
samba-2e315315e58b666b89ae205cc60c6a39a20915fe.zip
r7054: added a example script showing ldbSearch() usage
(This used to be commit 0fe835b16c8e8c4fbd801a447aca1f077934e84c)
-rw-r--r--swat/esptest/index.esp3
-rw-r--r--swat/esptest/ldb.esp63
2 files changed, 65 insertions, 1 deletions
diff --git a/swat/esptest/index.esp b/swat/esptest/index.esp
index 7a5952e955..e95a22ba3f 100644
--- a/swat/esptest/index.esp
+++ b/swat/esptest/index.esp
@@ -1,6 +1,7 @@
<%
var tests = new Array("formtest", "showvars", "include",
- "session", "loadparm", "exception");
+ "session", "loadparm", "exception",
+ "ldb");
%>
<HTML>
diff --git a/swat/esptest/ldb.esp b/swat/esptest/ldb.esp
new file mode 100644
index 0000000000..3285574bf2
--- /dev/null
+++ b/swat/esptest/ldb.esp
@@ -0,0 +1,63 @@
+<HTML>
+<TITLE>
+Samba4 ESP test
+</TITLE>
+<BODY>
+<h1>Samba4 ldb test</h1>
+
+<form name="LdbTest" method="POST" action="@@request['SCRIPT_NAME']">
+ <input name="submit" type="submit" value="Cancel"><br>
+</form>
+
+<%
+if (request['REQUEST_METHOD'] == "POST") {
+ /* if they cancelled then take them back to the list of tests */
+ if (form['submit'] == "Cancel") {
+ redirect("index.esp");
+ }
+}
+
+/*
+ hmm, this gets fairly involved ...
+*/
+function showLdbRes(res) {
+ for (i in res) {
+ var r = res[i];
+ for (j in r) {
+ var a = r[j];
+ if (typeof(a) == "object") {
+ for (k in a) {
+ write(j + "[" + k + "]=" + a[k] + "<br>\n");
+ }
+ } else {
+ write(j + "=" + r[j] + "<br>\n");
+ }
+ }
+ write("<p>");
+ }
+}
+
+%>
+
+Trying a attribute constrained search on samdb:<p>
+
+<%
+var dbfile = lpGet("sam database");
+var attrs = new Array("name", "dnsDomain", "objectSid");
+
+res = ldbSearch(dbfile, "(objectClass=domain)", attrs);
+showLdbRes(res);
+%>
+
+and now an unconstrained search:<p>
+
+<%
+var dbfile = lpGet("sam database");
+
+res = ldbSearch(dbfile, "(objectClass=domain)");
+showLdbRes(res);
+%>
+
+
+</BODY>
+</HTML>