summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorAtul Kulkarni <atul.kulkarni@in.ibm.com>2013-09-10 01:47:46 +0200
committerMichael Adam <obnox@samba.org>2013-10-02 00:06:33 +0200
commit050fb746b3ed615af9572d975ba3449ffe6657e1 (patch)
treeb9a7404b272aa6d0106195635074631e4500527d /source3/utils
parent375168a16eedab3e60153a2b5f7cce1a22e21d5e (diff)
downloadsamba-050fb746b3ed615af9572d975ba3449ffe6657e1.tar.gz
samba-050fb746b3ed615af9572d975ba3449ffe6657e1.tar.bz2
samba-050fb746b3ed615af9572d975ba3449ffe6657e1.zip
net: add "net idmap set config" command to store the autorid global config
Pair-Programmed-With: Michael Adam <obnox@samba.org> Signed-off-by: Atul Kulkarni <atul.kulkarni@in.ibm.com> Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_idmap.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/source3/utils/net_idmap.c b/source3/utils/net_idmap.c
index c22c5d551d..80dc0424ce 100644
--- a/source3/utils/net_idmap.c
+++ b/source3/utils/net_idmap.c
@@ -736,6 +736,45 @@ static int net_idmap_secret(struct net_context *c, int argc, const char **argv)
return 0;
}
+static int net_idmap_autorid_set_config(struct net_context *c,
+ int argc, const char **argv)
+{
+ int ret = -1;
+ NTSTATUS status;
+ TALLOC_CTX *mem_ctx;
+ struct db_context *db = NULL;
+
+ if (argc != 1 || c->display_usage) {
+ d_printf("%s\n%s",
+ _("Usage:"),
+ _("net idmap set config <config>"
+ " [--db=<inputfile>]\n"
+ " Update CONFIG entry in autorid.\n"
+ " config\tConfig string to be stored\n"
+ " inputfile\tTDB file to update config.\n"));
+ return c->display_usage ? 0 : -1;
+ }
+
+ mem_ctx = talloc_stackframe();
+
+ if (!net_idmap_opendb_autorid(mem_ctx, c, false, &db)) {
+ goto done;
+ }
+
+ status = idmap_autorid_saveconfigstr(db, argv[0]);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("Error storing the config in the database: %s\n",
+ nt_errstr(status));
+ goto done;
+ }
+
+ ret = 0;
+
+done:
+ TALLOC_FREE(mem_ctx);
+ return ret;
+}
+
static int net_idmap_set(struct net_context *c, int argc, const char **argv)
{
struct functable func[] = {
@@ -748,6 +787,14 @@ static int net_idmap_set(struct net_context *c, int argc, const char **argv)
" Not implemented yet")
},
{
+ "config",
+ net_idmap_autorid_set_config,
+ NET_TRANSPORT_LOCAL,
+ N_("Save the global configuration in the autorid database"),
+ N_("net idmap set config \n"
+ " Save the global configuration in the autorid database ")
+ },
+ {
"secret",
net_idmap_secret,
NET_TRANSPORT_LOCAL,