Skip to content

Commit

Permalink
Work around go-ldap's lack of errors.Is support
Browse files Browse the repository at this point in the history
This is hopefully a temporary change that can be removed when
the upstream fix [1] is merged.

[1] go-ldap/ldap#461
  • Loading branch information
zmb3 authored and github-actions committed Aug 16, 2023
1 parent e5a9a0b commit c956cf2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/srv/desktop/windows_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,13 @@ func (s *WindowsService) initializeLDAP() error {
s.ldapInitialized = false

// failures due to timeouts might be transient, so retry more frequently
//
// TODO(zmb3): errors.Is does not work properly on ldap.Error
// (remove the extra errors.As() check when https://github.com/go-ldap/ldap/pull/461 merges)
retryAfter := windowsDesktopServiceCertRetryInterval
if errors.Is(err, context.DeadlineExceeded) {
var ldapErr *ldap.Error
if errors.Is(err, context.DeadlineExceeded) ||
(errors.As(err, &ldapErr) && errors.Is(ldapErr.Err, context.DeadlineExceeded)) {
retryAfter = ldapTimeoutRetryInterval
}

Expand Down

0 comments on commit c956cf2

Please sign in to comment.