summaryrefslogtreecommitdiff
path: root/source4/scripting/libjs/management.js
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-19 04:26:58 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:29:40 -0500
commita32fe0f293fb86d69f3f7001daac2614adfb6b98 (patch)
tree5f4477d2e4a04c2855ec1d1ce38aa704dc11ffb6 /source4/scripting/libjs/management.js
parentf3d61cc61545605cb8ea07b21b07577ccde4e1e8 (diff)
downloadsamba-a32fe0f293fb86d69f3f7001daac2614adfb6b98.tar.gz
samba-a32fe0f293fb86d69f3f7001daac2614adfb6b98.tar.bz2
samba-a32fe0f293fb86d69f3f7001daac2614adfb6b98.zip
r8577: added management calls to list current tree connects
(This used to be commit 658befc1e4df44bee1f365a730951001f0f36640)
Diffstat (limited to 'source4/scripting/libjs/management.js')
-rw-r--r--source4/scripting/libjs/management.js41
1 files changed, 40 insertions, 1 deletions
diff --git a/source4/scripting/libjs/management.js b/source4/scripting/libjs/management.js
index 371ddc026b..d989541661 100644
--- a/source4/scripting/libjs/management.js
+++ b/source4/scripting/libjs/management.js
@@ -4,6 +4,7 @@
Released under the GNU GPL v2 or later
*/
+
/*
return a list of current sessions
*/
@@ -12,11 +13,16 @@ function smbsrv_sessions()
var conn = new Object();
var irpc = irpc_init();
status = irpc_connect(conn, "smb_server");
- assert(status.is_ok == true);
+ if (status.is_ok != true) {
+ return undefined;
+ }
var io = irpcObj();
io.input.level = irpc.SMBSRV_INFO_SESSIONS;
status = irpc.smbsrv_information(conn, io);
+ if (status.is_ok != true) {
+ return undefined;
+ }
/* gather the results into a single array */
var i, count=0, ret = new Object();
@@ -31,3 +37,36 @@ function smbsrv_sessions()
ret.length = count;
return ret;
}
+
+/*
+ return a list of current tree connects
+*/
+function smbsrv_trees()
+{
+ var conn = new Object();
+ var irpc = irpc_init();
+ status = irpc_connect(conn, "smb_server");
+ if (status.is_ok != true) {
+ return undefined;
+ }
+
+ var io = irpcObj();
+ io.input.level = irpc.SMBSRV_INFO_TREES;
+ status = irpc.smbsrv_information(conn, io);
+ if (status.is_ok != true) {
+ return undefined;
+ }
+
+ /* gather the results into a single array */
+ var i, count=0, ret = new Object();
+ for (i=0;i<io.results.length;i++) {
+ var trees = io.results[i].info.trees.trees;
+ var j;
+ for (j=0;j<trees.length;j++) {
+ ret[count] = trees[j];
+ count++;
+ }
+ }
+ ret.length = count;
+ return ret;
+}