]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
net: add `net tdb smbXsrv wipedbs` alias for `net serverid wipedbs`
authorRalph Boehme <slow@samba.org>
Sun, 29 Jun 2025 16:04:41 +0000 (18:04 +0200)
committerRalph Boehme <slow@samba.org>
Tue, 5 Aug 2025 14:52:34 +0000 (14:52 +0000)
`net serverid` is imho not the right place for the wipedbs functionality. Add
it as an alias to `net tdb`. It works pretty opaque and unless you run

 # net tdb smbXsrv wipedbs --help
 Usage:
 net serverid wipedbs [--test] [--verbose]
 Example:
 net serverid wipedbs -v

the use won't notice it is an alias.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/utils/net_proto.h
source3/utils/net_serverid.c
source3/utils/net_tdb.c

index baca8575585969cefb721bf05cf0fe3a580baa7f..9370ebdbc677eea5e0919caedb93b9202c8026df 100644 (file)
@@ -407,6 +407,8 @@ int net_printing(struct net_context *c, int argc, const char **argv);
 
 int net_serverid(struct net_context *c, int argc, const char **argv);
 
+int net_serverid_wipedbs(struct net_context *c, int argc, const char **argv);
+
 /* The following definitions come from utils/net_util.c  */
 
 NTSTATUS net_rpc_lookup_name(struct net_context *c,
index e704829d645b29ab84b2a5c95c60395f426755c3..07d784f310f811db44374da249ac49635c07c98d 100644 (file)
@@ -734,8 +734,7 @@ static int wipedbs_traverse_replay_records(struct db_record *rec,
        return 0;
 }
 
-static int net_serverid_wipedbs(struct net_context *c, int argc,
-                               const char **argv)
+int net_serverid_wipedbs(struct net_context *c, int argc, const char **argv)
 {
        int ret = -1;
        NTSTATUS status;
index 29585eb718283eae19ec8724fd777b84019c3509..7fcdf3f04e9d62eb92c1a1dbecc14a718d90701d 100644 (file)
@@ -88,6 +88,22 @@ out:
        TALLOC_FREE(mem_ctx);
        return ret;
 }
+static int net_tdb_smbXsrv(struct net_context *c, int argc, const char **argv)
+{
+       struct functable func[] = {
+               {
+                       "wipedbs",
+                       net_serverid_wipedbs,
+                       NET_TRANSPORT_LOCAL,
+                       N_("Clean dead entries from smbXsrv databases"),
+                       N_("net tdb smbXsrv wipedbs\n"
+                          "    Clean dead entries from smbXsrv databases")
+               },
+               {NULL, NULL, 0, NULL, NULL}
+       };
+
+       return net_run_function(c, argc, argv, "net tdb smbXsrv", func);
+}
 
 int net_tdb(struct net_context *c, int argc, const char **argv)
 {
@@ -98,6 +114,14 @@ int net_tdb(struct net_context *c, int argc, const char **argv)
                  N_("Show information for a record in locking.tdb"),
                  N_("net tdb locking <key>")
                },
+               {
+                       "smbXsrv",
+                       net_tdb_smbXsrv,
+                       NET_TRANSPORT_LOCAL,
+                       N_("Manage smbXsrv databases"),
+                       N_("net tdb smbXsrv\n"
+                          "    Manage smbXsrv databases")
+               },
                {NULL, NULL, 0, NULL, NULL}
        };