From: Ralph Boehme Date: Mon, 12 Mar 2018 18:54:37 +0000 (+0100) Subject: winbindd: add retry to _winbind_SendToSam X-Git-Tag: talloc-2.1.12~169 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c37fbfcb248e5a8d6088a28eb0c1a62423f94502;p=thirdparty%2Fsamba.git winbindd: add retry to _winbind_SendToSam Bug: https://bugzilla.samba.org/show_bug.cgi?id=13332 Signed-off-by: Ralph Boehme Reviewed-by: Volker Lendecke Autobuild-User(master): Ralph Böhme Autobuild-Date(master): Thu Mar 15 20:57:44 CET 2018 on sn-devel-144 --- diff --git a/source3/winbindd/winbindd_dual_srv.c b/source3/winbindd/winbindd_dual_srv.c index 20b919ca3b7..4cea73feaf9 100644 --- a/source3/winbindd/winbindd_dual_srv.c +++ b/source3/winbindd/winbindd_dual_srv.c @@ -1851,6 +1851,8 @@ NTSTATUS _winbind_SendToSam(struct pipes_struct *p, struct winbind_SendToSam *r) NTSTATUS status; struct rpc_pipe_client *netlogon_pipe; struct netlogon_creds_cli_context *netlogon_creds_ctx = NULL; + struct dcerpc_binding_handle *b = NULL; + bool retry = false; DEBUG(5, ("_winbind_SendToSam received\n")); domain = wb_child_domain(); @@ -1858,17 +1860,25 @@ NTSTATUS _winbind_SendToSam(struct pipes_struct *p, struct winbind_SendToSam *r) return NT_STATUS_REQUEST_NOT_ACCEPTED; } +reconnect: status = cm_connect_netlogon_secure(domain, &netlogon_pipe, &netlogon_creds_ctx); + reset_cm_connection_on_error(domain, NULL, status); if (!NT_STATUS_IS_OK(status)) { DEBUG(3, ("could not open handle to NETLOGON pipe\n")); return status; } + b = netlogon_pipe->binding_handle; + status = netlogon_creds_cli_SendToSam(netlogon_creds_ctx, - netlogon_pipe->binding_handle, + b, &r->in.message); + if (!retry && reset_cm_connection_on_error(domain, b, status)) { + retry = true; + goto reconnect; + } return status; }