]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:utils: Remove from "net ads keytab": "add", "delete" and "add_update_ads"
authorPavel Filipenský <pfilipensky@samba.org>
Thu, 15 Feb 2024 09:58:13 +0000 (10:58 +0100)
committerPavel Filipensky <pfilipensky@samba.org>
Fri, 26 Jul 2024 17:12:36 +0000 (17:12 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=6750

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/utils/net_ads.c

index ec938fb76799a5d1b121b3bb9ee0bb79d151dcd7..577834d96b5c09de4f9b093ca95fbe8ff09f1c90 100644 (file)
@@ -2933,105 +2933,6 @@ out:
        return ret;
 }
 
-static int net_ads_keytab_add(struct net_context *c,
-                             int argc,
-                             const char **argv,
-                             bool update_ads)
-{
-       TALLOC_CTX *tmp_ctx = talloc_stackframe();
-       ADS_STRUCT *ads = NULL;
-       ADS_STATUS status;
-       int i;
-       int ret = -1;
-
-       if (c->display_usage) {
-               d_printf("%s\n%s",
-                        _("Usage:"),
-                        _("net ads keytab add <principal> [principal ...]\n"
-                          "  Add principals to local keytab\n"
-                          "    principal\tKerberos principal to add to "
-                          "keytab\n"));
-               TALLOC_FREE(tmp_ctx);
-               return -1;
-       }
-
-       net_warn_member_options();
-
-       d_printf(_("Processing principals to add...\n"));
-
-       if (!c->explicit_credentials) {
-               net_use_krb_machine_account(c);
-       }
-
-       status = ads_startup(c, true, tmp_ctx, &ads);
-       if (!ADS_ERR_OK(status)) {
-               goto out;
-       }
-
-       for (ret = 0, i = 0; i < argc; i++) {
-               ret |= ads_keytab_add_entry(ads, argv[i], update_ads);
-       }
-out:
-       TALLOC_FREE(tmp_ctx);
-       return ret;
-}
-
-static int net_ads_keytab_add_default(struct net_context *c,
-                                     int argc,
-                                     const char **argv)
-{
-       return net_ads_keytab_add(c, argc, argv, false);
-}
-
-static int net_ads_keytab_add_update_ads(struct net_context *c,
-                                        int argc,
-                                        const char **argv)
-{
-       return net_ads_keytab_add(c, argc, argv, true);
-}
-
-static int net_ads_keytab_delete(struct net_context *c,
-                                int argc,
-                                const char **argv)
-{
-       TALLOC_CTX *tmp_ctx = talloc_stackframe();
-       ADS_STRUCT *ads = NULL;
-       ADS_STATUS status;
-       int i;
-       int ret = -1;
-
-       if (c->display_usage) {
-               d_printf("%s\n%s",
-                        _("Usage:"),
-                        _("net ads keytab delete <principal> [principal ...]\n"
-                          "  Remove entries for service principal, "
-                          "  from the keytab file only."
-                          "  Remove principals from local keytab\n"
-                          "    principal\tKerberos principal to remove from "
-                          "keytab\n"));
-               TALLOC_FREE(tmp_ctx);
-               return -1;
-       }
-
-       d_printf(_("Processing principals to delete...\n"));
-
-       if (!c->explicit_credentials) {
-               net_use_krb_machine_account(c);
-       }
-
-       status = ads_startup(c, true, tmp_ctx, &ads);
-       if (!ADS_ERR_OK(status)) {
-               goto out;
-       }
-
-       for (ret = 0, i = 0; i < argc; i++) {
-               ret |= ads_keytab_delete_entry(ads, argv[i]);
-       }
-out:
-       TALLOC_FREE(tmp_ctx);
-       return ret;
-}
-
 static int net_ads_keytab_create(struct net_context *c, int argc, const char **argv)
 {
        TALLOC_CTX *tmp_ctx = talloc_stackframe();
@@ -3091,30 +2992,6 @@ static int net_ads_keytab_list(struct net_context *c, int argc, const char **arg
 int net_ads_keytab(struct net_context *c, int argc, const char **argv)
 {
        struct functable func[] = {
-               {
-                       "add",
-                       net_ads_keytab_add_default,
-                       NET_TRANSPORT_ADS,
-                       N_("Add a service principal"),
-                       N_("net ads keytab add\n"
-                          "    Add a service principal, updates keytab file only.")
-               },
-               {
-                       "delete",
-                       net_ads_keytab_delete,
-                       NET_TRANSPORT_ADS,
-                       N_("Delete a service principal"),
-                       N_("net ads keytab delete\n"
-                          "    Remove entries for service principal, from the keytab file only.")
-               },
-               {
-                       "add_update_ads",
-                       net_ads_keytab_add_update_ads,
-                       NET_TRANSPORT_ADS,
-                       N_("Add a service principal"),
-                       N_("net ads keytab add_update_ads\n"
-                          "    Add a service principal, depending on the param passed may update ADS computer object in addition to the keytab file.")
-               },
                {
                        "create",
                        net_ads_keytab_create,