summaryrefslogtreecommitdiffstats
path: root/source4/scripting
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-08-30 13:58:48 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:35:02 -0500
commita3a7881d39d0c294d0cd2ce13203478fb889b07c (patch)
tree4f2a78f93e9a369cd6658f2f6ef180b8f27ebe70 /source4/scripting
parentf3c121eb748b37a8b60d353d371bed9b79d0e37c (diff)
downloadsamba-a3a7881d39d0c294d0cd2ce13203478fb889b07c.tar.gz
samba-a3a7881d39d0c294d0cd2ce13203478fb889b07c.tar.xz
samba-a3a7881d39d0c294d0cd2ce13203478fb889b07c.zip
r9798: Add generic functions for handling smb.conf files (the parameters don't to be pre-declared). Also doesn't use any globals, so multiple files can be loaded at once.
Currently uses the prefix "param" for all functions and structures; suggestions for better ones are welcome... Remove old smb.conf-parsing code from libsamba3. (This used to be commit 414e5f7f6dc38a8fde3b61d524a664f56f9ea592)
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/ejs/smbcalls_samba3.c43
1 files changed, 3 insertions, 40 deletions
diff --git a/source4/scripting/ejs/smbcalls_samba3.c b/source4/scripting/ejs/smbcalls_samba3.c
index 936426c2da..e8e6b416e2 100644
--- a/source4/scripting/ejs/smbcalls_samba3.c
+++ b/source4/scripting/ejs/smbcalls_samba3.c
@@ -288,8 +288,8 @@ static struct MprVar mprSecrets(struct samba3_secrets *sec)
static struct MprVar mprShares(struct samba3 *samba3)
{
- struct MprVar mpv = mprObject("array"), s, ps, p;
- int i, j;
+ struct MprVar mpv = mprObject("array"), s;
+ int i;
for (i = 0; i < samba3->share_count; i++) {
s = mprObject("share");
@@ -298,18 +298,7 @@ static struct MprVar mprShares(struct samba3 *samba3)
/* FIXME: secdesc */
- ps = mprObject("array");
-
- for (j = 0; j < samba3->shares[i].parameter_count; j++) {
- p = mprObject("parameter");
-
- mprSetVar(&p, "name", mprString(samba3->shares[i].parameters[j].name));
- mprSetVar(&p, "value", mprString(samba3->shares[i].parameters[j].value));
-
- mprAddArray(&ps, j, p);
- }
-
- mprSetVar(&s, "parameters", ps);
+ mprAddArray(&mpv, i, s);
}
return mpv;
@@ -389,29 +378,6 @@ static struct MprVar mprWinsEntries(struct samba3 *samba3)
return mpv;
}
-static int ejs_get_param(MprVarHandle eid, int argc, struct MprVar **argv)
-{
- struct samba3 *samba3;
- const char *tmp;
-
- if (argc < 2) {
- ejsSetErrorMsg(eid, "get_param invalid arguments");
- return -1;
- }
-
- samba3 = mprGetThisPtr(eid, "samba3");
- mprAssert(samba3);
- tmp = samba3_get_param(samba3, mprToString(argv[0]), mprToString(argv[1]));
-
- if (tmp == NULL) {
- mpr_Return(eid, mprCreateUndefinedVar());
- } else {
- mpr_Return(eid, mprString(tmp));
- }
-
- return 0;
-}
-
static int ejs_find_domainsecrets(MprVarHandle eid, int argc, struct MprVar **argv)
{
struct samba3 *samba3 = NULL;
@@ -435,8 +401,6 @@ static int ejs_find_domainsecrets(MprVarHandle eid, int argc, struct MprVar **ar
return 0;
}
-
-
/*
initialise samba3 ejs subsystem
*/
@@ -470,7 +434,6 @@ static int ejs_samba3_read(MprVarHandle eid, int argc, struct MprVar **argv)
mprSetVar(&mpv, "idmapdb", mprIdmapDb(&samba3->idmap));
mprSetVar(&mpv, "policy", mprPolicy(&samba3->policy));
mprSetVar(&mpv, "registry", mprRegistry(&samba3->registry));
- mprSetCFunction(&mpv, "get_param", ejs_get_param);
mprSetCFunction(&mpv, "find_domainsecrets", ejs_find_domainsecrets);
mpr_Return(eid, mpv);