diff options
author | Günther Deschner <gd@samba.org> | 2009-09-10 22:56:05 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2009-09-11 09:59:05 +0200 |
commit | 12c70251568a0c8b30215e5453c3ea6194c3503c (patch) | |
tree | 2bf8f928bbb17d53e22ef78290c0ee1f27ef5a8a /source3 | |
parent | bea8e5fa6038d5abd2ec1e12f9005c4a04abb79f (diff) | |
download | samba-12c70251568a0c8b30215e5453c3ea6194c3503c.tar.gz samba-12c70251568a0c8b30215e5453c3ea6194c3503c.tar.bz2 samba-12c70251568a0c8b30215e5453c3ea6194c3503c.zip |
s3-rpcclient: avoid using lp_workgroup() unconditionally for crypto.
Guenther
Diffstat (limited to 'source3')
-rw-r--r-- | source3/rpcclient/rpcclient.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index 64adfa2d8e..b0c27e2484 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -652,7 +652,7 @@ static NTSTATUS do_cmd(struct cli_state *cli, cli, cmd_entry->interface, default_transport, pipe_default_auth_level, - lp_workgroup(), + get_cmdline_auth_info_domain(auth_info), get_cmdline_auth_info_username(auth_info), get_cmdline_auth_info_password(auth_info), &cmd_entry->rpc_pipe); @@ -662,7 +662,7 @@ static NTSTATUS do_cmd(struct cli_state *cli, cli, cmd_entry->interface, default_transport, pipe_default_auth_level, - lp_workgroup(), + get_cmdline_auth_info_domain(auth_info), get_cmdline_auth_info_username(auth_info), get_cmdline_auth_info_password(auth_info), &cmd_entry->rpc_pipe); @@ -828,6 +828,7 @@ out_free: uint32_t flags = 0; struct dcerpc_binding *binding = NULL; const char *binding_string = NULL; + char *user, *domain, *q; /* make sure the vars that get altered (4th field) are in a fixed location or certain compilers complain */ @@ -965,12 +966,24 @@ out_free: CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS; } + user = talloc_strdup(frame, get_cmdline_auth_info_username(rpcclient_auth_info)); + SMB_ASSERT(user != NULL); + domain = talloc_strdup(frame, lp_workgroup()); + SMB_ASSERT(domain != NULL); + set_cmdline_auth_info_domain(rpcclient_auth_info, domain); + + if ((q = strchr_m(user,'\\'))) { + *q = 0; + set_cmdline_auth_info_domain(rpcclient_auth_info, user); + set_cmdline_auth_info_username(rpcclient_auth_info, q+1); + } + nt_status = cli_full_connection(&cli, global_myname(), binding->host, opt_ipaddr ? &server_ss : NULL, opt_port, "IPC$", "IPC", get_cmdline_auth_info_username(rpcclient_auth_info), - lp_workgroup(), + get_cmdline_auth_info_domain(rpcclient_auth_info), get_cmdline_auth_info_password(rpcclient_auth_info), flags, get_cmdline_auth_info_signing_state(rpcclient_auth_info), @@ -986,7 +999,7 @@ out_free: nt_status = cli_cm_force_encryption(cli, get_cmdline_auth_info_username(rpcclient_auth_info), get_cmdline_auth_info_password(rpcclient_auth_info), - lp_workgroup(), + get_cmdline_auth_info_domain(rpcclient_auth_info), "IPC$"); if (!NT_STATUS_IS_OK(nt_status)) { result = 1; |