From: Stefan Metzmacher Date: Mon, 11 Nov 2019 14:38:24 +0000 (+0100) Subject: s3:libnet_join: call cli_session_creds_init() directly X-Git-Tag: ldb-2.2.0~298 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b610549d5d950643d136f1864454b3bc666ca0d3;p=thirdparty%2Fsamba.git s3:libnet_join: call cli_session_creds_init() directly Signed-off-by: Stefan Metzmacher Reviewed-by: Andreas Schneider --- diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index fa3a91f1121..9fdc18c4994 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -1057,25 +1057,47 @@ static NTSTATUS libnet_join_connect_dc_ipc(const char *dc, bool use_kerberos, struct cli_state **cli) { + TALLOC_CTX *frame = talloc_stackframe(); + bool fallback_after_kerberos = false; + bool use_ccache = false; + bool pw_nt_hash = false; + struct cli_credentials *creds = NULL; int flags = 0; + NTSTATUS status; - if (use_kerberos) { - flags |= CLI_FULL_CONNECTION_USE_KERBEROS; + if (use_kerberos && pass) { + fallback_after_kerberos = true; + } + + creds = cli_session_creds_init(frame, + user, + domain, + NULL, /* realm (use default) */ + pass, + use_kerberos, + fallback_after_kerberos, + use_ccache, + pw_nt_hash); + if (creds == NULL) { + TALLOC_FREE(frame); + return NT_STATUS_NO_MEMORY; } - if (use_kerberos && pass) { - flags |= CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS; - } - - return cli_full_connection(cli, NULL, - dc, - NULL, 0, - "IPC$", "IPC", - user, - domain, - pass, - flags, - SMB_SIGNING_IPC_DEFAULT); + status = cli_full_connection_creds(cli, + NULL, + dc, + NULL, 0, + "IPC$", "IPC", + creds, + flags, + SMB_SIGNING_IPC_DEFAULT); + if (!NT_STATUS_IS_OK(status)) { + TALLOC_FREE(frame); + return status; + } + + TALLOC_FREE(frame); + return NT_STATUS_OK; } /****************************************************************