diff options
author | Garming Sam <garming@catalyst.net.nz> | 2014-02-25 16:36:57 +1300 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-05-07 19:49:17 +0200 |
commit | 687b35931db026779688891aa10e49ae2d05c4a9 (patch) | |
tree | 82d1d7cb964f2893228af988b30142ca20d67e01 /lib/param/loadparm.c | |
parent | b93ed0a73b13fd6324c50d25db4a8427954d9bfc (diff) | |
download | samba-687b35931db026779688891aa10e49ae2d05c4a9.tar.gz samba-687b35931db026779688891aa10e49ae2d05c4a9.tar.xz samba-687b35931db026779688891aa10e49ae2d05c4a9.zip |
lib/param: clean up lpcfg_get_parametric
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.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c index fda1100eb7b..e8b0874d4fb 100644 --- a/lib/param/loadparm.c +++ b/lib/param/loadparm.c @@ -251,26 +251,17 @@ const char *lpcfg_get_parametric(struct loadparm_context *lp_ctx, return lp_ctx->s3_fns->get_parametric(service, type, option, NULL); } - data = (service == NULL ? lp_ctx->globals->param_opt : service->param_opt); - vfskey = talloc_asprintf(NULL, "%s:%s", type, option); if (vfskey == NULL) { DEBUG(0,("asprintf failed!\n")); return NULL; } - while (data) { - if (strwicmp(data->key, vfskey) == 0) { - talloc_free(vfskey); - return data->value; - } - data = data->next; - } - + /* + * Try to fetch the option from the service. + */ if (service != NULL) { - /* Try to fetch the same option but from globals */ - /* but only if we are not already working with globals */ - for (data = lp_ctx->globals->param_opt; data; + for (data = service->param_opt; data; data = data->next) { if (strwicmp(data->key, vfskey) == 0) { talloc_free(vfskey); @@ -279,6 +270,18 @@ const char *lpcfg_get_parametric(struct loadparm_context *lp_ctx, } } + /* + * Fall back to fetching from the globals. + */ + data = lp_ctx->globals->param_opt; + while (data) { + if (strwicmp(data->key, vfskey) == 0) { + talloc_free(vfskey); + return data->value; + } + data = data->next; + } + talloc_free(vfskey); return NULL; |