fac1cb712e05e279200797a3e122a154d0a92ff7
[samba.git] / testprogs / ejs / samr.js
1 /*
2   test samr calls from ejs
3 */      
4
5
6 /*
7   helper function to setup a rpc io object, ready for input
8 */
9 function irpcObj()
10 {
11         var o = new Object();
12         o.input = new Object();
13         return o;
14 }
15
16 /*
17   check that a status result is OK
18 */
19 function check_status_ok(status)
20 {
21         if (status.is_ok != true) {
22                 printVars(status);
23         }
24         assert(status.is_ok == true);
25 }
26
27 /*
28   test the samr_Connect interface
29 */
30 function test_Connect(conn)
31 {
32         var io = irpcObj();
33
34         print("Testing samr_Connect\n");
35
36         io.input.system_name = NULL;
37         io.input.access_mask = 0;
38         status = dcerpc_samr_Connect(conn, io);
39         printVars(io);
40         check_status_ok(status);
41 }
42
43 if (ARGV.length == 0) {
44    print("Usage: samr.js <RPCBINDING>\n");
45    exit(0);
46 }
47
48 var binding = ARGV[0];
49 var conn = new Object();
50
51 print("Connecting to " + binding + "\n");
52 status = rpc_connect(conn, binding, "samr");
53 if (status.is_ok != true) {
54    print("Failed to connect to " + binding + " - " + status.errstr + "\n");
55    return;
56 }
57
58 test_Connect(conn);
59
60 print("All OK\n");