diff options
author | Michael Adam <obnox@samba.org> | 2008-04-09 15:37:33 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2008-04-10 01:29:02 +0200 |
commit | 68fb75857bdac02fcc7178f546d8c800329f89c6 (patch) | |
tree | f407ddfe1805f8d29bdd8e31ce8494b83e6786c7 /source3 | |
parent | 9765828d973c647205e933eda9992d8695687461 (diff) | |
download | samba-68fb75857bdac02fcc7178f546d8c800329f89c6.tar.gz samba-68fb75857bdac02fcc7178f546d8c800329f89c6.tar.bz2 samba-68fb75857bdac02fcc7178f546d8c800329f89c6.zip |
net conf: implement "net conf getincludes".
Michael
(This used to be commit 30bc48623cf4f9ee17ff9c3e7a9fd98840a01d92)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/utils/net_conf.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 6f99df2c90..b4565085a5 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -109,6 +109,11 @@ static int net_conf_delparm_usage(int argc, const char **argv) return -1; } +static int net_conf_getincludes_usage(int argc, const char **argv) +{ + d_printf("USAGE: net conf getincludes <section>\n"); + return -1; +} /********************************************************************** * @@ -775,6 +780,46 @@ done: return ret; } +static int net_conf_getincludes(struct smbconf_ctx *conf_ctx, + int argc, const char **argv) +{ + WERROR werr; + uint32_t num_includes; + uint32_t count; + char *service; + char **includes = NULL; + int ret = -1; + TALLOC_CTX *mem_ctx = talloc_stackframe(); + + if (argc != 1) { + net_conf_getincludes_usage(argc, argv); + goto done; + } + + service = talloc_strdup_lower(mem_ctx, argv[0]); + if (service == NULL) { + d_printf("error: out of memory!\n"); + goto done; + } + + werr = smbconf_get_includes(conf_ctx, mem_ctx, service, + &num_includes, &includes); + if (!W_ERROR_IS_OK(werr)) { + d_printf("error getting includes: %s\n", dos_errstr(werr)); + goto done; + } + + for (count = 0; count < num_includes; count++) { + d_printf("include = %s\n", includes[count]); + } + + ret = 0; + +done: + TALLOC_FREE(mem_ctx); + return ret; +} + /********************************************************************** * @@ -875,6 +920,8 @@ int net_conf(int argc, const char **argv) "Retrieve the value of a parameter."}, {"delparm", net_conf_delparm, "Delete a parameter."}, + {"getincludes", net_conf_getincludes, + "Show the includes of a share definition."}, {NULL, NULL, NULL} }; |