aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/poco/NetSSL_OpenSSL/src/SecureSMTPClientSession.cpp
blob: ff0fd5b0d4e649bcca0bdbf6c26f5d3af4315f77 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// 
// 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), 
	_host(host) 
{ 
} 
 
 
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