diff options
Diffstat (limited to 'source4/scripting/libjs')
-rw-r--r-- | source4/scripting/libjs/management.js | 25 | ||||
-rw-r--r-- | source4/scripting/libjs/samr.js | 31 |
2 files changed, 25 insertions, 31 deletions
diff --git a/source4/scripting/libjs/management.js b/source4/scripting/libjs/management.js index e1c68ca1de..26c1c0a34a 100644 --- a/source4/scripting/libjs/management.js +++ b/source4/scripting/libjs/management.js @@ -10,16 +10,15 @@ */ function smbsrv_sessions() { - var conn = new Object(); var irpc = irpc_init(); - status = irpc_connect(conn, "smb_server"); + status = irpc.connect("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); + status = irpc.smbsrv_information(io); if (status.is_ok != true) { return undefined; } @@ -43,16 +42,15 @@ function smbsrv_sessions() */ function smbsrv_trees() { - var conn = new Object(); var irpc = irpc_init(); - status = irpc_connect(conn, "smb_server"); + status = irpc.connect("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); + status = irpc.smbsrv_information(io); if (status.is_ok != true) { return undefined; } @@ -76,16 +74,15 @@ function smbsrv_trees() */ function nbtd_statistics() { - var conn = new Object(); var irpc = irpc_init(); - status = irpc_connect(conn, "nbt_server"); + status = irpc.connect("nbt_server"); if (status.is_ok != true) { return undefined; } var io = irpcObj(); io.input.level = irpc.NBTD_INFO_STATISTICS; - status = irpc.nbtd_information(conn, io); + status = irpc.nbtd_information(io); if (status.is_ok != true) { return undefined; } @@ -113,7 +110,6 @@ function service_enabled(name) */ function server_status(name) { - var conn = new Object(); var i; var io; var irpc = irpc_init(); @@ -122,13 +118,13 @@ function server_status(name) return "DISABLED"; } - status = irpc_connect(conn, name + "_server"); + status = irpc.connect(name + "_server"); if (status.is_ok != true) { return "DOWN"; } var io = irpcObj(); - status = irpc.irpc_uptime(conn, io); + status = irpc.irpc_uptime(io); if (status.is_ok != true) { return "NOT RESPONDING"; } @@ -141,19 +137,18 @@ function server_status(name) */ function stream_server_status(name) { - var conn = new Object(); var irpc = irpc_init(); if (!service_enabled(name)) { return "DISABLED"; } - status = irpc_connect(conn, name + "_server"); + status = irpc.connect(name + "_server"); if (status.is_ok != true) { return "0 connections"; } var io = irpcObj(); - status = irpc.irpc_uptime(conn, io); + status = irpc.irpc_uptime(io); if (status.is_ok != true) { return "NOT RESPONDING"; } diff --git a/source4/scripting/libjs/samr.js b/source4/scripting/libjs/samr.js index 2363dde686..d0c2b89822 100644 --- a/source4/scripting/libjs/samr.js +++ b/source4/scripting/libjs/samr.js @@ -32,12 +32,11 @@ function samArray(output) */ function samrConnect(conn) { - conn.samr = samr_init(); - conn.sec = security_init(); + security_init(conn); var io = irpcObj(); io.input.system_name = NULL; - io.input.access_mask = conn.sec.SEC_FLAG_MAXIMUM_ALLOWED; - var status = conn.samr.samr_Connect2(conn, io); + io.input.access_mask = conn.SEC_FLAG_MAXIMUM_ALLOWED; + var status = conn.samr_Connect2(io); check_status_ok(status); return io.output.connect_handle; } @@ -49,7 +48,7 @@ function samrClose(conn, handle) { var io = irpcObj(); io.input.handle = handle; - var status = conn.samr.samr_Close(conn, io); + var status = conn.samr_Close(io); check_status_ok(status); } @@ -61,7 +60,7 @@ function samrLookupDomain(conn, handle, domain) var io = irpcObj(); io.input.connect_handle = handle; io.input.domain_name = domain; - var status = conn.samr.samr_LookupDomain(conn, io); + var status = conn.samr_LookupDomain(io); check_status_ok(status); return io.output.sid; } @@ -73,9 +72,9 @@ function samrOpenDomain(conn, handle, sid) { var io = irpcObj(); io.input.connect_handle = handle; - io.input.access_mask = conn.sec.SEC_FLAG_MAXIMUM_ALLOWED; + io.input.access_mask = conn.SEC_FLAG_MAXIMUM_ALLOWED; io.input.sid = sid; - var status = conn.samr.samr_OpenDomain(conn, io); + var status = conn.samr_OpenDomain(io); check_status_ok(status); return io.output.domain_handle; } @@ -87,9 +86,9 @@ function samrOpenUser(conn, handle, rid) { var io = irpcObj(); io.input.domain_handle = handle; - io.input.access_mask = conn.sec.SEC_FLAG_MAXIMUM_ALLOWED; + io.input.access_mask = conn.SEC_FLAG_MAXIMUM_ALLOWED; io.input.rid = rid; - var status = conn.samr.samr_OpenUser(conn, io); + var status = conn.samr_OpenUser(io); check_status_ok(status); return io.output.user_handle; } @@ -104,7 +103,7 @@ function samrEnumDomainUsers(conn, dom_handle) io.input.resume_handle = 0; io.input.acct_flags = 0; io.input.max_size = -1; - var status = conn.samr.samr_EnumDomainUsers(conn, io); + var status = conn.samr_EnumDomainUsers(io); check_status_ok(status); return samArray(io.output); } @@ -119,7 +118,7 @@ function samrEnumDomainGroups(conn, dom_handle) io.input.resume_handle = 0; io.input.acct_flags = 0; io.input.max_size = -1; - var status = conn.samr.samr_EnumDomainGroups(conn, io); + var status = conn.samr_EnumDomainGroups(io); check_status_ok(status); return samArray(io.output); } @@ -133,7 +132,7 @@ function samrEnumDomains(conn, handle) io.input.connect_handle = handle; io.input.resume_handle = 0; io.input.buf_size = -1; - var status = conn.samr.samr_EnumDomains(conn, io); + var status = conn.samr_EnumDomains(io); check_status_ok(status); return samArray(io.output); } @@ -146,7 +145,7 @@ function samrQueryUserInfo(conn, user_handle, level) var r, io = irpcObj(); io.input.user_handle = user_handle; io.input.level = level; - var status = conn.samr.samr_QueryUserInfo(conn, io); + var status = conn.samr_QueryUserInfo(io); check_status_ok(status); return io.output.info.info3; } @@ -160,8 +159,8 @@ function samrFillUserInfo(conn, dom_handle, users, level) var i; for (i=0;i<users.length;i++) { var r, user_handle, info; - user_handle = samrOpenUser(conn, dom_handle, users[i].idx); - info = samrQueryUserInfo(conn, user_handle, level); + user_handle = samrOpenUser(dom_handle, users[i].idx); + info = samrQueryUserInfo(user_handle, level); info.name = users[i].name; info.idx = users[i].idx; users[i] = info; |