diff options
author | Garming Sam <garming@catalyst.net.nz> | 2014-02-25 17:02:52 +1300 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-05-07 19:49:17 +0200 |
commit | c517150ec0f9334db561cfbe4e8640e1091ae5db (patch) | |
tree | 85745146a6b53516ab3d8084cfd23a10ba544971 /lib/param/loadparm.c | |
parent | 886e44f159bebe927413c35379949453027f518a (diff) | |
download | samba-c517150ec0f9334db561cfbe4e8640e1091ae5db.tar.gz samba-c517150ec0f9334db561cfbe4e8640e1091ae5db.tar.xz samba-c517150ec0f9334db561cfbe4e8640e1091ae5db.zip |
lib/param: use get_parametric_helper in 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 | 39 |
1 files changed, 6 insertions, 33 deletions
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c index 7728e6dd0c7..fd0c827d1a2 100644 --- a/lib/param/loadparm.c +++ b/lib/param/loadparm.c @@ -290,7 +290,6 @@ const char *lpcfg_get_parametric(struct loadparm_context *lp_ctx, struct loadparm_service *service, const char *type, const char *option) { - char *vfskey = NULL; struct parmlist_entry *data; if (lp_ctx == NULL) @@ -300,40 +299,14 @@ const char *lpcfg_get_parametric(struct loadparm_context *lp_ctx, return lp_ctx->s3_fns->get_parametric(service, type, option, NULL); } - vfskey = talloc_asprintf(NULL, "%s:%s", type, option); - if (vfskey == NULL) { - DEBUG(0,("asprintf failed!\n")); - return NULL; - } - - /* - * Try to fetch the option from the service. - */ - if (service != NULL) { - for (data = service->param_opt; data; - data = data->next) { - if (strwicmp(data->key, vfskey) == 0) { - talloc_free(vfskey); - return data->value; - } - } - } + data = get_parametric_helper(service, + type, option, lp_ctx->globals->param_opt); - /* - * 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; + if (data == NULL) { + return NULL; + } else { + return data->value; } - - talloc_free(vfskey); - - return NULL; } |