aboutsummaryrefslogtreecommitdiff
path: root/externals/ace/SSL/SSL_Context.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'externals/ace/SSL/SSL_Context.cpp')
-rw-r--r--externals/ace/SSL/SSL_Context.cpp29
1 files changed, 23 insertions, 6 deletions
diff --git a/externals/ace/SSL/SSL_Context.cpp b/externals/ace/SSL/SSL_Context.cpp
index 72f02e3dc70..c7915797c37 100644
--- a/externals/ace/SSL/SSL_Context.cpp
+++ b/externals/ace/SSL/SSL_Context.cpp
@@ -28,7 +28,7 @@
ACE_RCSID (ACE_SSL,
SSL_Context,
- "$Id: SSL_Context.cpp 82574 2008-08-08 19:35:06Z parsons $")
+ "$Id: SSL_Context.cpp 85202 2009-04-28 18:52:57Z johnnyw $")
namespace
@@ -112,6 +112,7 @@ ACE_SSL_Context::ACE_SSL_Context (void)
: context_ (0),
mode_ (-1),
default_verify_mode_ (SSL_VERIFY_NONE),
+ default_verify_callback_ (0),
have_ca_ (0)
{
ACE_SSL_Context::ssl_library_init ();
@@ -131,7 +132,7 @@ ACE_SSL_Context::~ACE_SSL_Context (void)
ACE_SSL_Context *
ACE_SSL_Context::instance (void)
{
- return ACE_Singleton<ACE_SSL_Context, ACE_SYNCH_MUTEX>::instance ();
+ return ACE_Unmanaged_Singleton<ACE_SSL_Context, ACE_SYNCH_MUTEX>::instance ();
}
void
@@ -181,15 +182,15 @@ ACE_SSL_Context::ssl_library_init (void)
(void) this->egd_file (egd_socket_file);
#endif /* OPENSSL_VERSION_NUMBER */
- const char *rand_file =
- ACE_OS::getenv (ACE_SSL_RAND_FILE_ENV);
+ const char *rand_file = ACE_OS::getenv (ACE_SSL_RAND_FILE_ENV);
if (rand_file != 0)
- (void) this->seed_file (rand_file);
+ {
+ (void) this->seed_file (rand_file);
+ }
// Initialize the mutexes that will be used by the SSL and
// crypto library.
-
}
++ssl_library_init_count;
@@ -205,6 +206,9 @@ ACE_SSL_Context::ssl_library_fini (void)
--ssl_library_init_count;
if (ssl_library_init_count == 0)
{
+ // Explicitly close the singleton
+ ACE_Unmanaged_Singleton<ACE_SSL_Context, ACE_SYNCH_MUTEX>::close();
+
::ERR_free_strings ();
::EVP_cleanup ();
@@ -232,7 +236,11 @@ ACE_SSL_Context::set_mode (int mode)
if (this->context_ != 0)
return -1;
+#if OPENSSL_VERSION_NUMBER >= 0x10000002
+ const SSL_METHOD *method = 0;
+#else
SSL_METHOD *method = 0;
+#endif
switch (mode)
{
@@ -305,16 +313,20 @@ ACE_SSL_Context::load_trusted_ca (const char* ca_file,
{
// Use the default environment settings.
ca_file = ACE_OS::getenv (ACE_SSL_CERT_FILE_ENV);
+#ifdef ACE_DEFAULT_SSL_CERT_FILE
if (ca_file == 0)
ca_file = ACE_DEFAULT_SSL_CERT_FILE;
+#endif
}
if (ca_dir == 0 && use_env_defaults)
{
// Use the default environment settings.
ca_dir = ACE_OS::getenv (ACE_SSL_CERT_DIR_ENV);
+#ifdef ACE_DEFAULT_SSL_CERT_DIR
if (ca_dir == 0)
ca_dir = ACE_DEFAULT_SSL_CERT_DIR;
+#endif
}
// NOTE: SSL_CTX_load_verify_locations() returns 0 on error.
@@ -566,7 +578,12 @@ ACE_SSL_Context::report_error (unsigned long error_code)
char error_string[256];
+// OpenSSL < 0.9.6a doesn't have ERR_error_string_n() function.
+#if OPENSSL_VERSION_NUMBER >= 0x0090601fL
+ (void) ::ERR_error_string_n (error_code, error_string, sizeof error_string);
+#else /* OPENSSL_VERSION_NUMBER >= 0x0090601fL */
(void) ::ERR_error_string (error_code, error_string);
+#endif /* OPENSSL_VERSION_NUMBER >= 0x0090601fL */
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("ACE_SSL (%P|%t) error code: %u - %C\n"),