r8234: started on testing samr calls from ejs. So far it only does samr_Connect()
authorAndrew Tridgell <tridge@samba.org>
Fri, 8 Jul 2005 08:19:59 +0000 (08:19 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:19:23 +0000 (13:19 -0500)
(This used to be commit 2e50a5b780bed20415620011130af83ef73c4f85)

testprogs/ejs/echo.js
testprogs/ejs/samr.js [new file with mode: 0644]

index df12e4648671a6e58f175d62b7dad68fc8ea5cf9..2040a4663e60431e26b4d3af7579811c132e4ee4 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       demonstrate access to rpc calls from ejs
+       test echo pipe calls from ejs
 */     
 
 
diff --git a/testprogs/ejs/samr.js b/testprogs/ejs/samr.js
new file mode 100644 (file)
index 0000000..fac1cb7
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+  test samr calls from ejs
+*/     
+
+
+/*
+  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 = 0;
+       status = dcerpc_samr_Connect(conn, io);
+       printVars(io);
+       check_status_ok(status);
+}
+
+if (ARGV.length == 0) {
+   print("Usage: samr.js <RPCBINDING>\n");
+   exit(0);
+}
+
+var binding = ARGV[0];
+var conn = new Object();
+
+print("Connecting to " + binding + "\n");
+status = rpc_connect(conn, binding, "samr");
+if (status.is_ok != true) {
+   print("Failed to connect to " + binding + " - " + status.errstr + "\n");
+   return;
+}
+
+test_Connect(conn);
+
+print("All OK\n");