net: move the "net idmap delete" functionality to subcommand "net idmap delete mapping"
authorMichael Adam <obnox@samba.org>
Mon, 9 Sep 2013 15:30:32 +0000 (17:30 +0200)
committerMichael Adam <obnox@samba.org>
Tue, 1 Oct 2013 08:49:21 +0000 (10:49 +0200)
This is in preparation of adding more types of entries to delete...

Signed-off-by: Michael Adam <obnox@samba.org>
source3/utils/net_idmap.c

index db7587aab4c48ff44d6549a33f9ccf719002f41d..306b130f6ef19b87aa85adf17a736b328d97e22b 100644 (file)
@@ -516,7 +516,8 @@ static bool delete_args_ok(int argc, const char **argv)
        return false;
 }
 
-static int net_idmap_delete(struct net_context *c, int argc, const char **argv)
+static int net_idmap_delete_mapping(struct net_context *c, int argc,
+                                   const char **argv)
 {
        int ret = -1;
        struct db_context *db;
@@ -529,7 +530,7 @@ static int net_idmap_delete(struct net_context *c, int argc, const char **argv)
        if ( !delete_args_ok(argc,argv) || c->display_usage) {
                d_printf("%s\n%s",
                         _("Usage:"),
-                        _("net idmap delete [-f] [--db=<TDB>] <ID>\n"
+                        _("net idmap delete mapping [-f] [--db=<TDB>] <ID>\n"
                           "  Delete mapping of ID from TDB.\n"
                           "    -f\tforce\n"
                           "    TDB\tidmap database\n"
@@ -570,6 +571,24 @@ done:
        return ret;
 }
 
+static int net_idmap_delete(struct net_context *c, int argc, const char **argv)
+{
+       struct functable func[] = {
+               {
+                       "mapping",
+                       net_idmap_delete_mapping,
+                       NET_TRANSPORT_LOCAL,
+                       N_("Delete ID mapping"),
+                       N_("net idmap delete mapping <ID>\n"
+                          "  Delete ID mapping")
+               },
+               {NULL, NULL, 0, NULL, NULL}
+       };
+
+       return net_run_function(c, argc, argv, "net idmap delete", func);
+}
+
+
 static int net_idmap_set_mapping(struct net_context *c,
                                 int argc, const char **argv)
 {
@@ -771,9 +790,9 @@ int net_idmap(struct net_context *c, int argc, const char **argv)
                        "delete",
                        net_idmap_delete,
                        NET_TRANSPORT_LOCAL,
-                       N_("Delete ID mapping"),
-                       N_("net idmap delete <ID>\n"
-                          "  Delete ID mapping")
+                       N_("Delete entries from the ID mapping database"),
+                       N_("net idmap delete\n"
+                          "  Delete entries from the ID mapping database")
                },
                {
                        "secret",