fixed a crash on WinCE; code cleanup

This commit is contained in:
Günter Obiltschnig
2014-09-17 11:17:04 +02:00
parent ee25a49e9b
commit 0a115be8ac
7 changed files with 136 additions and 100 deletions

View File

@@ -27,6 +27,13 @@
#include "Poco/Net/InvalidCertificateHandler.h"
#include "Poco/BasicEvent.h"
#include "Poco/SharedPtr.h"
#include <wincrypt.h>
#include <schannel.h>
#ifndef SECURITY_WIN32
#define SECURITY_WIN32
#endif
#include <security.h>
#include <sspi.h>
namespace Poco {
@@ -184,6 +191,9 @@ public:
static const std::string CFG_SERVER_PREFIX;
static const std::string CFG_CLIENT_PREFIX;
protected:
SecurityFunctionTableW& securityFunctions();
private:
SSLManager();
/// Creates the SSLManager.
@@ -200,6 +210,15 @@ private:
void initCertificateHandler(bool server);
/// Inits the certificate handler.
void loadSecurityLibrary();
/// Loads the Windows security DLL.
void unloadSecurityLibrary();
/// Unloads the Windows security DLL.
HMODULE _hSecurityModule;
SecurityFunctionTableW _securityFunctions;
CertificateHandlerFactoryMgr _certHandlerFactoryMgr;
Context::Ptr _ptrDefaultServerContext;
InvalidCertificateHandlerPtr _ptrServerCertificateHandler;
@@ -232,6 +251,7 @@ private:
static const std::string CFG_REQUIRE_TLSV1_2;
friend class Poco::SingletonHolder<SSLManager>;
friend class SecureSocketImpl;
};
@@ -244,6 +264,12 @@ inline CertificateHandlerFactoryMgr& SSLManager::certificateHandlerFactoryMgr()
}
inline SecurityFunctionTableW& SSLManager::securityFunctions()
{
return _securityFunctions;
}
} } // namespace Poco::Net