From c1d6f18d1999add7df9bd5cc3bce44be4fb93007 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 22 May 2017 15:36:29 +0200 Subject: [PATCH] s3:trusts_util: pass dcname to trust_pw_change() BUG: https://bugzilla.samba.org/show_bug.cgi?id=12782 Signed-off-by: Stefan Metzmacher Reviewed-by: Andreas Schneider (cherry picked from commit 1421abfc733247a6b71eefd819dfeae7151a6d78) --- source3/include/proto.h | 1 + source3/libsmb/trusts_util.c | 1 + source3/rpcclient/cmd_netlogon.c | 2 ++ source3/utils/net_rpc.c | 8 ++++++++ source3/winbindd/winbindd_dual.c | 1 + source3/winbindd/winbindd_dual_srv.c | 2 ++ 6 files changed, 15 insertions(+) diff --git a/source3/include/proto.h b/source3/include/proto.h index 25f43f51308..97be40b2ad0 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -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 */ diff --git a/source3/libsmb/trusts_util.c b/source3/libsmb/trusts_util.c index 2cc6264c905..47b79b73369 100644 --- a/source3/libsmb/trusts_util.c +++ b/source3/libsmb/trusts_util.c @@ -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(); diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c index 744361c4a47..77f5885cd2d 100644 --- a/source3/rpcclient/cmd_netlogon.c +++ b/source3/rpcclient/cmd_netlogon.c @@ -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; diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index 3ed376b8b55..86825ba601e 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -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"), diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c index c16b94e2be3..ab0aae98b27 100644 --- a/source3/winbindd/winbindd_dual.c +++ b/source3/winbindd/winbindd_dual.c @@ -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: " diff --git a/source3/winbindd/winbindd_dual_srv.c b/source3/winbindd/winbindd_dual_srv.c index b386d7513d0..371b2bf321c 100644 --- a/source3/winbindd/winbindd_dual_srv.c +++ b/source3/winbindd/winbindd_dual_srv.c @@ -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)) { -- 2.47.2