From f9ff72cbda6b4e59448fd79ef9e12f264d48015f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 11 Jul 2005 00:23:57 +0000 Subject: r8298: - started building a library of js routines in scripting/libjs/ - switched the existing test programs over to using the library - added install of js lib (This used to be commit 2a444dedbe44347268affc6458196f93ca7d372b) --- testprogs/ejs/samr.js | 122 +++++++++++--------------------------------------- 1 file changed, 26 insertions(+), 96 deletions(-) (limited to 'testprogs/ejs/samr.js') diff --git a/testprogs/ejs/samr.js b/testprogs/ejs/samr.js index ec2096b818..1c613d5619 100755 --- a/testprogs/ejs/samr.js +++ b/testprogs/ejs/samr.js @@ -3,65 +3,28 @@ test samr calls from ejs */ +libinclude("base.js"); +libinclude("samr.js"); +libinclude("samr.js"); -/* - helper function to setup a rpc io object, ready for input -*/ -function irpcObj() -{ - var o = new Object(); - o.input = new Object(); - return o; -} - -/* - check that a status result is OK -*/ -function check_status_ok(status) -{ - if (status.is_ok != true) { - printVars(status); - } - assert(status.is_ok == true); -} /* test the samr_Connect interface */ function test_Connect(conn) { - var io = irpcObj(); print("Testing samr_Connect\n"); - io.input.system_name = NULL; - io.input.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; - status = dcerpc_samr_Connect(conn, io); - check_status_ok(status); - return io.output.connect_handle; + return samrConnect(conn); } -/* - test the samr_Close interface -*/ -function test_Close(conn, handle) -{ - var io = irpcObj(); - 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 = domain; - status = dcerpc_samr_LookupDomain(conn, io); - check_status_ok(status); - return io.output.sid; + return samrLookupDomain(conn, handle, domain); } /* @@ -69,14 +32,8 @@ function test_LookupDomain(conn, handle, domain) */ 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; + return samrOpenDomain(conn, handle, sid); } /* @@ -84,21 +41,12 @@ function test_OpenDomain(conn, handle, sid) */ function test_EnumDomainUsers(conn, dom_handle) { - var i, io = irpcObj(); + var i, users; 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.sam == NULL) { - return; - } - var entries = io.output.sam.entries; - for (i=0;i