1
0
mirror of https://github.com/irssi/irssi.git synced 2024-11-03 04:27:19 -05:00

Kill do { ... } while (0); and replace it with goto's.

This commit is contained in:
Alexander Færøy 2016-10-21 17:56:29 +02:00
parent d501a54f4f
commit 0a6e66f8b7
No known key found for this signature in database
GPG Key ID: E15081D5D3C3DB53

View File

@ -776,34 +776,32 @@ int irssi_ssl_handshake(GIOChannel *handle)
ret = 1;
do {
if (pinned_cert_fingerprint != NULL && pinned_cert_fingerprint[0] != '\0') {
ret = g_ascii_strcasecmp(pinned_cert_fingerprint, tls->certificate_fingerprint) == 0;
if (pinned_cert_fingerprint != NULL && pinned_cert_fingerprint[0] != '\0') {
ret = g_ascii_strcasecmp(pinned_cert_fingerprint, tls->certificate_fingerprint) == 0;
if (! ret) {
g_warning(" Pinned certificate mismatch");
continue;
}
if (! ret) {
g_warning(" Pinned certificate mismatch");
goto done;
}
}
if (pinned_pubkey_fingerprint != NULL && pinned_pubkey_fingerprint[0] != '\0') {
ret = g_ascii_strcasecmp(pinned_pubkey_fingerprint, tls->public_key_fingerprint) == 0;
if (pinned_pubkey_fingerprint != NULL && pinned_pubkey_fingerprint[0] != '\0') {
ret = g_ascii_strcasecmp(pinned_pubkey_fingerprint, tls->public_key_fingerprint) == 0;
if (! ret) {
g_warning(" Pinned public key mismatch");
continue;
}
if (! ret) {
g_warning(" Pinned public key mismatch");
goto done;
}
}
if (chan->verify) {
ret = irssi_ssl_verify(chan->ssl, chan->ctx, chan->server->connrec->address, chan->port, cert, chan->server, tls);
if (chan->verify) {
ret = irssi_ssl_verify(chan->ssl, chan->ctx, chan->server->connrec->address, chan->port, cert, chan->server, tls);
if (! ret) {
// irssi_ssl_verify emits a warning itself.
continue;
}
if (! ret) {
// irssi_ssl_verify emits a warning itself.
goto done;
}
} while (0);
}
done:
tls_rec_free(tls);