From ccfb682f666acd4e2baaed5598d0e1ac37b0156e Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 24 Mar 2021 14:37:26 +0100 Subject: [PATCH] s3:utils: Use libnetapi_set_creds() in net_rpc_shell Signed-off-by: Andreas Schneider Reviewed-by: Ralph Boehme --- source3/utils/net_rpc_shell.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/source3/utils/net_rpc_shell.c b/source3/utils/net_rpc_shell.c index 2569bb06869..ab7df7ef463 100644 --- a/source3/utils/net_rpc_shell.c +++ b/source3/utils/net_rpc_shell.c @@ -222,19 +222,26 @@ int net_rpc_shell(struct net_context *c, int argc, const char **argv) NTSTATUS status; struct rpc_sh_ctx *ctx; struct dom_sid_buf buf; + struct cli_credentials *creds = NULL; + NET_API_STATUS net_api_status; if (argc != 0 || c->display_usage) { d_printf("%s\nnet rpc shell\n", _("Usage:")); return -1; } + creds = net_context_creds(c, c); + if (creds == NULL) { + return -1; + } + if (libnetapi_net_init(&c->netapi_ctx) != 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); + + net_api_status = libnetapi_set_creds(c->netapi_ctx, creds); + if (net_api_status != 0) { + return -1; } ctx = talloc(NULL, struct rpc_sh_ctx);