summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-08-05 15:30:33 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:31:18 -0500
commitbeed5b8532400d79fd40fc53ebae1666adc9af34 (patch)
treee4df28e320076202faa68a6dc10a6721a5bdd055
parent0e6369f5e80d506d532e0e352b02d7d65d16db49 (diff)
downloadsamba-beed5b8532400d79fd40fc53ebae1666adc9af34.tar.gz
samba-beed5b8532400d79fd40fc53ebae1666adc9af34.tar.bz2
samba-beed5b8532400d79fd40fc53ebae1666adc9af34.zip
r9119: added a lp.categories() call in the loadparm js object, to allow
retrieval of the smb.conf parameter categories. This will make writing a smb.conf editor easier. (This used to be commit 8db549b1506b5260c9eb16f40bbdae6a7c006fa2)
-rw-r--r--source4/param/loadparm.c30
-rw-r--r--source4/param/loadparm.h13
-rw-r--r--source4/scripting/ejs/smbcalls_config.c22
3 files changed, 46 insertions, 19 deletions
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index 160a7d12de..eb757d40e4 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -89,21 +89,6 @@ static BOOL do_parameter_var(const char *pszParmName, const char *fmt, ...);
static BOOL defaults_saved = False;
-#define FLAG_BASIC 0x0001 /* fundamental options */
-#define FLAG_SHARE 0x0002 /* file sharing options */
-#define FLAG_PRINT 0x0004 /* printing options */
-#define FLAG_GLOBAL 0x0008 /* local options that should be globally settable in SWAT */
-#define FLAG_WIZARD 0x0010 /* Parameters that the wizard will operate on */
-#define FLAG_ADVANCED 0x0020 /* Parameters that the wizard will operate on */
-#define FLAG_DEVELOPER 0x0040 /* Parameters that the wizard will operate on */
-#define FLAG_DEPRECATED 0x1000 /* options that should no longer be used */
-#define FLAG_HIDE 0x2000 /* options that should be hidden in SWAT */
-#define FLAG_DOS_STRING 0x4000 /* convert from UNIX to DOS codepage when reading this string. */
-#define FLAG_CMDLINE 0x8000 /* this option was set from the command line */
-
-
-
-
struct param_opt {
struct param_opt *prev, *next;
char *key;
@@ -760,6 +745,7 @@ static struct parm_struct parm_table[] = {
{"msdfs root", P_BOOL, P_LOCAL, &sDefault.bMSDfsRoot, NULL, NULL, FLAG_SHARE},
{"msdfs proxy", P_STRING, P_LOCAL, &sDefault.szMSDfsProxy, NULL, NULL, FLAG_SHARE},
{"host msdfs", P_BOOL, P_GLOBAL, &Globals.bHostMSDfs, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
+
{"Winbind options", P_SEP, P_SEPARATOR},
{"winbind uid", P_STRING, P_GLOBAL, &Globals.szWinbindUID, handle_winbind_uid, NULL, FLAG_ADVANCED | FLAG_DEVELOPER},
@@ -775,6 +761,16 @@ static struct parm_struct parm_table[] = {
{NULL, P_BOOL, P_NONE, NULL, NULL, NULL, 0}
};
+
+/*
+ return the parameter table
+*/
+struct parm_struct *lp_parm_table(void)
+{
+ return parm_table;
+}
+
+
/***************************************************************************
Initialise the sDefault parameter structure for the printer values.
***************************************************************************/
@@ -931,11 +927,7 @@ static void init_globals(void)
do_parameter("max connections", "-1");
do_parameter("dcerpc endpoint servers", "epmapper srvsvc wkssvc rpcecho samr netlogon lsarpc spoolss drsuapi winreg dssetup");
-#ifdef WITH_KRB5
do_parameter("server services", "smb rpc nbt ldap cldap web kdc");
-#else
- do_parameter("server services", "smb rpc nbt ldap cldap web");
-#endif
do_parameter("ntptr providor", "simple_ldb");
do_parameter("auth methods", "anonymous sam_ignoredomain");
do_parameter("smb passwd file", dyn_SMB_PASSWD_FILE);
diff --git a/source4/param/loadparm.h b/source4/param/loadparm.h
index 217955d294..16444c84a2 100644
--- a/source4/param/loadparm.h
+++ b/source4/param/loadparm.h
@@ -58,3 +58,16 @@ struct parm_struct {
const char **lvalue;
} def;
};
+
+#define FLAG_BASIC 0x0001 /* fundamental options */
+#define FLAG_SHARE 0x0002 /* file sharing options */
+#define FLAG_PRINT 0x0004 /* printing options */
+#define FLAG_GLOBAL 0x0008 /* local options that should be globally settable in SWAT */
+#define FLAG_WIZARD 0x0010 /* Parameters that the wizard will operate on */
+#define FLAG_ADVANCED 0x0020 /* Parameters that the wizard will operate on */
+#define FLAG_DEVELOPER 0x0040 /* Parameters that the wizard will operate on */
+#define FLAG_DEPRECATED 0x1000 /* options that should no longer be used */
+#define FLAG_HIDE 0x2000 /* options that should be hidden in SWAT */
+#define FLAG_DOS_STRING 0x4000 /* convert from UNIX to DOS codepage when reading this string. */
+#define FLAG_CMDLINE 0x8000 /* this option was set from the command line */
+
diff --git a/source4/scripting/ejs/smbcalls_config.c b/source4/scripting/ejs/smbcalls_config.c
index ddb06aa7d7..a69c3d81f9 100644
--- a/source4/scripting/ejs/smbcalls_config.c
+++ b/source4/scripting/ejs/smbcalls_config.c
@@ -45,6 +45,27 @@ static int ejs_lpServices(MprVarHandle eid, int argc, char **argv)
/*
+ return a list of parameter categories
+*/
+static int ejs_lpCategories(MprVarHandle eid, int argc, char **argv)
+{
+ struct parm_struct *parm_table = lp_parm_table();
+ int i;
+ const char **list = NULL;
+ if (argc != 0) return -1;
+
+ for (i=0;parm_table[i].label;i++) {
+ if (parm_table[i].class == P_SEPARATOR) {
+ list = str_list_add(list, parm_table[i].label);
+ }
+ }
+ talloc_steal(mprMemCtx(), list);
+ mpr_Return(eid, mprList("categories", list));
+ return 0;
+}
+
+
+/*
allow access to loadparm variables from inside ejs scripts in swat
can be called in 4 ways:
@@ -185,6 +206,7 @@ static int ejs_loadparm_init(MprVarHandle eid, int argc, struct MprVar **argv)
mprSetStringCFunction(obj, "set", ejs_lpSet);
mprSetStringCFunction(obj, "reload", ejs_lpReload);
mprSetStringCFunction(obj, "services", ejs_lpServices);
+ mprSetStringCFunction(obj, "categories", ejs_lpCategories);
return 0;
}