winbind: Retry after SESSION_EXPIRED error in ping-dc
authorChristof Schmitt <cs@samba.org>
Fri, 19 Dec 2014 19:24:53 +0000 (12:24 -0700)
committerJeremy Allison <jra@samba.org>
Tue, 6 Jan 2015 01:58:57 +0000 (02:58 +0100)
Trying to establish a netlogon connection when the service ticket
expires might fail with NT_STATUS_NETWORK_SESSION_EXPIRED. The
underlying client code already marks the session as invalid, so retry
the netlogon connect in this case.

Signed-off-by: Christof Schmit <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jan  6 02:58:57 CET 2015 on sn-devel-104

source3/winbindd/winbindd_dual_srv.c

index 22e709fda90a2b672515e4d083751bb93faf3749..061de7299ad5799877366063d2b0e80de5502257 100644 (file)
@@ -677,6 +677,14 @@ NTSTATUS _wbint_PingDc(struct pipes_struct *p, struct wbint_PingDc *r)
 
 reconnect:
        status = cm_connect_netlogon(domain, &netlogon_pipe);
+       if (NT_STATUS_EQUAL(status, NT_STATUS_NETWORK_SESSION_EXPIRED)) {
+               /*
+                * Retry to open new connection with new kerberos ticket.
+                */
+               invalidate_cm_connection(domain);
+               status = cm_connect_netlogon(domain, &netlogon_pipe);
+       }
+
        reset_cm_connection_on_error(domain, status);
         if (!NT_STATUS_IS_OK(status)) {
                DEBUG(3, ("could not open handle to NETLOGON pipe: %s\n",