summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-20 07:20:03 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:29:48 -0500
commit86d628a292a22973597e0c06d4a36e20c58ae31c (patch)
tree502f4f8f915be7c4f7104cf6ad38d2239e6dff2d /source4
parent620301858a5b747002eebe2b9fcef10712ee8249 (diff)
downloadsamba-86d628a292a22973597e0c06d4a36e20c58ae31c.tar.gz
samba-86d628a292a22973597e0c06d4a36e20c58ae31c.tar.bz2
samba-86d628a292a22973597e0c06d4a36e20c58ae31c.zip
r8639: moved loadparm calls into an ejs object
(This used to be commit 2dc493eea6f9d87c40ad0dc755f528ce0b33ca47)
Diffstat (limited to 'source4')
-rwxr-xr-xsource4/scripting/bin/smbstatus4
-rw-r--r--source4/scripting/ejs/smbcalls_config.c15
-rw-r--r--source4/scripting/libjs/auth.js3
-rw-r--r--source4/scripting/libjs/management.js3
-rw-r--r--source4/scripting/libjs/provision.js16
5 files changed, 30 insertions, 11 deletions
diff --git a/source4/scripting/bin/smbstatus b/source4/scripting/bin/smbstatus
index 7fefae6963..38f2ab06a9 100755
--- a/source4/scripting/bin/smbstatus
+++ b/source4/scripting/bin/smbstatus
@@ -82,7 +82,9 @@ function show_nbt()
println("");
}
-printf("%s\n\n", lpGet("server string"));
+var lp = loadparm_init();
+
+printf("%s\n\n", lp.get("server string"));
if (options['nbt'] != undefined) {
show_nbt();
diff --git a/source4/scripting/ejs/smbcalls_config.c b/source4/scripting/ejs/smbcalls_config.c
index 18bdd0547e..7fc58f237d 100644
--- a/source4/scripting/ejs/smbcalls_config.c
+++ b/source4/scripting/ejs/smbcalls_config.c
@@ -140,10 +140,21 @@ static int ejs_lpGet(MprVarHandle eid, int argc, char **argv)
}
/*
+ initialise loadparm ejs subsystem
+*/
+static int ejs_loadparm_init(MprVarHandle eid, int argc, struct MprVar **argv)
+{
+ struct MprVar *obj = mprInitObject(eid, "loadparm", argc, argv);
+
+ mprSetStringCFunction(obj, "get", ejs_lpGet);
+ mprSetStringCFunction(obj, "services", ejs_lpServices);
+ return 0;
+}
+
+/*
setup C functions that be called from ejs
*/
void smb_setup_ejs_config(void)
{
- ejsDefineStringCFunction(-1, "lpGet", ejs_lpGet, NULL, MPR_VAR_SCRIPT_HANDLE);
- ejsDefineStringCFunction(-1, "lpServices", ejs_lpServices, NULL, MPR_VAR_SCRIPT_HANDLE);
+ ejsDefineCFunction(-1, "loadparm_init", ejs_loadparm_init, NULL, MPR_VAR_SCRIPT_HANDLE);
}
diff --git a/source4/scripting/libjs/auth.js b/source4/scripting/libjs/auth.js
index a973cb4753..73d8645218 100644
--- a/source4/scripting/libjs/auth.js
+++ b/source4/scripting/libjs/auth.js
@@ -11,7 +11,8 @@
function getDomainList()
{
var ret = new Array(2);
+ var lp = loadparm_init();
ret[0] = "System User";
- ret[1] = lpGet("workgroup");
+ ret[1] = lp.get("workgroup");
return ret;
}
diff --git a/source4/scripting/libjs/management.js b/source4/scripting/libjs/management.js
index 7130cdc5dd..e1c68ca1de 100644
--- a/source4/scripting/libjs/management.js
+++ b/source4/scripting/libjs/management.js
@@ -97,7 +97,8 @@ function nbtd_statistics()
*/
function service_enabled(name)
{
- var services = lpGet("server services");
+ var lp = loadparm_init();
+ var services = lp.get("server services");
var i;
for (i=0;i<services.length;i++) {
if (services[i] == name) {
diff --git a/source4/scripting/libjs/provision.js b/source4/scripting/libjs/provision.js
index d3b94c1d1c..e9a8aad0cc 100644
--- a/source4/scripting/libjs/provision.js
+++ b/source4/scripting/libjs/provision.js
@@ -141,13 +141,14 @@ function setup_ldb(ldif, dbname, subobj)
{
var extra = "";
var ldb = ldb_init();
+ var lp = loadparm_init();
if (arguments.length == 4) {
extra = arguments[3];
}
var dbfile = dbname;
- var src = lpGet("setup directory") + "/" + ldif;
+ var src = lp.get("setup directory") + "/" + ldif;
var data = sys.file_load(src);
data = data + extra;
@@ -167,8 +168,9 @@ function setup_ldb(ldif, dbname, subobj)
*/
function setup_file(template, fname, subobj)
{
- var f = lpGet("private dir") + "/" + fname;
- var src = lpGet("setup directory") + "/" + template;
+ var lp = loadparm_init();
+ var f = lp.get("private dir") + "/" + fname;
+ var src = lp.get("setup directory") + "/" + template;
sys.unlink(f);
@@ -221,9 +223,10 @@ function provision_guess()
{
var subobj = new Object();
var nss = nss_init();
+ var lp = loadparm_init();
- subobj.REALM = lpGet("realm");
- subobj.DOMAIN = lpGet("workgroup");
+ subobj.REALM = lp.get("realm");
+ subobj.DOMAIN = lp.get("workgroup");
subobj.HOSTNAME = hostname();
subobj.HOSTIP = hostip();
subobj.DOMAINGUID = randguid();
@@ -271,7 +274,8 @@ function searchone(ldb, expression, attribute)
*/
function newuser(username, unixname, password, message)
{
- var samdb = lpGet("sam database");
+ var lp = loadparm_init();
+ var samdb = lp.get("sam database");
var ldb = ldb_init();
/* connect to the sam */