s3-rpcclient: make netlogon credential setup also work for interdomain trusts.
authorGünther Deschner <gd@samba.org>
Thu, 10 Sep 2009 22:20:59 +0000 (00:20 +0200)
committerGünther Deschner <gd@samba.org>
Fri, 11 Sep 2009 07:59:05 +0000 (09:59 +0200)
Guenther

source3/rpcclient/rpcclient.c

index b0c27e24843207c2c1a0ea08297f5c7ed5fc21ff..c0268f348e667f0cb49711d8197c31138d69680b 100644 (file)
@@ -672,7 +672,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),
                                        &cmd_entry->rpc_pipe);
                                break;
                        default:
@@ -696,18 +696,20 @@ static NTSTATUS do_cmd(struct cli_state *cli,
                        uint32_t neg_flags = NETLOGON_NEG_AUTH2_ADS_FLAGS;
                        uint32 sec_channel_type;
                        uchar trust_password[16];
-       
-                       if (!secrets_fetch_trust_account_password(lp_workgroup(),
-                                                       trust_password,
-                                                       NULL, &sec_channel_type)) {
-                               return NT_STATUS_UNSUCCESSFUL;
+                       const char *machine_account;
+
+                       if (!get_trust_pw_hash(get_cmdline_auth_info_domain(auth_info),
+                                              trust_password, &machine_account,
+                                              &sec_channel_type))
+                       {
+                               return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
                        }
-               
+
                        ntresult = rpccli_netlogon_setup_creds(cmd_entry->rpc_pipe,
                                                cli->desthost,   /* server name */
-                                               lp_workgroup(),  /* domain */
+                                               get_cmdline_auth_info_domain(auth_info),  /* domain */
                                                global_myname(), /* client name */
-                                               global_myname(), /* machine account name */
+                                               machine_account, /* machine account name */
                                                trust_password,
                                                sec_channel_type,
                                                &neg_flags);