diff options
author | Michael Adam <obnox@samba.org> | 2008-04-09 01:20:36 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2008-04-10 01:29:02 +0200 |
commit | a98c08c151b04b5e4a75abdb201d6a554137de39 (patch) | |
tree | 2e61b32912004e89d4af835d1a80034b37e7a7f0 /source3 | |
parent | 92f52469a93a6648c2b0aa6d740f047f19d6a530 (diff) | |
download | samba-a98c08c151b04b5e4a75abdb201d6a554137de39.tar.gz samba-a98c08c151b04b5e4a75abdb201d6a554137de39.tar.bz2 samba-a98c08c151b04b5e4a75abdb201d6a554137de39.zip |
net conf: fix import to correctly add includes (at the end)
Michael
(This used to be commit 3e81db83707e30ad46a565c9a118e7293b6cdf50)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/utils/net_conf.c | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index e2d88c019d..c01a326c64 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -127,6 +127,9 @@ static WERROR import_process_service(struct smbconf_ctx *conf_ctx, { uint32_t idx; WERROR werr = WERR_OK; + uint32_t num_includes = 0; + char **includes = NULL; + TALLOC_CTX *mem_ctx = talloc_stackframe(); if (opt_testmode) { d_printf("[%s]\n", servicename); @@ -148,17 +151,42 @@ static WERROR import_process_service(struct smbconf_ctx *conf_ctx, d_printf("\t%s = %s\n", param_names[idx], param_values[idx]); } else { - werr = smbconf_set_parameter(conf_ctx, - servicename, - param_names[idx], - param_values[idx]); - if (!W_ERROR_IS_OK(werr)) { - goto done; + if (strequal(param_names[idx], "include")) { + includes = TALLOC_REALLOC_ARRAY(mem_ctx, + includes, + char *, + num_includes+1); + if (includes == NULL) { + werr = WERR_NOMEM; + goto done; + } + includes[num_includes] = + talloc_strdup(includes, + param_values[idx]); + if (includes[num_includes] == NULL) { + werr = WERR_NOMEM; + goto done; + } + num_includes++; + } else { + werr = smbconf_set_parameter(conf_ctx, + servicename, + param_names[idx], + param_values[idx]); + if (!W_ERROR_IS_OK(werr)) { + goto done; + } } } } + if (!opt_testmode) { + werr = smbconf_set_includes(conf_ctx, servicename, num_includes, + (const char **)includes); + } + done: + TALLOC_FREE(mem_ctx); return werr; } |