winbindd: add retry to _winbind_DsrUpdateReadOnlyServerDnsRecords
authorRalph Boehme <slow@samba.org>
Mon, 12 Mar 2018 18:53:53 +0000 (19:53 +0100)
committerRalph Boehme <slow@samba.org>
Thu, 15 Mar 2018 14:46:10 +0000 (15:46 +0100)
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13332

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/winbindd/winbindd_dual_srv.c

index 1acba3a29e38dd9c7e74f8317fe32becc8048510..20b919ca3b79ce56fc66dd6e884031004ca59768 100644 (file)
@@ -858,12 +858,15 @@ NTSTATUS _winbind_DsrUpdateReadOnlyServerDnsRecords(struct pipes_struct *p,
        NTSTATUS status;
        struct rpc_pipe_client *netlogon_pipe = NULL;
        struct netlogon_creds_cli_context *netlogon_creds_ctx = NULL;
+       struct dcerpc_binding_handle *b = NULL;
+       bool retry = false;
 
        domain = wb_child_domain();
        if (domain == NULL) {
                return NT_STATUS_REQUEST_NOT_ACCEPTED;
        }
 
+reconnect:
        status = cm_connect_netlogon_secure(domain,
                                            &netlogon_pipe,
                                            &netlogon_creds_ctx);
@@ -872,12 +875,19 @@ NTSTATUS _winbind_DsrUpdateReadOnlyServerDnsRecords(struct pipes_struct *p,
                goto done;
        }
 
+       b = netlogon_pipe->binding_handle;
+
        status = netlogon_creds_cli_DsrUpdateReadOnlyServerDnsRecords(netlogon_creds_ctx,
                                                                      netlogon_pipe->binding_handle,
                                                                      r->in.site_name,
                                                                      r->in.dns_ttl,
                                                                      r->in.dns_names);
 
+       if (!retry && reset_cm_connection_on_error(domain, b, status)) {
+               retry = true;
+               goto reconnect;
+       }
+
        /* Pass back result code - zero for success, other values for
           specific failures. */