summaryrefslogtreecommitdiffstats
path: root/testprogs
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-08 10:30:50 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:19:23 -0500
commit78b3ea6c26266ffd095c07aefc94338bb83a700b (patch)
treeaf2390360039c6d49e9513450d8b832abef6f1c3 /testprogs
parent987e67df52ad906db5c80df736eea762d52814b6 (diff)
downloadsamba-78b3ea6c26266ffd095c07aefc94338bb83a700b.tar.gz
samba-78b3ea6c26266ffd095c07aefc94338bb83a700b.tar.xz
samba-78b3ea6c26266ffd095c07aefc94338bb83a700b.zip
r8239: - added testing of LookupDomain, OpenDomain and EnumDomainUsers
- used SEC_FLAG_MAXIMUM_ALLOWED for access mask. This gets the samr.js test working with w2k3 as the server (This used to be commit a929a90ed78ceb00729cc2c20bce6f2f3d34abd6)
Diffstat (limited to 'testprogs')
-rw-r--r--testprogs/ejs/samr.js85
1 files changed, 82 insertions, 3 deletions
diff --git a/testprogs/ejs/samr.js b/testprogs/ejs/samr.js
index dd3abe00613..fb444fb4b53 100644
--- a/testprogs/ejs/samr.js
+++ b/testprogs/ejs/samr.js
@@ -25,6 +25,16 @@ function check_status_ok(status)
}
/*
+ form a lsa_String
+*/
+function lsaString(s)
+{
+ var o = new Object();
+ o.string = s;
+ return o;
+}
+
+/*
test the samr_Connect interface
*/
function test_Connect(conn)
@@ -32,7 +42,7 @@ function test_Connect(conn)
var io = irpcObj();
print("Testing samr_Connect\n");
io.input.system_name = NULL;
- io.input.access_mask = 0;
+ io.input.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
status = dcerpc_samr_Connect(conn, io);
check_status_ok(status);
return io.output.connect_handle;
@@ -44,13 +54,74 @@ function test_Connect(conn)
function test_Close(conn, handle)
{
var io = irpcObj();
- print("Testing samr_Close\n");
io.input.handle = handle;
status = dcerpc_samr_Close(conn, io);
check_status_ok(status);
}
/*
+ test the samr_LookupDomain interface
+*/
+function test_LookupDomain(conn, handle, domain)
+{
+ var io = irpcObj();
+ print("Testing samr_LookupDomain\n");
+ io.input.connect_handle = handle;
+ io.input.domain_name = lsaString(domain);
+ status = dcerpc_samr_LookupDomain(conn, io);
+ check_status_ok(status);
+ return io.output.sid;
+}
+
+/*
+ test the samr_OpenDomain interface
+*/
+function test_OpenDomain(conn, handle, sid)
+{
+ var io = irpcObj();
+ print("Testing samr_OpenDomain\n");
+ io.input.connect_handle = handle;
+ io.input.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
+ io.input.sid = sid;
+ status = dcerpc_samr_OpenDomain(conn, io);
+ check_status_ok(status);
+ return io.output.domain_handle;
+}
+
+/*
+ test the samr_EnumDomainUsers interface
+*/
+function test_EnumDomainUsers(conn, dom_handle)
+{
+ var io = irpcObj();
+ print("Testing samr_EnumDomainUsers\n");
+ io.input.domain_handle = dom_handle;
+ io.input.resume_handle = 0;
+ io.input.acct_flags = 0;
+ io.input.max_size = -1;
+ status = dcerpc_samr_EnumDomainUsers(conn, io);
+ check_status_ok(status);
+ print("Found " + io.output.num_entries + " users\n");
+ if (io.output.num_entries == 0) {
+ return;
+ }
+ entries = io.output.sam.entries;
+ for (i=0;i<io.output.num_entries;i++) {
+ print("\t" + entries[i].name.string + "\n");
+ }
+}
+
+/*
+ test domain specific ops
+*/
+function test_domain_ops(conn, dom_handle)
+{
+ test_EnumDomainUsers(conn, dom_handle);
+}
+
+
+
+/*
test the samr_EnumDomains interface
*/
function test_EnumDomains(conn, handle)
@@ -59,7 +130,7 @@ function test_EnumDomains(conn, handle)
print("Testing samr_EnumDomains\n");
io.input.connect_handle = handle;
io.input.resume_handle = 0;
- io.input.buf_size = 0;
+ io.input.buf_size = -1;
status = dcerpc_samr_EnumDomains(conn, io);
check_status_ok(status);
print("Found " + io.output.num_entries + " domains\n");
@@ -67,6 +138,14 @@ function test_EnumDomains(conn, handle)
for (i=0;i<io.output.num_entries;i++) {
print("\t" + entries[i].name.string + "\n");
}
+ for (i=0;i<io.output.num_entries;i++) {
+ domain = entries[i].name.string;
+ print("Testing domain " + domain + "\n");
+ sid = test_LookupDomain(conn, handle, domain);
+ dom_handle = test_OpenDomain(conn, handle, sid);
+ test_domain_ops(conn, dom_handle);
+ test_Close(conn, dom_handle);
+ }
}