From: Andreas Schneider Date: Thu, 25 Mar 2021 10:39:22 +0000 (+0100) Subject: s3:utils: Use libnetapi_set_creds() in net_dom X-Git-Tag: tevent-0.11.0~1348 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2bfe37e069fd267ced946d63cf97dc20fbb34f49;p=thirdparty%2Fsamba.git s3:utils: Use libnetapi_set_creds() in net_dom Signed-off-by: Andreas Schneider Reviewed-by: Ralph Boehme --- diff --git a/source3/utils/net_dom.c b/source3/utils/net_dom.c index 1e45c59220c..25bf30736df 100644 --- a/source3/utils/net_dom.c +++ b/source3/utils/net_dom.c @@ -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);