From b717ec26d96d5285f554c56c01d885c19b1c9b65 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 2 Nov 2010 15:33:42 +1100 Subject: s3-param Fix up lp_set_cmdline() not to re-store cmdline options on each reload The previous code was buggy in that it did not honour the 'store' argument to lp_set_cmdline_helper(), and would use the stored parameter after freeing it when handling overwritten values. Andrew Bartlett Autobuild-User: Andrew Bartlett Autobuild-Date: Tue Nov 2 05:19:17 UTC 2010 on sn-devel-104 --- source3/param/loadparm.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'source3') diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 8dadebfa89..1d3c7353ed 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -4983,8 +4983,9 @@ static struct lp_stored_option *stored_options; */ static bool store_lp_set_cmdline(const char *pszParmName, const char *pszParmValue) { - struct lp_stored_option *entry = NULL; - for (entry = stored_options; entry != NULL; entry = entry->next) { + struct lp_stored_option *entry, *entry_next; + for (entry = stored_options; entry != NULL; entry = entry_next) { + entry_next = entry->next; if (strcmp(pszParmName, entry->label) == 0) { DLIST_REMOVE(stored_options, entry); talloc_free(entry); @@ -7887,14 +7888,18 @@ static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmVa } parm_table[parmnum].flags |= FLAG_CMDLINE; - store_lp_set_cmdline(pszParmName, pszParmValue); + if (store_values) { + store_lp_set_cmdline(pszParmName, pszParmValue); + } return true; } /* it might be parametric */ if (strchr(pszParmName, ':') != NULL) { set_param_opt(&Globals.param_opt, pszParmName, pszParmValue, FLAG_CMDLINE); - store_lp_set_cmdline(pszParmName, pszParmValue); + if (store_values) { + store_lp_set_cmdline(pszParmName, pszParmValue); + } return true; } -- cgit