aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-04-29 07:36:40 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-04-29 07:36:40 +0000
commit699ebe2f0bc3a69960a65df32016abea1b99bbb5 (patch)
tree93fcc5d8e7cc14c135ea44e55a72c89b1ee6177f
parente1c6f216c24869e039251f168f7cbde775459ff2 (diff)
Gisle made the code use ERR_error_string_n()
-rw-r--r--lib/ssluse.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/lib/ssluse.c b/lib/ssluse.c
index fa8a9fc80..c27eb918c 100644
--- a/lib/ssluse.c
+++ b/lib/ssluse.c
@@ -75,6 +75,10 @@
#undef HAVE_ENGINE_LOAD_FOUR_ARGS
#endif
+#if OPENSSL_VERSION_NUMBER >= 0x00906001L
+#define HAVE_ERR_ERROR_STRING_N 1
+#endif
+
#ifndef HAVE_USERDATA_IN_PWD_CALLBACK
static char global_passwd[64];
@@ -383,21 +387,17 @@ int cert_verify_callback(int ok, X509_STORE_CTX *ctx)
char buf[256];
err_cert=X509_STORE_CTX_get_current_cert(ctx);
- X509_NAME_oneline(X509_get_subject_name(err_cert),buf,256);
-
+ X509_NAME_oneline(X509_get_subject_name(err_cert), buf, sizeof(buf));
return ok;
}
-#endif
-
-#ifdef USE_SSLEAY
/* "global" init done? */
static int init_ssl=0;
/* we have the "SSL is seeded" boolean global for the application to
prevent multiple time-consuming seedings in vain */
static bool ssl_seeded = FALSE;
-#endif
+#endif /* USE_SSLEAY */
/* Global init */
void Curl_SSL_init(void)
@@ -1141,11 +1141,16 @@ Curl_SSLConnect(struct connectdata *conn,
return CURLE_SSL_CACERT;
default:
/* detail is already set to the SSL error above */
- failf(data, "SSL: %s", ERR_error_string(errdetail, error_buffer));
+#ifdef HAVE_ERR_ERROR_STRING_N
/* OpenSSL 0.9.6 and later has a function named
- ERRO_error_string_n() that takes the size of the buffer as a third
- argument, and we should possibly switch to using that one in the
- future. */
+ ERRO_error_string_n() that takes the size of the buffer as a
+ third argument */
+ ERR_error_string_n(errdetail, error_buffer, sizeof(error_buffer));
+#else
+ ERR_error_string(errdetail, error_buffer);
+#endif
+
+ failf(data, "SSL: %s", error_buffer);
return CURLE_SSL_CONNECT_ERROR;
}
}