Skip to content

Commit

Permalink
fix: Avoid tsh panic on Windows Server 2019
Browse files Browse the repository at this point in the history
  • Loading branch information
codingllama authored and github-actions committed Feb 21, 2024
1 parent c2cb76a commit 7184eeb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/auth/webauthnwin/webauthn_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ func newNativeImpl() *nativeImpl {
Debug("WebAuthnWin: failed to load WebAuthn.dll (it's likely missing)")
return n
}
// Load WebAuthNGetApiVersionNumber explicitly too, it avoids a panic on some
// Windows Server 2019 installs.
if err := procWebAuthNGetApiVersionNumber.Find(); err != nil {
log.
WithError(err).
Debug("WebAuthnWin: failed to load WebAuthNGetApiVersionNumber")
return n
}

v, err := webAuthNGetApiVersionNumber()
if err != nil {
Expand All @@ -66,6 +74,10 @@ func newNativeImpl() *nativeImpl {
n.webauthnAPIVersion = v
n.isAvailable = v > 0

if !n.isAvailable {
return n
}

n.hasPlatformUV, err = isUVPlatformAuthenticatorAvailable()
if err != nil {
// This should not happen if dll exists, however we are fine with
Expand Down

0 comments on commit 7184eeb

Please sign in to comment.