s3:net: make use of cli_rpc_pipe_open_with_creds() by using net_context_creds()
authorStefan Metzmacher <metze@samba.org>
Mon, 11 Nov 2019 12:58:37 +0000 (13:58 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 28 May 2020 06:43:37 +0000 (06:43 +0000)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/utils/net_rpc.c

index 17f751284ab77630a6b17fa45e56d90a230609b8..d59522e29caf808d71f68299ea8e8cdbd3ab8dc4 100644 (file)
@@ -206,15 +206,23 @@ int run_rpc_command(struct net_context *c,
                        }
                } else {
                        if (conn_flags & NET_FLAGS_SEAL) {
-                               nt_status = cli_rpc_pipe_open_generic_auth(
+                               struct cli_credentials *creds = NULL;
+
+                               creds = net_context_creds(c, mem_ctx);
+                               if (creds == NULL) {
+                                       DBG_ERR("net_rpc_ntlm_creds() failed\n");
+                                       nt_status = NT_STATUS_INTERNAL_ERROR;
+                                       goto fail;
+                               }
+
+                               nt_status = cli_rpc_pipe_open_with_creds(
                                        cli, table,
                                        (conn_flags & NET_FLAGS_TCP) ?
                                        NCACN_IP_TCP : NCACN_NP,
                                        DCERPC_AUTH_TYPE_NTLMSSP,
                                        DCERPC_AUTH_LEVEL_PRIVACY,
                                        smbXcli_conn_remote_name(cli->conn),
-                                       lp_workgroup(), c->opt_user_name,
-                                       c->opt_password, &pipe_hnd);
+                                       creds, &pipe_hnd);
                        } else {
                                nt_status = cli_rpc_pipe_open_noauth(
                                        cli, table,