mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-16 18:56:52 +02:00
latest sources from main repository
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// CertificateHandlerFactory.h
|
||||
//
|
||||
// $Id: //poco/Main/NetSSL_OpenSSL/include/Poco/Net/CertificateHandlerFactory.h#6 $
|
||||
// $Id: //poco/Main/NetSSL_OpenSSL/include/Poco/Net/CertificateHandlerFactory.h#7 $
|
||||
//
|
||||
// Library: NetSSL_OpenSSL
|
||||
// Package: SSLCore
|
||||
@@ -82,22 +82,32 @@ public:
|
||||
/// Destroys the CertificateHandlerFactoryRegistrar.
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class CertificateHandlerFactoryImpl: public Poco::Net::CertificateHandlerFactory
|
||||
{
|
||||
public:
|
||||
CertificateHandlerFactoryImpl()
|
||||
{
|
||||
}
|
||||
|
||||
#define POCO_REGISTER_CHFACTORY(API, PKCLS) \
|
||||
class API PKCLS##Factory: public Poco::Net::CertificateHandlerFactory \
|
||||
{ \
|
||||
public: \
|
||||
PKCLS##Factory(){} \
|
||||
~PKCLS##Factory(){} \
|
||||
Poco::Net::InvalidCertificateHandler* create(bool server) const \
|
||||
{ \
|
||||
return new PKCLS(server); \
|
||||
} \
|
||||
}; \
|
||||
static Poco::Net::CertificateHandlerFactoryRegistrar aRegistrar(std::string(#PKCLS), new PKCLS##Factory());
|
||||
~CertificateHandlerFactoryImpl()
|
||||
{
|
||||
}
|
||||
|
||||
InvalidCertificateHandler* create(bool server) const
|
||||
{
|
||||
return new T(server);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::Net
|
||||
|
||||
|
||||
// DEPRECATED: register the factory directly at the FactoryMgr:
|
||||
// Poco::Net::SSLManager::instance().certificateHandlerFactoryMgr().setFactory(name, new Poco::Net::CertificateHandlerFactoryImpl<MyConsoleHandler>());
|
||||
#define POCO_REGISTER_CHFACTORY(API, PKCLS) \
|
||||
static Poco::Net::CertificateHandlerFactoryRegistrar aRegistrar(std::string(#PKCLS), new Poco::Net::CertificateHandlerFactoryImpl<PKCLS>());
|
||||
|
||||
|
||||
#endif // NetSSL_CertificateHandlerFactory_INCLUDED
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// PrivateKeyFactory.h
|
||||
//
|
||||
// $Id: //poco/Main/NetSSL_OpenSSL/include/Poco/Net/PrivateKeyFactory.h#6 $
|
||||
// $Id: //poco/Main/NetSSL_OpenSSL/include/Poco/Net/PrivateKeyFactory.h#7 $
|
||||
//
|
||||
// Library: NetSSL_OpenSSL
|
||||
// Package: SSLCore
|
||||
@@ -84,21 +84,32 @@ public:
|
||||
};
|
||||
|
||||
|
||||
#define POCO_REGISTER_KEYFACTORY(API, PKCLS) \
|
||||
class API PKCLS##Factory: public Poco::Net::PrivateKeyFactory \
|
||||
{ \
|
||||
public: \
|
||||
PKCLS##Factory(){} \
|
||||
~PKCLS##Factory(){} \
|
||||
Poco::Net::PrivateKeyPassphraseHandler* create(bool server) const \
|
||||
{ \
|
||||
return new PKCLS(server); \
|
||||
} \
|
||||
}; \
|
||||
static Poco::Net::PrivateKeyFactoryRegistrar aRegistrar(std::string(#PKCLS), new PKCLS##Factory());
|
||||
template<typename T>
|
||||
class PrivateKeyFactoryImpl: public Poco::Net::PrivateKeyFactory
|
||||
{
|
||||
public:
|
||||
PrivateKeyFactoryImpl()
|
||||
{
|
||||
}
|
||||
|
||||
~PrivateKeyFactoryImpl()
|
||||
{
|
||||
}
|
||||
|
||||
PrivateKeyPassphraseHandler* create(bool server) const
|
||||
{
|
||||
return new T(server);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} } // namespace Poco::Net
|
||||
|
||||
|
||||
// DEPRECATED: register the factory directly at the FactoryMgr:
|
||||
// Poco::Net::SSLManager::instance().privateKeyFactoryMgr().setFactory(name, new Poco::Net::PrivateKeyFactoryImpl<MyKeyHandler>());
|
||||
#define POCO_REGISTER_KEYFACTORY(API, PKCLS) \
|
||||
static Poco::Net::PrivateKeyFactoryRegistrar aRegistrar(std::string(#PKCLS), new Poco::Net::PrivateKeyFactoryImpl<PKCLS>());
|
||||
|
||||
|
||||
#endif // NetSSL_PrivateKeyFactory_INCLUDED
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// AcceptCertificateHandler.cpp
|
||||
//
|
||||
// $Id: //poco/Main/NetSSL_OpenSSL/src/AcceptCertificateHandler.cpp#9 $
|
||||
// $Id: //poco/Main/NetSSL_OpenSSL/src/AcceptCertificateHandler.cpp#10 $
|
||||
//
|
||||
// Library: NetSSL_OpenSSL
|
||||
// Package: SSLCore
|
||||
@@ -35,7 +35,6 @@
|
||||
|
||||
|
||||
#include "Poco/Net/AcceptCertificateHandler.h"
|
||||
#include "Poco/Net/CertificateHandlerFactory.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
@@ -52,7 +51,4 @@ AcceptCertificateHandler::~AcceptCertificateHandler()
|
||||
}
|
||||
|
||||
|
||||
POCO_REGISTER_CHFACTORY(NetSSL_API, AcceptCertificateHandler)
|
||||
|
||||
|
||||
} } // namespace Poco::Net
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// CertificateHandlerFactoryMgr.cpp
|
||||
//
|
||||
// $Id: //poco/Main/NetSSL_OpenSSL/src/CertificateHandlerFactoryMgr.cpp#8 $
|
||||
// $Id: //poco/Main/NetSSL_OpenSSL/src/CertificateHandlerFactoryMgr.cpp#9 $
|
||||
//
|
||||
// Library: NetSSL_OpenSSL
|
||||
// Package: SSLCore
|
||||
@@ -35,6 +35,8 @@
|
||||
|
||||
|
||||
#include "Poco/Net/CertificateHandlerFactoryMgr.h"
|
||||
#include "Poco/Net/ConsoleCertificateHandler.h"
|
||||
#include "Poco/Net/AcceptCertificateHandler.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
@@ -43,6 +45,9 @@ namespace Net {
|
||||
|
||||
CertificateHandlerFactoryMgr::CertificateHandlerFactoryMgr()
|
||||
{
|
||||
setFactory("ConsoleCertificateHandler", new CertificateHandlerFactoryImpl<ConsoleCertificateHandler>());
|
||||
setFactory("AcceptCertificateHandler", new CertificateHandlerFactoryImpl<AcceptCertificateHandler>());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// ConsoleCertificateHandler.cpp
|
||||
//
|
||||
// $Id: //poco/Main/NetSSL_OpenSSL/src/ConsoleCertificateHandler.cpp#9 $
|
||||
// $Id: //poco/Main/NetSSL_OpenSSL/src/ConsoleCertificateHandler.cpp#10 $
|
||||
//
|
||||
// Library: NetSSL_OpenSSL
|
||||
// Package: SSLCore
|
||||
@@ -36,7 +36,6 @@
|
||||
|
||||
#include "Poco/Net/ConsoleCertificateHandler.h"
|
||||
#include <iostream>
|
||||
#include "Poco/Net/CertificateHandlerFactory.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
@@ -72,7 +71,4 @@ void ConsoleCertificateHandler::onInvalidCertificate(const void*, VerificationEr
|
||||
}
|
||||
|
||||
|
||||
POCO_REGISTER_CHFACTORY(NetSSL_API, ConsoleCertificateHandler)
|
||||
|
||||
|
||||
} } // namespace Poco::Net
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// KeyConsoleHandler.cpp
|
||||
//
|
||||
// $Id: //poco/Main/NetSSL_OpenSSL/src/KeyConsoleHandler.cpp#9 $
|
||||
// $Id: //poco/Main/NetSSL_OpenSSL/src/KeyConsoleHandler.cpp#10 $
|
||||
//
|
||||
// Library: NetSSL_OpenSSL
|
||||
// Package: SSLCore
|
||||
@@ -35,7 +35,6 @@
|
||||
|
||||
|
||||
#include "Poco/Net/KeyConsoleHandler.h"
|
||||
#include "Poco/Net/PrivateKeyFactory.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
@@ -60,7 +59,4 @@ void KeyConsoleHandler::onPrivateKeyRequested(const void* pSender, std::string&
|
||||
}
|
||||
|
||||
|
||||
POCO_REGISTER_KEYFACTORY(NetSSL_API, KeyConsoleHandler)
|
||||
|
||||
|
||||
} } // namespace Poco::Net
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// KeyFileHandler.cpp
|
||||
//
|
||||
// $Id: //poco/Main/NetSSL_OpenSSL/src/KeyFileHandler.cpp#10 $
|
||||
// $Id: //poco/Main/NetSSL_OpenSSL/src/KeyFileHandler.cpp#11 $
|
||||
//
|
||||
// Library: NetSSL_OpenSSL
|
||||
// Package: SSLCore
|
||||
@@ -35,7 +35,6 @@
|
||||
|
||||
|
||||
#include "Poco/Net/KeyFileHandler.h"
|
||||
#include "Poco/Net/PrivateKeyFactory.h"
|
||||
#include "Poco/Net/SSLManager.h"
|
||||
#include "Poco/File.h"
|
||||
#include "Poco/Util/LayeredConfiguration.h"
|
||||
@@ -73,7 +72,4 @@ void KeyFileHandler::onPrivateKeyRequested(const void* pSender, std::string& pri
|
||||
}
|
||||
|
||||
|
||||
POCO_REGISTER_KEYFACTORY(NetSSL_API,KeyFileHandler)
|
||||
|
||||
|
||||
} } // namespace Poco::Net
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// PrivateKeyFactoryMgr.cpp
|
||||
//
|
||||
// $Id: //poco/Main/NetSSL_OpenSSL/src/PrivateKeyFactoryMgr.cpp#8 $
|
||||
// $Id: //poco/Main/NetSSL_OpenSSL/src/PrivateKeyFactoryMgr.cpp#9 $
|
||||
//
|
||||
// Library: NetSSL_OpenSSL
|
||||
// Package: SSLCore
|
||||
@@ -35,6 +35,8 @@
|
||||
|
||||
|
||||
#include "Poco/Net/PrivateKeyFactoryMgr.h"
|
||||
#include "Poco/Net/KeyFileHandler.h"
|
||||
#include "Poco/Net/KeyConsoleHandler.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
@@ -43,6 +45,8 @@ namespace Net {
|
||||
|
||||
PrivateKeyFactoryMgr::PrivateKeyFactoryMgr()
|
||||
{
|
||||
setFactory("KeyFileHandler", new PrivateKeyFactoryImpl<KeyFileHandler>());
|
||||
setFactory("KeyConsoleHandler", new PrivateKeyFactoryImpl<KeyConsoleHandler>());
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// SecureSocketImpl.cpp
|
||||
//
|
||||
// $Id: //poco/Main/NetSSL_OpenSSL/src/SecureSocketImpl.cpp#20 $
|
||||
// $Id: //poco/Main/NetSSL_OpenSSL/src/SecureSocketImpl.cpp#21 $
|
||||
//
|
||||
// Library: NetSSL_OpenSSL
|
||||
// Package: SSLSockets
|
||||
@@ -576,8 +576,13 @@ bool SecureSocketImpl::containsWildcards(const std::string& commonName)
|
||||
|
||||
bool SecureSocketImpl::matchByAlias(const std::string& alias, const HostEntry& heData)
|
||||
{
|
||||
// fix wildcards
|
||||
std::string aliasRep = Poco::replace(alias, "*", ".*");
|
||||
Poco::replaceInPlace(aliasRep, "..*", ".*");
|
||||
Poco::replaceInPlace(aliasRep, "?", ".?");
|
||||
Poco::replaceInPlace(aliasRep, "..?", ".?");
|
||||
// compare by name
|
||||
Poco::RegularExpression expr(alias);
|
||||
Poco::RegularExpression expr(aliasRep);
|
||||
bool found = false;
|
||||
const HostEntry::AliasList& aliases = heData.aliases();
|
||||
HostEntry::AliasList::const_iterator it = aliases.begin();
|
||||
|
Reference in New Issue
Block a user