]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:utils: Use libnetapi_set_creds() in net_dom
authorAndreas Schneider <asn@samba.org>
Thu, 25 Mar 2021 10:39:22 +0000 (11:39 +0100)
committerRalph Boehme <slow@samba.org>
Tue, 30 Mar 2021 05:48:37 +0000 (05:48 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/utils/net_dom.c

index 1e45c59220c014ab7cabbfce2a5f77eb0096efb5..25bf30736df0e382d8af8ce2f518825d2b067a99 100644 (file)
@@ -340,6 +340,7 @@ static int net_dom_renamecomputer(struct net_context *c, int argc, const char **
 int net_dom(struct net_context *c, int argc, const char **argv)
 {
        NET_API_STATUS status;
+       struct cli_credentials *creds = NULL;
 
        struct functable func[] = {
                {
@@ -374,15 +375,19 @@ int net_dom(struct net_context *c, int argc, const char **argv)
                {NULL, NULL, 0, NULL, NULL}
        };
 
+       creds = net_context_creds(c, c);
+       if (creds == NULL) {
+               return -1;
+       }
+
        status = libnetapi_net_init(&c->netapi_ctx);
        if (status != 0) {
                return -1;
        }
 
-       libnetapi_set_username(c->netapi_ctx, c->opt_user_name);
-       libnetapi_set_password(c->netapi_ctx, c->opt_password);
-       if (c->opt_kerberos) {
-               libnetapi_set_use_kerberos(c->netapi_ctx);
+       status = libnetapi_set_creds(c->netapi_ctx, creds);
+       if (status != 0) {
+               return -1;
        }
 
        return net_run_function(c, argc, argv, "net dom", func);