aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/pop3/POP3Store.cpp
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2006-01-29 17:36:34 +0000
committerVincent Richard <[email protected]>2006-01-29 17:36:34 +0000
commit1539754d5357df5eed7a88cc3f2955c87af9faae (patch)
tree76089fb32db228042b3185fcd7889e91e0f5fe92 /src/net/pop3/POP3Store.cpp
parentgetPeerCertificates() should be const. (diff)
downloadvmime-1539754d5357df5eed7a88cc3f2955c87af9faae.tar.gz
vmime-1539754d5357df5eed7a88cc3f2955c87af9faae.zip
Added service::isSecuredConnection() and service::getConnectionInfos() to retrieve information about the connection.
Diffstat (limited to 'src/net/pop3/POP3Store.cpp')
-rw-r--r--src/net/pop3/POP3Store.cpp36
1 files changed, 33 insertions, 3 deletions
diff --git a/src/net/pop3/POP3Store.cpp b/src/net/pop3/POP3Store.cpp
index 29a22dcf..5340e50d 100644
--- a/src/net/pop3/POP3Store.cpp
+++ b/src/net/pop3/POP3Store.cpp
@@ -27,12 +27,15 @@
#include "vmime/utility/filteredStream.hpp"
#include "vmime/utility/stringUtils.hpp"
+#include "vmime/net/defaultConnectionInfos.hpp"
+
#if VMIME_HAVE_SASL_SUPPORT
#include "vmime/security/sasl/SASLContext.hpp"
#endif // VMIME_HAVE_SASL_SUPPORT
#if VMIME_HAVE_TLS_SUPPORT
#include "vmime/net/tls/TLSSession.hpp"
+ #include "vmime/net/tls/TLSSecuredConnectionInfos.hpp"
#endif // VMIME_HAVE_TLS_SUPPORT
#include <algorithm>
@@ -54,7 +57,8 @@ namespace pop3 {
POP3Store::POP3Store(ref <session> sess, ref <security::authenticator> auth, const bool secured)
: store(sess, getInfosInstance(), auth), m_socket(NULL),
- m_authentified(false), m_timeoutHandler(NULL), m_secured(secured)
+ m_authentified(false), m_timeoutHandler(NULL),
+ m_isPOP3S(secured), m_secured(false)
{
}
@@ -130,7 +134,7 @@ void POP3Store::connect()
m_socket = getSocketFactory()->create();
#if VMIME_HAVE_TLS_SUPPORT
- if (m_secured) // dedicated port/POP3S
+ if (m_isPOP3S) // dedicated port/POP3S
{
ref <tls::TLSSession> tlsSession =
vmime::create <tls::TLSSession>(getCertificateVerifier());
@@ -139,8 +143,15 @@ void POP3Store::connect()
tlsSession->getSocket(m_socket);
m_socket = tlsSocket;
+
+ m_secured = true;
+ m_cntInfos = vmime::create <tls::TLSSecuredConnectionInfos>(address, port, tlsSession, tlsSocket);
}
#endif // VMIME_HAVE_TLS_SUPPORT
+ else
+ {
+ m_cntInfos = vmime::create <defaultConnectionInfos>(address, port);
+ }
m_socket->connect(address, port);
@@ -165,7 +176,7 @@ void POP3Store::connect()
const bool tlsRequired = HAS_PROPERTY(PROPERTY_CONNECTION_TLS_REQUIRED)
&& GET_PROPERTY(bool, PROPERTY_CONNECTION_TLS_REQUIRED);
- if (!m_secured && tls) // only if not POP3S
+ if (!m_isPOP3S && tls) // only if not POP3S
{
try
{
@@ -533,6 +544,10 @@ void POP3Store::startTLS()
tlsSocket->handshake(m_timeoutHandler);
m_socket = tlsSocket;
+
+ m_secured = true;
+ m_cntInfos = vmime::create <tls::TLSSecuredConnectionInfos>
+ (m_cntInfos->getHost(), m_cntInfos->getPort(), tlsSession, tlsSocket);
}
catch (exceptions::command_error&)
{
@@ -556,6 +571,18 @@ const bool POP3Store::isConnected() const
}
+const bool POP3Store::isSecuredConnection() const
+{
+ return m_secured;
+}
+
+
+ref <connectionInfos> POP3Store::getConnectionInfos() const
+{
+ return m_cntInfos;
+}
+
+
void POP3Store::disconnect()
{
if (!isConnected())
@@ -590,6 +617,9 @@ void POP3Store::internalDisconnect()
m_timeoutHandler = NULL;
m_authentified = false;
+
+ m_secured = false;
+ m_cntInfos = NULL;
}