mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-17 03:03:23 +02:00
fixed a crash on WinCE; code cleanup
This commit is contained in:
@@ -73,7 +73,7 @@ public:
|
||||
const_cast<AutoSecBufferDesc*>(&desc)->initBuffers();
|
||||
}
|
||||
|
||||
AutoSecBufferDesc& operator=(const AutoSecBufferDesc& desc)
|
||||
AutoSecBufferDesc& operator = (const AutoSecBufferDesc& desc)
|
||||
{
|
||||
if (&desc != this)
|
||||
{
|
||||
@@ -96,13 +96,22 @@ public:
|
||||
|
||||
~AutoSecBufferDesc()
|
||||
/// Destroys the AutoSecBufferDesc
|
||||
{
|
||||
release();
|
||||
}
|
||||
|
||||
void release()
|
||||
{
|
||||
if (_autoRelease)
|
||||
{
|
||||
for (int i = 0; i < numBufs; ++i)
|
||||
{
|
||||
_pSec->FreeContextBuffer(_buffers[i].pvBuffer);
|
||||
if (_buffers[i].pvBuffer)
|
||||
{
|
||||
_pSec->FreeContextBuffer(_buffers[i].pvBuffer);
|
||||
}
|
||||
}
|
||||
_autoRelease = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
|
||||
|
||||
|
@@ -241,8 +241,7 @@ private:
|
||||
DWORD _clientFlags;
|
||||
DWORD _serverFlags;
|
||||
|
||||
HMODULE _hSecurityModule;
|
||||
SecurityFunctionTableW _securityFunctions;
|
||||
SecurityFunctionTableW& _securityFunctions;
|
||||
|
||||
BYTE* _pReceiveBuffer;
|
||||
DWORD _receiveBufferSize;
|
||||
|
Reference in New Issue
Block a user