s3:net: finally remove net_context->opt_{user_specified,user_name,password}
authorStefan Metzmacher <metze@samba.org>
Thu, 7 Mar 2024 13:56:45 +0000 (14:56 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 14 May 2024 10:18:31 +0000 (10:18 +0000)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/utils/net.c
source3/utils/net.h
source3/utils/net_util.c
source3/utils/py_net.c

index 126dc324028f7072d5fc30058dcdef71df79fbe4..cc31bb53d09a969346ef6268aaf1891e0821c439 100644 (file)
@@ -1373,8 +1373,6 @@ static struct functable net_func[] = {
                        cli_credentials_get_principal_obtained(c->creds);
                enum credentials_obtained password_obtained =
                        cli_credentials_get_password_obtained(c->creds);
-               enum credentials_obtained username_obtained =
-                       CRED_UNINITIALISED;
                uint32_t gensec_features;
 
                if (principal_obtained == CRED_SPECIFIED) {
@@ -1384,11 +1382,6 @@ static struct functable net_func[] = {
                        c->explicit_credentials = true;
                }
 
-               c->opt_user_name = cli_credentials_get_username_and_obtained(
-                               c->creds,
-                               &username_obtained);
-               c->opt_user_specified = (username_obtained == CRED_SPECIFIED);
-
                c->opt_workgroup = cli_credentials_get_domain(c->creds);
 
                gensec_features = cli_credentials_get_gensec_features(c->creds);
index 36660664aa0d595f825de37801433c3bfca4542b..8540a6db9d4b94eb8b99b407daf8ceba07ee89b5 100644 (file)
@@ -42,9 +42,6 @@ struct cli_state;
 struct net_context {
        const char *opt_requester_name;
        const char *opt_host;
-       const char *opt_password;
-       const char *opt_user_name;
-       bool opt_user_specified;
        bool explicit_credentials;
        const char *opt_workgroup;
        int opt_long_list_entries;
index 1168983e0b47255b67149392988cf33ec5866de8..93e08cafbf11f3f1f6654ddb02cd87f4f3a90b83 100644 (file)
@@ -259,21 +259,11 @@ NTSTATUS connect_dst_pipe(struct net_context *c, struct cli_state **cli_dst,
 
 int net_use_krb_machine_account(struct net_context *c)
 {
-       char *user_name = NULL;
-
        if (!secrets_init()) {
                d_fprintf(stderr,_("ERROR: Unable to open secrets database\n"));
                exit(1);
        }
 
-       c->opt_password = secrets_fetch_machine_password(
-                               c->opt_target_workgroup, NULL, NULL);
-       if (asprintf(&user_name, "%s$@%s", lp_netbios_name(), lp_realm()) == -1) {
-               return -1;
-       }
-       c->opt_user_name = user_name;
-       c->opt_user_specified = true;
-
        cli_credentials_set_machine_account(c->creds, c->lp_ctx);
        c->explicit_credentials = true;
        return 0;
index 61b549bd9a1271f27a42671453a27f1aa5ca828d..95cc59f33b485acaf5daf39b06afd91fe6f2197d 100644 (file)
@@ -128,8 +128,6 @@ static PyObject *py_net_join_member(py_net_Object *self, PyObject *args, PyObjec
 
        c->creds = self->creds;
        c->explicit_credentials = true;
-       c->opt_user_name = cli_credentials_get_username(self->creds);
-       c->opt_password = cli_credentials_get_password(self->creds);
 
        werr = libnet_Join(mem_ctx, r);
        if (W_ERROR_EQUAL(werr, WERR_NERR_DCNOTFOUND)) {