mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-02-07 13:27:13 +01:00
4a6bfc086c
Switched to POCO library for unified platform/library interface. Deprecated the external module API. It was creating more problems than solving. Removed most built-in libraries in favor of system libraries for easier maintenance. Cleaned and secured code with help from static analyzers.
64 lines
1.2 KiB
C++
64 lines
1.2 KiB
C++
//
|
|
// SecureSMTPClientSession.h
|
|
//
|
|
// Library: NetSSL_OpenSSL
|
|
// Package: Mail
|
|
// Module: SecureSMTPClientSession
|
|
//
|
|
// Copyright (c) 2010, Applied Informatics Software Engineering GmbH.
|
|
// and Contributors.
|
|
//
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
//
|
|
|
|
|
|
#include "Poco/Net/SecureSMTPClientSession.h"
|
|
#include "Poco/Net/SecureStreamSocket.h"
|
|
#include "Poco/Net/SSLManager.h"
|
|
#include "Poco/Net/DialogSocket.h"
|
|
|
|
|
|
namespace Poco {
|
|
namespace Net {
|
|
|
|
|
|
SecureSMTPClientSession::SecureSMTPClientSession(const StreamSocket& socket):
|
|
SMTPClientSession(socket)
|
|
{
|
|
}
|
|
|
|
|
|
SecureSMTPClientSession::SecureSMTPClientSession(const std::string& host, Poco::UInt16 port):
|
|
SMTPClientSession(host, port)
|
|
{
|
|
}
|
|
|
|
|
|
SecureSMTPClientSession::~SecureSMTPClientSession()
|
|
{
|
|
}
|
|
|
|
|
|
bool SecureSMTPClientSession::startTLS()
|
|
{
|
|
return startTLS(SSLManager::instance().defaultClientContext());
|
|
}
|
|
|
|
|
|
bool SecureSMTPClientSession::startTLS(Context::Ptr pContext)
|
|
{
|
|
int status = 0;
|
|
std::string response;
|
|
|
|
status = sendCommand("STARTTLS", response);
|
|
if (!isPositiveCompletion(status)) return false;
|
|
|
|
SecureStreamSocket sss(SecureStreamSocket::attach(socket(), host(), pContext));
|
|
socket() = sss;
|
|
|
|
return true;
|
|
}
|
|
|
|
|
|
} } // namespace Poco::Net
|