diff options
author | Andrew Bartlett <abartlet@samba.org> | 2010-11-02 15:33:42 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2010-11-02 05:19:17 +0000 |
commit | b717ec26d96d5285f554c56c01d885c19b1c9b65 (patch) | |
tree | 6a3284516096ccf5ad84ea381ab76677f8e0a087 | |
parent | 7d0f04a651e4bed7e1e6d587a1bdaf3cfa6f9e33 (diff) | |
download | samba-b717ec26d96d5285f554c56c01d885c19b1c9b65.tar.gz samba-b717ec26d96d5285f554c56c01d885c19b1c9b65.tar.bz2 samba-b717ec26d96d5285f554c56c01d885c19b1c9b65.zip |
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 <abartlet@samba.org>
Autobuild-Date: Tue Nov 2 05:19:17 UTC 2010 on sn-devel-104
-rw-r--r-- | source3/param/loadparm.c | 13 |
1 files changed, 9 insertions, 4 deletions
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; } |