aboutsummaryrefslogtreecommitdiff
path: root/libsylph
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2009-11-26 07:37:23 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2009-11-26 07:37:23 +0000
commit44df8c0212965ac3a0793a90dda2d2f5d5c30fe6 (patch)
treed85f40cf02190f25067388816ca5c642dee36bc7 /libsylph
parent35a95f82fcd7b9969f89610af432e1b05b81635a (diff)
ssl_init_socket_with_method(): modified debug output.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2357 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph')
-rw-r--r--libsylph/ssl.c51
1 files changed, 27 insertions, 24 deletions
diff --git a/libsylph/ssl.c b/libsylph/ssl.c
index a22998ab..2fd1c75e 100644
--- a/libsylph/ssl.c
+++ b/libsylph/ssl.c
@@ -272,35 +272,38 @@ gboolean ssl_init_socket_with_method(SockInfo *sockinfo, SSLMethod method)
/* Get server's certificate (note: beware of dynamic allocation) */
if ((server_cert = SSL_get_peer_certificate(sockinfo->ssl)) != NULL) {
- gchar *str;
glong verify_result;
- guchar keyid[EVP_MAX_MD_SIZE];
- gchar keyidstr[EVP_MAX_MD_SIZE * 3 + 1] = "";
- guint keyidlen = 0;
- gint i;
- debug_print(_("Server certificate:\n"));
-
- if ((str = X509_NAME_oneline(X509_get_subject_name(server_cert), 0, 0)) != NULL) {
- debug_print(_(" Subject: %s\n"), str);
- OPENSSL_free(str);
- }
+ if (get_debug_mode()) {
+ gchar *str;
+ guchar keyid[EVP_MAX_MD_SIZE];
+ gchar keyidstr[EVP_MAX_MD_SIZE * 3 + 1] = "";
+ guint keyidlen = 0;
+ gint i;
+
+ debug_print(_("Server certificate:\n"));
+
+ if ((str = X509_NAME_oneline(X509_get_subject_name(server_cert), 0, 0)) != NULL) {
+ debug_print(_(" Subject: %s\n"), str);
+ OPENSSL_free(str);
+ }
- if ((str = X509_NAME_oneline(X509_get_issuer_name(server_cert), 0, 0)) != NULL) {
- debug_print(_(" Issuer: %s\n"), str);
- OPENSSL_free(str);
- }
- if (X509_digest(server_cert, EVP_sha1(), keyid, &keyidlen)) {
- for (i = 0; i < keyidlen; i++)
+ if ((str = X509_NAME_oneline(X509_get_issuer_name(server_cert), 0, 0)) != NULL) {
+ debug_print(_(" Issuer: %s\n"), str);
+ OPENSSL_free(str);
+ }
+ if (X509_digest(server_cert, EVP_sha1(), keyid, &keyidlen)) {
+ for (i = 0; i < keyidlen; i++)
g_snprintf(keyidstr + i * 3, 4, "%02x:", keyid[i]);
- keyidstr[keyidlen * 3 - 1] = '\0';
- debug_print(" SHA1 fingerprint: %s\n", keyidstr);
- }
- if (X509_digest(server_cert, EVP_md5(), keyid, &keyidlen)) {
- for (i = 0; i < keyidlen; i++)
+ keyidstr[keyidlen * 3 - 1] = '\0';
+ debug_print(" SHA1 fingerprint: %s\n", keyidstr);
+ }
+ if (X509_digest(server_cert, EVP_md5(), keyid, &keyidlen)) {
+ for (i = 0; i < keyidlen; i++)
g_snprintf(keyidstr + i * 3, 4, "%02x:", keyid[i]);
- keyidstr[keyidlen * 3 - 1] = '\0';
- debug_print(" MD5 fingerprint: %s\n", keyidstr);
+ keyidstr[keyidlen * 3 - 1] = '\0';
+ debug_print(" MD5 fingerprint: %s\n", keyidstr);
+ }
}
verify_result = SSL_get_verify_result(sockinfo->ssl);