diff options
author | Alexander Færøy <ahf@irssi.org> | 2010-07-28 16:15:02 +0000 |
---|---|---|
committer | ahf <ahf@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2010-07-28 16:15:02 +0000 |
commit | 4976f7529539d76f04eef00f8b8108c81940d627 (patch) | |
tree | 3129d0290a6320a86aeeec93aad96f430f88c3e6 /src | |
parent | 350b346c844a2b10b27c64b0a65f83e72d224f89 (diff) | |
download | irssi-4976f7529539d76f04eef00f8b8108c81940d627.zip |
Fix indention.
git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@5186 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r-- | src/core/network-openssl.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/src/core/network-openssl.c b/src/core/network-openssl.c index 3191a1bd..eaa51a13 100644 --- a/src/core/network-openssl.c +++ b/src/core/network-openssl.c @@ -97,28 +97,28 @@ static char *tls_text_name(X509_NAME *name, int nid) if (name == 0 || (pos = X509_NAME_get_index_by_NID(name, nid, -1)) < 0) { return NULL; - } + } - entry = X509_NAME_get_entry(name, pos); - g_return_val_if_fail(entry != NULL, NULL); - entry_str = X509_NAME_ENTRY_get_data(entry); - g_return_val_if_fail(entry_str != NULL, NULL); + entry = X509_NAME_get_entry(name, pos); + g_return_val_if_fail(entry != NULL, NULL); + entry_str = X509_NAME_ENTRY_get_data(entry); + g_return_val_if_fail(entry_str != NULL, NULL); - /* Convert everything into UTF-8. It's up to OpenSSL to do something + /* Convert everything into UTF-8. It's up to OpenSSL to do something reasonable when converting ASCII formats that contain non-ASCII content. */ - if ((utf8_length = ASN1_STRING_to_UTF8(&utf8_value, entry_str)) < 0) { - g_warning("Error decoding ASN.1 type=%d", ASN1_STRING_type(entry_str)); - return NULL; - } - - if (has_internal_nul((char *)utf8_value, utf8_length)) { - g_warning("NUL character in hostname in certificate"); - OPENSSL_free(utf8_value); - return NULL; - } - - result = g_strdup((char *) utf8_value); + if ((utf8_length = ASN1_STRING_to_UTF8(&utf8_value, entry_str)) < 0) { + g_warning("Error decoding ASN.1 type=%d", ASN1_STRING_type(entry_str)); + return NULL; + } + + if (has_internal_nul((char *)utf8_value, utf8_length)) { + g_warning("NUL character in hostname in certificate"); + OPENSSL_free(utf8_value); + return NULL; + } + + result = g_strdup((char *) utf8_value); OPENSSL_free(utf8_value); return result; } @@ -168,10 +168,10 @@ static gboolean irssi_ssl_verify_hostname(X509 *cert, const char *hostname) if (cert_dns_name && *cert_dns_name) { matched = match_hostname(cert_dns_name, hostname); } - } + } - /* Free stack *and* member GENERAL_NAME objects */ - sk_GENERAL_NAME_pop_free(gens, GENERAL_NAME_free); + /* Free stack *and* member GENERAL_NAME objects */ + sk_GENERAL_NAME_pop_free(gens, GENERAL_NAME_free); } if (has_dns_name) { @@ -182,15 +182,15 @@ static gboolean irssi_ssl_verify_hostname(X509 *cert, const char *hostname) return matched; } else { /* No subjectAltNames, look at CommonName */ cert_subject_cn = tls_text_name(X509_get_subject_name(cert), NID_commonName); - if (cert_subject_cn && *cert_subject_cn) { - matched = match_hostname(cert_subject_cn, hostname); - if (! matched) { + if (cert_subject_cn && *cert_subject_cn) { + matched = match_hostname(cert_subject_cn, hostname); + if (! matched) { g_warning("SSL certificate common name '%s' doesn't match host name '%s'", cert_subject_cn, hostname); - } - } else { - g_warning("No subjectAltNames and no valid common name in certificate"); - } - free(cert_subject_cn); + } + } else { + g_warning("No subjectAltNames and no valid common name in certificate"); + } + free(cert_subject_cn); } return matched; |