2 test samr calls from ejs
7 helper function to setup a rpc io object, ready for input
12 o.input = new Object();
17 check that a status result is OK
19 function check_status_ok(status)
21 if (status.is_ok != true) {
24 assert(status.is_ok == true);
28 test the samr_Connect interface
30 function test_Connect(conn)
33 print("Testing samr_Connect\n");
34 io.input.system_name = NULL;
35 io.input.access_mask = 0;
36 status = dcerpc_samr_Connect(conn, io);
37 check_status_ok(status);
38 return io.output.connect_handle;
42 test the samr_Close interface
44 function test_Close(conn, handle)
47 print("Testing samr_Close\n");
48 io.input.handle = handle;
49 status = dcerpc_samr_Close(conn, io);
50 check_status_ok(status);
54 test the samr_EnumDomains interface
56 function test_EnumDomains(conn, handle)
59 print("Testing samr_EnumDomains\n");
60 io.input.connect_handle = handle;
61 io.input.resume_handle = 0;
62 io.input.buf_size = 0;
63 status = dcerpc_samr_EnumDomains(conn, io);
64 check_status_ok(status);
65 print("Found " + io.output.num_entries + " domains\n");
66 entries = io.output.sam.entries;
67 for (i=0;i<io.output.num_entries;i++) {
68 print("\t" + entries[i].name.string + "\n");
74 if (ARGV.length == 0) {
75 print("Usage: samr.js <RPCBINDING>\n");
79 var binding = ARGV[0];
80 var conn = new Object();
82 print("Connecting to " + binding + "\n");
83 status = rpc_connect(conn, binding, "samr");
84 if (status.is_ok != true) {
85 print("Failed to connect to " + binding + " - " + status.errstr + "\n");
89 handle = test_Connect(conn);
90 test_EnumDomains(conn, handle);
91 test_Close(conn, handle);