mirror of
https://github.com/samba-team/samba.git
synced 2025-08-04 08:22:08 +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 used to be commit 8db549b150
)
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
0e6369f5e8
commit
beed5b8532
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user