Use rpccli_netr_ServerPasswordSet in "just_change_the_password()".
authorGünther Deschner <gd@samba.org>
Sat, 16 Feb 2008 15:04:01 +0000 (16:04 +0100)
committerGünther Deschner <gd@samba.org>
Sat, 16 Feb 2008 15:04:01 +0000 (16:04 +0100)
Guenther

source/libsmb/trusts_util.c

index 11f691bee611dfc50e0579319327ffdc581c6b11..1e92bf21de8f40bbce5eb71f50a4172128a379b7 100644 (file)
@@ -58,7 +58,32 @@ static NTSTATUS just_change_the_password(struct rpc_pipe_client *cli, TALLOC_CTX
                }
        }
 
-       result = rpccli_net_srv_pwset(cli, mem_ctx, global_myname(), new_trust_passwd_hash);
+       {
+               struct netr_Authenticator clnt_creds, srv_cred;
+               struct samr_Password new_password;
+
+               netlogon_creds_client_step(cli->dc, &clnt_creds);
+
+               cred_hash3(new_password.hash,
+                          new_trust_passwd_hash,
+                          cli->dc->sess_key, 1);
+
+               result = rpccli_netr_ServerPasswordSet(cli, mem_ctx,
+                                                      cli->dc->remote_machine,
+                                                      cli->dc->mach_acct,
+                                                      sec_channel_type,
+                                                      global_myname(),
+                                                      &clnt_creds,
+                                                      &srv_cred,
+                                                      &new_password);
+
+               /* Always check returned credentials. */
+               if (!netlogon_creds_client_check(cli->dc, &srv_cred.cred)) {
+                       DEBUG(0,("rpccli_netr_ServerPasswordSet: "
+                               "credentials chain check failed\n"));
+                       return NT_STATUS_ACCESS_DENIED;
+               }
+       }
 
        if (!NT_STATUS_IS_OK(result)) {
                DEBUG(0,("just_change_the_password: unable to change password (%s)!\n",