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("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] + "
\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"); res = ldbSearch(dbfile, "(objectClass=domain)", attrs); showLdbRes(res); %> and now an unconstrained search:

<% var dbfile = lpGet("sam database"); res = ldbSearch(dbfile, "(objectClass=domain)"); showLdbRes(res); %>