summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-04-09 18:46:38 +0200
committerMichael Adam <obnox@samba.org>2008-04-10 01:29:03 +0200
commitf3cfc1446e923104f7aba13c519af8f706749eaf (patch)
tree9fe904eb43ef30a818d8b8e65da74c5c807b5b4c
parent68fb75857bdac02fcc7178f546d8c800329f89c6 (diff)
downloadsamba-f3cfc1446e923104f7aba13c519af8f706749eaf.tar.gz
samba-f3cfc1446e923104f7aba13c519af8f706749eaf.tar.bz2
samba-f3cfc1446e923104f7aba13c519af8f706749eaf.zip
net conf: implement a "net conf setincludes" command.
given zero or more filenames as command line parameters Michael (This used to be commit ab51e4d44c3dcd00697c8ffb2ce628c4072c7a53)
-rw-r--r--source3/utils/net_conf.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c
index b4565085a5..e6957d0f3e 100644
--- a/source3/utils/net_conf.c
+++ b/source3/utils/net_conf.c
@@ -115,6 +115,13 @@ static int net_conf_getincludes_usage(int argc, const char **argv)
return -1;
}
+static int net_conf_setincludes_usage(int argc, const char **argv)
+{
+ d_printf("USAGE: net conf setincludes <section> [<filename>]*\n");
+ return -1;
+}
+
+
/**********************************************************************
*
* Helper functions
@@ -820,6 +827,47 @@ done:
return ret;
}
+static int net_conf_setincludes(struct smbconf_ctx *conf_ctx,
+ int argc, const char **argv)
+{
+ WERROR werr;
+ char *service;
+ uint32_t num_includes;
+ const char **includes;
+ int ret = -1;
+ TALLOC_CTX *mem_ctx = talloc_stackframe();
+
+ if (argc < 1) {
+ net_conf_setincludes_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;
+ }
+
+ num_includes = argc - 1;
+ if (num_includes == 0) {
+ includes = NULL;
+ } else {
+ includes = argv + 1;
+ }
+
+ werr = smbconf_set_includes(conf_ctx, service, num_includes, includes);
+ if (!W_ERROR_IS_OK(werr)) {
+ d_printf("error setting includes: %s\n", dos_errstr(werr));
+ goto done;
+ }
+
+ ret = 0;
+
+done:
+ TALLOC_FREE(mem_ctx);
+ return ret;
+}
+
/**********************************************************************
*
@@ -922,6 +970,8 @@ int net_conf(int argc, const char **argv)
"Delete a parameter."},
{"getincludes", net_conf_getincludes,
"Show the includes of a share definition."},
+ {"setincludes", net_conf_setincludes,
+ "Set includes for a share."},
{NULL, NULL, NULL}
};