mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Fix reporting of cert validation failures
If the server succesfully validates the client cert, it will send back a single byte, under TLS. If it fails, it will close the connection. In this case, we were just reporting the standard I/O error. The original RPC code had a special case hack for the GNUTLS_E_UNEXPECTED_PACKET_LENGTH error code to make us report a more useful error message * src/rpc/virnetclient.c: Return ENOMSG if we get GNUTLS_E_UNEXPECTED_PACKET_LENGTH * src/rpc/virnettlscontext.c: Report cert failure if we see ENOMSG
This commit is contained in:
parent
618b55220a
commit
f2845177e2
@ -348,7 +348,7 @@ int virNetClientSetTLSSession(virNetClientPtr client,
|
|||||||
ignore_value(pthread_sigmask(SIG_BLOCK, &oldmask, NULL));
|
ignore_value(pthread_sigmask(SIG_BLOCK, &oldmask, NULL));
|
||||||
|
|
||||||
len = virNetTLSSessionRead(client->tls, buf, 1);
|
len = virNetTLSSessionRead(client->tls, buf, 1);
|
||||||
if (len < 0) {
|
if (len < 0 && errno != ENOMSG) {
|
||||||
virReportSystemError(errno, "%s",
|
virReportSystemError(errno, "%s",
|
||||||
_("Unable to read TLS confirmation"));
|
_("Unable to read TLS confirmation"));
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -796,6 +796,9 @@ ssize_t virNetTLSSessionWrite(virNetTLSSessionPtr sess,
|
|||||||
case GNUTLS_E_INTERRUPTED:
|
case GNUTLS_E_INTERRUPTED:
|
||||||
errno = EINTR;
|
errno = EINTR;
|
||||||
break;
|
break;
|
||||||
|
case GNUTLS_E_UNEXPECTED_PACKET_LENGTH:
|
||||||
|
errno = ENOMSG;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
errno = EIO;
|
errno = EIO;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user