From 4d8836ab96889bcdc35e86bedffa6117f9c35095 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 5 May 2008 16:58:24 +0200 Subject: Fix client authentication with -P switch in client tools (Bug 5435). Guenther (This used to be commit d077ef64cd1d9bbaeb936566c2c70da508de829f) --- source3/rpcclient/rpcclient.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'source3/rpcclient') diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index 10a1741207..c4be970ac3 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -736,6 +736,7 @@ out_free: fstring new_workgroup; int result = 0; TALLOC_CTX *frame = talloc_stackframe(); + uint32_t flags = 0; /* make sure the vars that get altered (4th field) are in a fixed location or certain compilers complain */ @@ -827,6 +828,12 @@ out_free: * from stdin if necessary */ + if (get_cmdline_auth_info_use_machine_account() && + !set_cmdline_auth_info_machine_account_creds()) { + result = 1; + goto done; + } + if (!get_cmdline_auth_info_got_pass()) { char *pass = getpass("Password:"); if (pass) { @@ -839,13 +846,19 @@ out_free: server += 2; } + if (get_cmdline_auth_info_use_kerberos()) { + flags |= CLI_FULL_CONNECTION_USE_KERBEROS | + CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS; + } + + nt_status = cli_full_connection(&cli, global_myname(), server, opt_ipaddr ? &server_ss : NULL, opt_port, "IPC$", "IPC", get_cmdline_auth_info_username(), lp_workgroup(), get_cmdline_auth_info_password(), - get_cmdline_auth_info_use_kerberos() ? CLI_FULL_CONNECTION_USE_KERBEROS : 0, + flags, get_cmdline_auth_info_signing_state(),NULL); if (!NT_STATUS_IS_OK(nt_status)) { -- cgit