summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAtul Kulkarni <atul.kulkarni@in.ibm.com>2013-08-12 13:09:31 +0530
committerMichael Adam <obnox@samba.org>2013-10-02 00:06:34 +0200
commit063ec55e13d5ca09533cf2201b250769f7dbe27c (patch)
tree4f11614baac8417ffaf154c2fadde4a43083981e /source3
parent1be6c5787b9bfba37bc94b4a9517a357817ed2ac (diff)
downloadsamba-063ec55e13d5ca09533cf2201b250769f7dbe27c.tar.gz
samba-063ec55e13d5ca09533cf2201b250769f7dbe27c.tar.bz2
samba-063ec55e13d5ca09533cf2201b250769f7dbe27c.zip
net: add "net idmap get config" to read the autorid config from the database
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')
-rw-r--r--source3/utils/net_idmap.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/source3/utils/net_idmap.c b/source3/utils/net_idmap.c
index a581e83d0d..55cde381ae 100644
--- a/source3/utils/net_idmap.c
+++ b/source3/utils/net_idmap.c
@@ -808,9 +808,59 @@ static int net_idmap_set(struct net_context *c, int argc, const char **argv)
return net_run_function(c, argc, argv, "net idmap set", func);
}
+static int net_idmap_autorid_get_config(struct net_context *c, int argc,
+ const char **argv)
+{
+ int ret = -1;
+ char *config;
+ TALLOC_CTX *mem_ctx;
+ NTSTATUS status;
+ struct db_context *db = NULL;
+
+ if (argc > 0 || c->display_usage) {
+ d_printf("%s\n%s",
+ _("Usage:"),
+ _("net idmap get config"
+ " [--db=<inputfile>]\n"
+ " Get CONFIG entry from autorid database\n"
+ " inputfile\tTDB file to read config from.\n"));
+ return c->display_usage ? 0 : -1;
+ }
+
+ mem_ctx = talloc_stackframe();
+
+ if (!net_idmap_opendb_autorid(mem_ctx, c, true, &db)) {
+ goto done;
+ }
+
+ status = idmap_autorid_getconfigstr(db, mem_ctx, &config);
+ if (!NT_STATUS_IS_OK(status)) {
+ d_fprintf(stderr, "%s: %s\n",
+ _("Error: unable to read config entry"),
+ nt_errstr(status));
+ goto done;
+ }
+
+ printf("CONFIG: %s\n", config);
+ ret = 0;
+
+done:
+ TALLOC_FREE(mem_ctx);
+ return ret;
+}
+
+
static int net_idmap_get(struct net_context *c, int argc, const char **argv)
{
struct functable func[] = {
+ {
+ "config",
+ net_idmap_autorid_get_config,
+ NET_TRANSPORT_LOCAL,
+ N_("Get the global configuration from the autorid database"),
+ N_("net idmap get config \n"
+ " Get the global configuration from the autorid database ")
+ },
{NULL, NULL, 0, NULL, NULL}
};