summaryrefslogtreecommitdiff
path: root/source4/scripting/libjs
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-11-02 01:04:00 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:45:39 -0500
commit783851099b43236666b2fc0cc866834773d6e7b7 (patch)
tree277745750144e4e326ae1ad6e246daba042c332c /source4/scripting/libjs
parente8c23e4e2d9aab7fcf0e7653756c84ef6cf34ed6 (diff)
downloadsamba-783851099b43236666b2fc0cc866834773d6e7b7.tar.gz
samba-783851099b43236666b2fc0cc866834773d6e7b7.tar.bz2
samba-783851099b43236666b2fc0cc866834773d6e7b7.zip
r11458: fixed our ejs smbscript interfaces to use arrays where appropriate. In
js arrays are a special type of object where the length property is automatic, and cannot be modified manually. Our code was manually setting length, which made it abort when someone passed in a real ejs array. To fix this we need to create real arrays instead of objects, and remove the code that manually sets the length (This used to be commit ebdd1393fde44a0a35446d1a922d29a7c1769ba7)
Diffstat (limited to 'source4/scripting/libjs')
-rw-r--r--source4/scripting/libjs/management.js3
-rw-r--r--source4/scripting/libjs/winreg.js13
2 files changed, 4 insertions, 12 deletions
diff --git a/source4/scripting/libjs/management.js b/source4/scripting/libjs/management.js
index 26c1c0a34a..1258368e90 100644
--- a/source4/scripting/libjs/management.js
+++ b/source4/scripting/libjs/management.js
@@ -24,7 +24,7 @@ function smbsrv_sessions()
}
/* gather the results into a single array */
- var i, count=0, ret = new Object();
+ var i, count=0, ret = new Array(0);
for (i=0;i<io.results.length;i++) {
var sessions = io.results[i].info.sessions.sessions;
var j;
@@ -33,7 +33,6 @@ function smbsrv_sessions()
count++;
}
}
- ret.length = count;
return ret;
}
diff --git a/source4/scripting/libjs/winreg.js b/source4/scripting/libjs/winreg.js
index 63435ac22b..3b05f89c93 100644
--- a/source4/scripting/libjs/winreg.js
+++ b/source4/scripting/libjs/winreg.js
@@ -51,16 +51,13 @@ function __winreg_open_path(path)
{
var s = string_init();
var i, components = s.split('\\', path);
- var list = new Object();
-
- list.length = 0;
/* cope with a leading slash */
if (components[0] == '') {
for (i=0;i<(components.length-1);i++) {
components[i] = components[i+1];
}
- components.length--;
+ delete(components[i]);
}
if (components.length == 0) {
@@ -108,8 +105,7 @@ function __winreg_open_path(path)
*/
function __winreg_enum_path(path)
{
- var list = new Object();
- list.length = 0;
+ var list = new Array(0);
if (path == null || path == "\\" || path == "") {
return new Array("HKLM", "HKU");
@@ -155,7 +151,6 @@ function __winreg_enum_path(path)
return list;
}
list[list.length] = out.name.name;
- list.length++;
}
this.close(handle);
@@ -174,8 +169,7 @@ function __winreg_enum_path(path)
function __winreg_enum_values(path)
{
var data = datablob_init();
- var list = new Object();
- list.length = 0;
+ var list = new Array(0);
var handle = this.open_path(path);
if (handle == undefined) {
@@ -224,7 +218,6 @@ function __winreg_enum_values(path)
el.value = data.regToVar(el.rawvalue, el.type);
el.size = out.size;
list[list.length] = el;
- list.length++;
}
this.close(handle);