diff options
author | Alexander Færøy <ahf@0x90.dk> | 2016-10-21 17:56:29 +0200 |
---|---|---|
committer | Alexander Færøy <ahf@0x90.dk> | 2016-10-22 22:04:33 +0200 |
commit | 0a6e66f8b794de76bd48bda199977b977a377e2e (patch) | |
tree | 081d5fe6379900ef1d87e3ca84781dad64396415 /src | |
parent | d501a54f4f256d55ae0a3cd5272d5bb8a42daee3 (diff) | |
download | irssi-0a6e66f8b794de76bd48bda199977b977a377e2e.zip |
Kill do { ... } while (0); and replace it with goto's.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/network-openssl.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/src/core/network-openssl.c b/src/core/network-openssl.c index df84772c..7a1d6e34 100644 --- a/src/core/network-openssl.c +++ b/src/core/network-openssl.c @@ -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); |