]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:trusts_util: pass dcname to trust_pw_change()
authorStefan Metzmacher <metze@samba.org>
Mon, 22 May 2017 13:36:29 +0000 (15:36 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 13 Jul 2017 08:51:19 +0000 (10:51 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12782

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 1421abfc733247a6b71eefd819dfeae7151a6d78)

source3/include/proto.h
source3/libsmb/trusts_util.c
source3/rpcclient/cmd_netlogon.c
source3/utils/net_rpc.c
source3/winbindd/winbindd_dual.c
source3/winbindd/winbindd_dual_srv.c

index 25f43f51308ed6cced3d53012f3e9fb5f0ca42fb..97be40b2ad0a857d6bd0df9056e96e2f396b286d 100644 (file)
@@ -887,6 +887,7 @@ NTSTATUS trust_pw_change(struct netlogon_creds_cli_context *context,
                         struct messaging_context *msg_ctx,
                         struct dcerpc_binding_handle *b,
                         const char *domain,
+                        const char *dcname,
                         bool force);
 
 /* The following definitions come from param/loadparm.c  */
index 2cc6264c905d30c8b4844fb16a978de800657e10..47b79b7336955dca1e3d52fce4de74bb09a827ff 100644 (file)
@@ -107,6 +107,7 @@ NTSTATUS trust_pw_change(struct netlogon_creds_cli_context *context,
                         struct messaging_context *msg_ctx,
                         struct dcerpc_binding_handle *b,
                         const char *domain,
+                        const char *dcname,
                         bool force)
 {
        TALLOC_CTX *frame = talloc_stackframe();
index 744361c4a478beab96d5673f0fee6fed9b2f0ae9..77f5885cd2dda6c31947e5c1d097d3405c71e58d 100644 (file)
@@ -831,6 +831,7 @@ static NTSTATUS cmd_netlogon_change_trust_pw(struct rpc_pipe_client *cli,
                                             const char **argv)
 {
         NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
+       const char *dcname = cli->desthost;
 
         /* Check arguments */
 
@@ -843,6 +844,7 @@ static NTSTATUS cmd_netlogon_change_trust_pw(struct rpc_pipe_client *cli,
                                 rpcclient_msg_ctx,
                                 cli->binding_handle,
                                 lp_workgroup(),
+                                dcname,
                                 true); /* force */
        if (!NT_STATUS_IS_OK(result))
                goto done;
index 3ed376b8b5549fd6ca9480960d7850868f36fd76..86825ba601e987474ea2db254896b3a208e89d17 100644 (file)
@@ -279,11 +279,19 @@ static NTSTATUS rpc_changetrustpw_internals(struct net_context *c,
                                        const char **argv)
 {
        NTSTATUS status;
+       const char *dcname = NULL;
+
+       if (cli == NULL) {
+               return NT_STATUS_INTERNAL_ERROR;
+       }
+
+       dcname = smbXcli_conn_remote_name(cli->conn);
 
        status = trust_pw_change(c->netlogon_creds,
                                 c->msg_ctx,
                                 pipe_hnd->binding_handle,
                                 c->opt_target_workgroup,
+                                dcname,
                                 true); /* force */
        if (!NT_STATUS_IS_OK(status)) {
                d_fprintf(stderr, _("Failed to change machine account password: %s\n"),
index c16b94e2be3459189be989939a5d01f5c1782839..ab0aae98b27afa15300b607e73cc1c1afc1a0650 100644 (file)
@@ -1097,6 +1097,7 @@ static void machine_password_change_handler(struct tevent_context *ctx,
                                 msg_ctx,
                                 netlogon_pipe->binding_handle,
                                 child->domain->name,
+                                child->domain->dcname,
                                 false); /* force */
 
        DEBUG(10, ("machine_password_change_handler: "
index b386d7513d0af64cd1973ce27fdf1d214f75293f..371b2bf321c26c270f7d1e8d50dedd37acd9cfcf 100644 (file)
@@ -718,6 +718,7 @@ NTSTATUS _wbint_ChangeMachineAccount(struct pipes_struct *p,
                                 msg_ctx,
                                 netlogon_pipe->binding_handle,
                                 domain->name,
+                                domain->dcname,
                                 true); /* force */
 
        /* Pass back result code - zero for success, other values for
@@ -1394,6 +1395,7 @@ reconnect:
 
        status = trust_pw_change(domain->conn.netlogon_creds,
                                 msg_ctx, b, domain->name,
+                                domain->dcname,
                                 true); /* force */
        if (!NT_STATUS_IS_OK(status)) {
                if (!retry && dcerpc_binding_handle_is_connected(b)) {