summaryrefslogtreecommitdiffstats
path: root/lib/param/loadparm.c
diff options
context:
space:
mode:
authorGarming Sam <garming@catalyst.net.nz>2014-02-24 09:34:45 +1300
committerJeremy Allison <jra@samba.org>2014-05-07 19:49:16 +0200
commit5376e6a1bc03048d5e78cdd1ddbb67ce4a6c7080 (patch)
tree892e647bc651e1c813967a70095a7014214d30ac /lib/param/loadparm.c
parentdce3bcd00ff0e63548b9d2849238d0ba68137481 (diff)
downloadsamba-5376e6a1bc03048d5e78cdd1ddbb67ce4a6c7080.tar.gz
samba-5376e6a1bc03048d5e78cdd1ddbb67ce4a6c7080.tar.xz
samba-5376e6a1bc03048d5e78cdd1ddbb67ce4a6c7080.zip
param: make lp_do_parameter_parametric use set_param_opt
Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'lib/param/loadparm.c')
-rw-r--r--lib/param/loadparm.c37
1 files changed, 4 insertions, 33 deletions
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index 5b89a4f1dba..8bff6ecc82b 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -1317,7 +1317,7 @@ static bool lp_do_parameter_parametric(struct loadparm_context *lp_ctx,
const char *pszParmName,
const char *pszParmValue, int flags)
{
- struct parmlist_entry *paramo, *data;
+ struct parmlist_entry **data;
char *name;
TALLOC_CTX *mem_ctx;
@@ -1329,43 +1329,14 @@ static bool lp_do_parameter_parametric(struct loadparm_context *lp_ctx,
if (!name) return false;
if (service == NULL) {
- data = lp_ctx->globals->param_opt;
+ data = &lp_ctx->globals->param_opt;
mem_ctx = lp_ctx->globals;
} else {
- data = service->param_opt;
+ data = &service->param_opt;
mem_ctx = service;
}
- /* Traverse destination */
- for (paramo=data; paramo; paramo=paramo->next) {
- /* If we already have the option set, override it unless
- it was a command line option and the new one isn't */
- if (strcmp(paramo->key, name) == 0) {
- if ((paramo->priority & FLAG_CMDLINE) &&
- !(flags & FLAG_CMDLINE)) {
- talloc_free(name);
- return true;
- }
-
- talloc_free(paramo->value);
- paramo->value = talloc_strdup(paramo, pszParmValue);
- paramo->priority = flags;
- talloc_free(name);
- return true;
- }
- }
-
- paramo = talloc_zero(mem_ctx, struct parmlist_entry);
- if (!paramo)
- smb_panic("OOM");
- paramo->key = talloc_strdup(paramo, name);
- paramo->value = talloc_strdup(paramo, pszParmValue);
- paramo->priority = flags;
- if (service == NULL) {
- DLIST_ADD(lp_ctx->globals->param_opt, paramo);
- } else {
- DLIST_ADD(service->param_opt, paramo);
- }
+ set_param_opt(mem_ctx, data, name, pszParmValue, flags);
talloc_free(name);