blob: d989541661c1b7e688a5f379618ed73153640937 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
/*
backend code for Samba4 management
Copyright Andrew Tridgell 2005
Released under the GNU GPL v2 or later
*/
/*
return a list of current sessions
*/
function smbsrv_sessions()
{
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_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();
for (i=0;i<io.results.length;i++) {
var sessions = io.results[i].info.sessions.sessions;
var j;
for (j=0;j<sessions.length;j++) {
ret[count] = sessions[j];
count++;
}
}
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;
}
|