<% page_header("columns", "ESP ldb test"); %>

Samba4 ldb test


<% 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] + "
\n"); } } else { write(j + "=" + r[j] + "
\n"); } } write("

"); } } %> Trying a attribute constrained search on samdb:

<% 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:

<% var dbfile = lpGet("sam database"); res = ldbSearch(dbfile, "(objectClass=user)"); showLdbRes(res); %> and a bad search
<% res = ldbSearch("foo"); %> all done <% page_footer() %>