summaryrefslogtreecommitdiff
path: root/swat/esptest/ldb.esp
blob: 1bc75bce73063862e6043ed5768f43c395deb02b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<% page_header("columns", "ESP ldb test"); %>

<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("/");
	}
}

/*
  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", "dn");

res = ldbSearch(dbfile, "(objectClass=domain)", attrs);
showLdbRes(res);
%>

and now an unconstrained search:<p>

<%
var dbfile = lpGet("sam database");

res = ldbSearch(dbfile, "(objectClass=user)");
showLdbRes(res);
%>

and a bad search<br>

<%
res = ldbSearch("foo");
%>

all done

<% page_footer() %>