Skip to content

Commit 6f5cfe2

Browse files
authored
Work around go-ldap's lack of errors.Is support (#30555)
This is hopefully a temporary change that can be removed when the upstream fix [1] is merged. [1] go-ldap/ldap#461
1 parent 8b6f9fd commit 6f5cfe2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/srv/desktop/windows_server.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -494,8 +494,13 @@ func (s *WindowsService) initializeLDAP() error {
494494
s.ldapInitialized = false
495495

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

0 commit comments

Comments
 (0)