From: Ralph Boehme Date: Sun, 29 Jun 2025 16:04:41 +0000 (+0200) Subject: net: add `net tdb smbXsrv wipedbs` alias for `net serverid wipedbs` X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b954ccbaab39f7ce3223eb6a28b0e9fde67d007;p=thirdparty%2Fsamba.git net: add `net tdb smbXsrv wipedbs` alias for `net serverid wipedbs` `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 Reviewed-by: Stefan Metzmacher --- diff --git a/source3/utils/net_proto.h b/source3/utils/net_proto.h index baca8575585..9370ebdbc67 100644 --- a/source3/utils/net_proto.h +++ b/source3/utils/net_proto.h @@ -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, diff --git a/source3/utils/net_serverid.c b/source3/utils/net_serverid.c index e704829d645..07d784f310f 100644 --- a/source3/utils/net_serverid.c +++ b/source3/utils/net_serverid.c @@ -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; diff --git a/source3/utils/net_tdb.c b/source3/utils/net_tdb.c index 29585eb7182..7fcdf3f04e9 100644 --- a/source3/utils/net_tdb.c +++ b/source3/utils/net_tdb.c @@ -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 ") }, + { + "smbXsrv", + net_tdb_smbXsrv, + NET_TRANSPORT_LOCAL, + N_("Manage smbXsrv databases"), + N_("net tdb smbXsrv\n" + " Manage smbXsrv databases") + }, {NULL, NULL, 0, NULL, NULL} };