mirror of
https://github.com/samba-team/samba.git
synced 2025-03-11 16:58:40 +03:00
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 commit is contained in:
parent
fe5e61a252
commit
8db549b150
@ -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);
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -44,6 +44,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
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user