svn commit: samba r9119 - in branches/SAMBA_4_0/source: param scripting/ejs

tridge at samba.org tridge at samba.org
Fri Aug 5 15:30:34 GMT 2005


Author: tridge
Date: 2005-08-05 15:30:33 +0000 (Fri, 05 Aug 2005)
New Revision: 9119

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9119

Log:
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.

Modified:
   branches/SAMBA_4_0/source/param/loadparm.c
   branches/SAMBA_4_0/source/param/loadparm.h
   branches/SAMBA_4_0/source/scripting/ejs/smbcalls_config.c


Changeset:
Modified: branches/SAMBA_4_0/source/param/loadparm.c
===================================================================
--- branches/SAMBA_4_0/source/param/loadparm.c	2005-08-05 15:20:43 UTC (rev 9118)
+++ branches/SAMBA_4_0/source/param/loadparm.c	2005-08-05 15:30:33 UTC (rev 9119)
@@ -89,21 +89,6 @@
 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 @@
 	{"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 @@
 	{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 @@
 	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);

Modified: branches/SAMBA_4_0/source/param/loadparm.h
===================================================================
--- branches/SAMBA_4_0/source/param/loadparm.h	2005-08-05 15:20:43 UTC (rev 9118)
+++ branches/SAMBA_4_0/source/param/loadparm.h	2005-08-05 15:30:33 UTC (rev 9119)
@@ -58,3 +58,16 @@
 		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 */
+

Modified: branches/SAMBA_4_0/source/scripting/ejs/smbcalls_config.c
===================================================================
--- branches/SAMBA_4_0/source/scripting/ejs/smbcalls_config.c	2005-08-05 15:20:43 UTC (rev 9118)
+++ branches/SAMBA_4_0/source/scripting/ejs/smbcalls_config.c	2005-08-05 15:30:33 UTC (rev 9119)
@@ -45,6 +45,27 @@
 
 
 /*
+  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 @@
 	mprSetStringCFunction(obj, "set", ejs_lpSet);
 	mprSetStringCFunction(obj, "reload", ejs_lpReload);
 	mprSetStringCFunction(obj, "services", ejs_lpServices);
+	mprSetStringCFunction(obj, "categories", ejs_lpCategories);
 	return 0;
 }
 



More information about the samba-cvs mailing list