]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:utils: Use libnetapi_set_creds() in net_rpc_shell
authorAndreas Schneider <asn@samba.org>
Wed, 24 Mar 2021 13:37:26 +0000 (14:37 +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_rpc_shell.c

index 2569bb068693f95b810cb8041904984f91f8fd8f..ab7df7ef46362e7be02f89d6ab3d3f5888f43218 100644 (file)
@@ -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);