Merge pull request #943 from zosrothko/develop

Proposed changes for fixing NetSSL_OpenSSL and adding portability function in Sharedmemory
This commit is contained in:
Günter Obiltschnig 2015-09-19 15:46:57 +02:00
commit ee9794f087
6 changed files with 33 additions and 19 deletions

View File

@ -121,7 +121,7 @@ public:
static std::string prefix();
/// Returns the platform-specific filename prefix
/// for shared libraries.
/// Most platforms would return an empty string, but
/// Most platforms would return "lib" as prefix, while
/// on Cygwin, the "cyg" prefix will be returned.
static std::string suffix();
@ -130,6 +130,11 @@ public:
/// In debug mode, the suffix also includes a
/// "d" to specify the debug version of a library.
static std::string getOSName(const std::string& name);
/// Returns the platform-specific filename
/// for shared libraries by prefixing and suffixing name
/// with prefix() and suffix()
private:
SharedLibrary(const SharedLibrary&);
SharedLibrary& operator = (const SharedLibrary&);

View File

@ -115,5 +115,9 @@ std::string SharedLibrary::suffix()
return suffixImpl();
}
std::string SharedLibrary::getOSName(const std::string& name)
{
return prefix() + name + suffix();
}
} // namespace Poco

View File

@ -85,7 +85,7 @@ const std::string& SharedLibraryImpl::getPathImpl() const
std::string SharedLibraryImpl::prefixImpl()
{
return "";
return "lib";
}

View File

@ -104,7 +104,7 @@ std::string SharedLibraryImpl::prefixImpl()
#if POCO_OS == POCO_OS_CYGWIN
return "cyg";
#else
return "";
return "lib";
#endif
}

View File

@ -5,7 +5,6 @@
#
# Makefile for Poco NetSSL_OpenSSL
#
include $(POCO_BASE)/build/rules/global
SYSLIBS += -lssl -lcrypto

View File

@ -333,28 +333,34 @@ void Context::createSSLContext()
case SERVER_USE:
_pSSLContext = SSL_CTX_new(SSLv23_server_method());
break;
#if defined(SSL_OP_NO_TLSv1) && !defined(OPENSSL_NO_TLS1)
case TLSV1_CLIENT_USE:
_pSSLContext = SSL_CTX_new(TLSv1_client_method());
break;
case TLSV1_SERVER_USE:
_pSSLContext = SSL_CTX_new(TLSv1_server_method());
break;
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
case TLSV1_1_CLIENT_USE:
_pSSLContext = SSL_CTX_new(TLSv1_1_client_method());
break;
case TLSV1_1_SERVER_USE:
_pSSLContext = SSL_CTX_new(TLSv1_1_server_method());
break;
#endif
#if OPENSSL_VERSION_NUMBER >= 0x10001000L
case TLSV1_2_CLIENT_USE:
_pSSLContext = SSL_CTX_new(TLSv1_2_client_method());
break;
case TLSV1_2_SERVER_USE:
_pSSLContext = SSL_CTX_new(TLSv1_2_server_method());
break;
#endif
#if defined(SSL_OP_NO_TLSv1_1) && !defined(OPENSSL_NO_TLS1)
/* SSL_OP_NO_TLSv1_1 is defined in ssl.h if the library version supports TLSv1.1.
* OPENSSL_NO_TLS1 is defined in opensslconf.h or on the compiler command line
* if TLS1.x was removed at OpenSSL library build time via Configure options.
*/
case TLSV1_1_CLIENT_USE:
_pSSLContext = SSL_CTX_new(TLSv1_1_client_method());
break;
case TLSV1_1_SERVER_USE:
_pSSLContext = SSL_CTX_new(TLSv1_1_server_method());
break;
#endif
#if defined(SSL_OP_NO_TLSv1_2) && !defined(OPENSSL_NO_TLS1)
case TLSV1_2_CLIENT_USE:
_pSSLContext = SSL_CTX_new(TLSv1_2_client_method());
break;
case TLSV1_2_SERVER_USE:
_pSSLContext = SSL_CTX_new(TLSv1_2_server_method());
break;
#endif
default:
throw Poco::InvalidArgumentException("Invalid or unsupported usage");
}