param: refactor lp_set_cmdline_helper to not call store_lp_set_cmdline
authorGarming Sam <garming@catalyst.net.nz>
Tue, 25 Feb 2014 00:53:58 +0000 (13:53 +1300)
committerJeremy Allison <jra@samba.org>
Wed, 7 May 2014 17:49:17 +0000 (19:49 +0200)
Currently worthless without a shared do_parameter.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/param/loadparm.c

index 36bd4890bf4febad1b17b0444942fbbe5bf23c16..0f71c64030a77681bee647e0913871a5f0e624aa 100644 (file)
@@ -260,7 +260,7 @@ static struct file_lists *file_lists = NULL;
 
 static void set_allowed_client_auth(void);
 
-static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmValue, bool store_values);
+static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmValue);
 static void free_param_opts(struct parmlist_entry **popts);
 
 /* this is used to prevent lots of mallocs of size 1 */
@@ -616,7 +616,7 @@ static bool apply_lp_set_cmdline(void)
 {
        struct lp_stored_option *entry = NULL;
        for (entry = stored_options; entry != NULL; entry = entry->next) {
-               if (!lp_set_cmdline_helper(entry->label, entry->value, false)) {
+               if (!lp_set_cmdline_helper(entry->label, entry->value)) {
                        DEBUG(0, ("Failed to re-apply cmdline parameter %s = %s\n",
                                  entry->label, entry->value));
                        return false;
@@ -2777,7 +2777,7 @@ set a parameter, marking it with FLAG_CMDLINE. Parameters marked as
 FLAG_CMDLINE won't be overridden by loads from smb.conf.
 ***************************************************************************/
 
-static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmValue, bool store_values)
+static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmValue)
 {
        int parmnum, i;
        parmnum = lpcfg_map_parameter(pszParmName);
@@ -2802,18 +2802,12 @@ static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmVa
                        parm_table[i].flags |= FLAG_CMDLINE;
                }
 
-               if (store_values) {
-                       store_lp_set_cmdline(pszParmName, pszParmValue);
-               }
                return true;
        }
 
        /* it might be parametric */
        if (strchr(pszParmName, ':') != NULL) {
                set_param_opt(NULL, &Globals.param_opt, pszParmName, pszParmValue, FLAG_CMDLINE);
-               if (store_values) {
-                       store_lp_set_cmdline(pszParmName, pszParmValue);
-               }
                return true;
        }
 
@@ -2823,7 +2817,14 @@ static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmVa
 
 bool lp_set_cmdline(const char *pszParmName, const char *pszParmValue)
 {
-       return lp_set_cmdline_helper(pszParmName, pszParmValue, true);
+       bool ret;
+
+       ret = lp_set_cmdline_helper(pszParmName, pszParmValue);
+       if (ret) {
+               store_lp_set_cmdline(pszParmName, pszParmValue);
+       }
+
+       return ret;
 }
 
 /***************************************************************************