Permalink
Browse files

connect to SSL using SSLv3

  • Loading branch information...
1 parent 0149dd5 commit 039372e3743b7667c31c0b05a451bf27c0a33640 @dinhviethoa committed Mar 23, 2012
@@ -115,7 +115,7 @@ int mailimap_ssl_connect_voip(mailimap * f, const char * server, uint16_t port,
NULL, NULL);
}
-static int mailimap_cfssl_connect_voip(mailimap * f, const char * server, uint16_t port, int voip_enabled)
+static int mailimap_cfssl_connect_voip_ssl_level(mailimap * f, const char * server, uint16_t port, int voip_enabled, int ssl_level)
{
mailstream * stream;
int r;
@@ -124,6 +124,7 @@ static int mailimap_cfssl_connect_voip(mailimap * f, const char * server, uint16
if (stream == NULL) {
return MAILIMAP_ERROR_CONNECTION_REFUSED;
}
+ mailstream_cfstream_set_ssl_level(stream, ssl_level);
mailstream_cfstream_set_ssl_verification_mask(stream, MAILSTREAM_CFSTREAM_SSL_NO_VERIFICATION);
r = mailstream_cfstream_set_ssl_enabled(stream, 1);
if (r < 0) {
@@ -133,3 +134,8 @@ static int mailimap_cfssl_connect_voip(mailimap * f, const char * server, uint16
return mailimap_connect(f, stream);
}
+
+static int mailimap_cfssl_connect_voip(mailimap * f, const char * server, uint16_t port, int voip_enabled)
+{
+ return mailimap_cfssl_connect_voip_ssl_level(f, server, port, voip_enabled, MAILSTREAM_CFSTREAM_SSL_LEVEL_SSLv3);
+}
@@ -101,7 +101,7 @@ int newsnntp_ssl_connect_with_callback(newsnntp * f, const char * server, uint16
return newsnntp_connect(f, stream);
}
-static int newsnntp_cfssl_connect(newsnntp * f, const char * server, uint16_t port)
+static int newsnntp_cfssl_connect_ssl_level(newsnntp * f, const char * server, uint16_t port, int ssl_level)
{
mailstream * stream;
int r;
@@ -110,6 +110,7 @@ static int newsnntp_cfssl_connect(newsnntp * f, const char * server, uint16_t po
if (stream == NULL) {
return NEWSNNTP_ERROR_CONNECTION_REFUSED;
}
+ mailstream_cfstream_set_ssl_level(stream, ssl_level);
mailstream_cfstream_set_ssl_verification_mask(stream, MAILSTREAM_CFSTREAM_SSL_NO_VERIFICATION);
r = mailstream_cfstream_set_ssl_enabled(stream, 1);
if (r < 0) {
@@ -119,3 +120,9 @@ static int newsnntp_cfssl_connect(newsnntp * f, const char * server, uint16_t po
return newsnntp_connect(f, stream);
}
+
+static int newsnntp_cfssl_connect(newsnntp * f, const char * server, uint16_t port)
+{
+ return newsnntp_cfssl_connect_ssl_level(f, server, port, MAILSTREAM_CFSTREAM_SSL_LEVEL_SSLv3);
+}
+
@@ -102,7 +102,7 @@ int mailpop3_ssl_connect_with_callback(mailpop3 * f, const char * server, uint16
return mailpop3_connect(f, stream);
}
-static int mailpop3_cfssl_connect(mailpop3 * f, const char * server, uint16_t port)
+static int mailpop3_cfssl_connect_ssl_level(mailpop3 * f, const char * server, uint16_t port, int ssl_level)
{
mailstream * stream;
int r;
@@ -111,6 +111,7 @@ static int mailpop3_cfssl_connect(mailpop3 * f, const char * server, uint16_t po
if (stream == NULL) {
return MAILPOP3_ERROR_CONNECTION_REFUSED;
}
+ mailstream_cfstream_set_ssl_level(stream, ssl_level);
mailstream_cfstream_set_ssl_verification_mask(stream, MAILSTREAM_CFSTREAM_SSL_NO_VERIFICATION);
r = mailstream_cfstream_set_ssl_enabled(stream, 1);
if (r < 0) {
@@ -120,3 +121,8 @@ static int mailpop3_cfssl_connect(mailpop3 * f, const char * server, uint16_t po
return mailpop3_connect(f, stream);
}
+
+static int mailpop3_cfssl_connect(mailpop3 * f, const char * server, uint16_t port)
+{
+ return mailpop3_cfssl_connect_ssl_level(f, server, port, MAILSTREAM_CFSTREAM_SSL_LEVEL_SSLv3);
+}
@@ -102,8 +102,8 @@ int mailsmtp_ssl_connect_with_callback(mailsmtp * session,
return mailsmtp_connect(session, stream);
}
-static int mailsmtp_cfssl_connect(mailsmtp * session,
- const char * server, uint16_t port)
+static int mailsmtp_cfssl_connect_ssl_level(mailsmtp * session,
+ const char * server, uint16_t port, int ssl_level)
{
mailstream * stream;
int r;
@@ -112,6 +112,7 @@ static int mailsmtp_cfssl_connect(mailsmtp * session,
if (stream == NULL) {
return MAILSMTP_ERROR_CONNECTION_REFUSED;
}
+ mailstream_cfstream_set_ssl_level(stream, ssl_level);
mailstream_cfstream_set_ssl_verification_mask(stream, MAILSTREAM_CFSTREAM_SSL_NO_VERIFICATION);
r = mailstream_cfstream_set_ssl_enabled(stream, 1);
if (r < 0) {
@@ -121,3 +122,9 @@ static int mailsmtp_cfssl_connect(mailsmtp * session,
return mailsmtp_connect(session, stream);
}
+
+static int mailsmtp_cfssl_connect(mailsmtp * session,
+ const char * server, uint16_t port)
+{
+ return mailsmtp_cfssl_connect_ssl_level(session, server, port, MAILSTREAM_CFSTREAM_SSL_LEVEL_SSLv3);
+}

0 comments on commit 039372e

Please sign in to comment.