svn commit: samba r7054 - in branches/SAMBA_4_0/swat/esptest: .

tridge at samba.org tridge at samba.org
Sat May 28 08:48:57 GMT 2005


Author: tridge
Date: 2005-05-28 08:48:57 +0000 (Sat, 28 May 2005)
New Revision: 7054

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7054

Log:
added a example script showing ldbSearch() usage

Added:
   branches/SAMBA_4_0/swat/esptest/ldb.esp
Modified:
   branches/SAMBA_4_0/swat/esptest/index.esp


Changeset:
Modified: branches/SAMBA_4_0/swat/esptest/index.esp
===================================================================
--- branches/SAMBA_4_0/swat/esptest/index.esp	2005-05-28 08:48:18 UTC (rev 7053)
+++ branches/SAMBA_4_0/swat/esptest/index.esp	2005-05-28 08:48:57 UTC (rev 7054)
@@ -1,6 +1,7 @@
 <%
   var tests = new Array("formtest", "showvars", "include", 
-                        "session", "loadparm", "exception");
+                        "session", "loadparm", "exception",
+			"ldb");
 %>
 
 <HTML>

Added: branches/SAMBA_4_0/swat/esptest/ldb.esp
===================================================================
--- branches/SAMBA_4_0/swat/esptest/ldb.esp	2005-05-28 08:48:18 UTC (rev 7053)
+++ branches/SAMBA_4_0/swat/esptest/ldb.esp	2005-05-28 08:48:57 UTC (rev 7054)
@@ -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>



More information about the samba-cvs mailing list