Skip to content

Commit c956cf2

Browse files
zmb3github-actions
authored and
github-actions
committed
Work around go-ldap's lack of errors.Is support
This is hopefully a temporary change that can be removed when the upstream fix [1] is merged. [1] go-ldap/ldap#461
1 parent e5a9a0b commit c956cf2

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
@@ -526,8 +526,13 @@ func (s *WindowsService) initializeLDAP() error {
526526
s.ldapInitialized = false
527527

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

0 commit comments

Comments
 (0)