BOOL lp_file_list_changed(void);
void *lp_local_ptr(int snum, void *ptr);
BOOL lp_do_parameter(int snum, char *pszParmName, char *pszParmValue);
+BOOL lp_is_default(int snum, struct parm_struct *parm);
struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters);
BOOL lp_snum_ok(int iService);
BOOL lp_loaded(void);
}
}
+/***************************************************************************
+return True if a local parameter is currently set to the global default
+***************************************************************************/
+BOOL lp_is_default(int snum, struct parm_struct *parm)
+{
+ int pdiff = PTR_DIFF(parm->ptr,&sDefault);
+
+ return equal_parameter(parm->type,
+ ((char *)pSERVICE(snum)) + pdiff,
+ ((char *)&sDefault) + pdiff);
+}
+
+
/***************************************************************************
Display the contents of a single services record.
***************************************************************************/
+/* commit one parameter */
+static void commit_parameter(int snum, struct parm_struct *parm, char *v)
+{
+ int i;
+ char *s;
+
+ if (snum < 0 && parm->class == P_LOCAL) {
+ /* this handles the case where we are changing a local
+ variable globally. We need to change the parameter in
+ all shares where it is currently set to the default */
+ for (i=0;i<lp_numservices();i++) {
+ s = lp_servicename(i);
+ if (s && (*s) && lp_is_default(i, parm)) {
+ lp_do_parameter(i, parm->label, v);
+ }
+ }
+ }
+
+ lp_do_parameter(snum, parm->label, v);
+}
+
/* commit a set of parameters for a service */
static void commit_parameters(int snum)
{
while ((parm = lp_next_parameter(snum, &i, 1))) {
sprintf(label, "parm_%s", parm->label);
if ((v = cgi_variable(label))) {
- lp_do_parameter(snum, parm->label, v);
+ if (parm->flags & FLAG_HIDE) continue;
+ commit_parameter(snum, parm, v);
}
}
}