Skip to content

Commit

Permalink
Further clean up
Browse files Browse the repository at this point in the history
Signed-off-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday committed Oct 13, 2023
1 parent c5b8ef1 commit 19b47ed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
21 changes: 7 additions & 14 deletions system/security/securesocket/securesocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1353,13 +1353,6 @@ class CSecureSocketContext : public CInterfaceOf<ISecureSocketContext>
}

public:
CSecureSocketContext(SecureSocketType sockettype)
{
initContext(sockettype);

SSL_CTX_set_mode(m_ctx, SSL_CTX_get_mode(m_ctx) | SSL_MODE_AUTO_RETRY);
}

CSecureSocketContext(const IPropertyTree* config, SecureSocketType sockettype)
{
initContext(sockettype);
Expand Down Expand Up @@ -1946,7 +1939,7 @@ extern "C" {

SECURESOCKET_API ISecureSocketContext* createSecureSocketContext(SecureSocketType sockettype)
{
return new securesocket::CSecureSocketContext(sockettype);
return new securesocket::CSecureSocketContext(nullptr, sockettype);
}

SECURESOCKET_API ISecureSocketContext* createSecureSocketContextSynced(const ISyncedPropertyTree * config, SecureSocketType sockettype)
Expand Down Expand Up @@ -1991,12 +1984,6 @@ IPropertyTree * createSecureSocketConfig(const char* certFileOrBuf, const char*
return config.getClear();
}

//Legacy factory interfaces
SECURESOCKET_API ISecureSocketContext* createSecureSocketContextEx2(const IPropertyTree* config, SecureSocketType sockettype)
{
return new securesocket::CSecureSocketContext(config, sockettype);
}

SECURESOCKET_API ISecureSocketContext* createSecureSocketContextSSF(ISmartSocketFactory* ssf)
{
if (ssf == nullptr || !ssf->queryTlsConfig())
Expand All @@ -2005,6 +1992,12 @@ SECURESOCKET_API ISecureSocketContext* createSecureSocketContextSSF(ISmartSocket
return createSecureSocketContextSynced(ssf->queryTlsConfig(), ClientSocket);
}

//Legacy factory interfaces
SECURESOCKET_API ISecureSocketContext* createSecureSocketContextEx2(const IPropertyTree* config, SecureSocketType sockettype)
{
return new securesocket::CSecureSocketContext(config, sockettype);
}

SECURESOCKET_API ICertificate *createCertificate()
{
return new securesocket::CRsaCertificate();
Expand Down
5 changes: 2 additions & 3 deletions system/security/securesocket/securesocket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,14 @@ extern "C" {
SECURESOCKET_API ISecureSocketContext* createSecureSocketContextSynced(const ISyncedPropertyTree * config, SecureSocketType sockettype); // Will become the primary (only) factory method
SECURESOCKET_API ISecureSocketContext* createSecureSocketContextSecret(const char *mtlsSecretName, SecureSocketType);
SECURESOCKET_API ISecureSocketContext* createSecureSocketContextSecretSrv(const char *mtlsSecretName, bool requireMtlsConfig);
SECURESOCKET_API ISecureSocketContext* createSecureSocketContextSSF(ISmartSocketFactory* ssf);

//Helper function to aid migration to the functions above
//Helper function to aid migration to the functions above. This should eventually be removed.
IPropertyTree * createSecureSocketConfig(const char* certFileOrBuf, const char* privKeyFileOrBuf, const char* passphrase);

//Legacy factory methods - should be phased out.
SECURESOCKET_API ISecureSocketContext* createSecureSocketContext(SecureSocketType);
SECURESOCKET_API ISecureSocketContext* createSecureSocketContextEx(const char* certFileOrBuf, const char* privKeyFileOrBuf, const char* passphrase, SecureSocketType);
SECURESOCKET_API ISecureSocketContext* createSecureSocketContextEx2(const IPropertyTree* config, SecureSocketType);
SECURESOCKET_API ISecureSocketContext* createSecureSocketContextSSF(ISmartSocketFactory* ssf);
SECURESOCKET_API ICertificate *createCertificate();
SECURESOCKET_API int signCertificate(const char* csr, const char* ca_certificate, const char* ca_privkey, const char* ca_passphrase, int days, StringBuffer& certificate);
};
Expand Down

0 comments on commit 19b47ed

Please sign in to comment.