Schannel: change UNREACHABLE into error-handling

Because it happens in some (unknown precondition) cases.

While it would be nice to know what the client is doing to trigger this,
it's not worth crashing over in the meantime.

Fixes: QTBUG-118458
Pick-to: 6.6 6.5 6.2
Change-Id: I261a17578e7cd3a95e591a3228b33561000fd336
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
bb10
Mårten Nordheim 2023-10-23 13:28:25 +02:00
parent cc4834c0b9
commit 668ce80e9e
1 changed files with 6 additions and 2 deletions

View File

@ -1916,8 +1916,12 @@ void TlsCryptographSchannel::transmit()
qCWarning(lcTlsBackendSchannel, "The internal SSPI handle is invalid!");
Q_UNREACHABLE();
} else if (status == SEC_E_INVALID_TOKEN) {
qCWarning(lcTlsBackendSchannel, "Got SEC_E_INVALID_TOKEN!");
Q_UNREACHABLE(); // Happened once due to a bug, but shouldn't generally happen(?)
// Supposedly we have an invalid token, it's under-documented what
// this means, so to be safe we disconnect.
shutdown = true;
disconnectFromHost();
setErrorAndEmit(d, QAbstractSocket::SslInternalError, schannelErrorToString(status));
break;
} else if (status == SEC_E_MESSAGE_ALTERED) {
// The message has been altered, disconnect now.
shutdown = true; // skips sending the shutdown alert