dovecot-2.2: pop3c: Added missing support for pop3c_ssl=starttls
dovecot at dovecot.org
dovecot at dovecot.org
Mon Sep 8 15:12:05 UTC 2014
details: http://hg.dovecot.org/dovecot-2.2/rev/bf1faf8ab847
changeset: 17764:bf1faf8ab847
user: Timo Sirainen <tss at iki.fi>
date: Mon Sep 08 18:11:31 2014 +0300
description:
pop3c: Added missing support for pop3c_ssl=starttls
diffstat:
src/lib-storage/index/pop3c/pop3c-client.c | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diffs (53 lines):
diff -r a41089e5bd8e -r bf1faf8ab847 src/lib-storage/index/pop3c/pop3c-client.c
--- a/src/lib-storage/index/pop3c/pop3c-client.c Mon Sep 08 13:39:25 2014 +0300
+++ b/src/lib-storage/index/pop3c/pop3c-client.c Mon Sep 08 18:11:31 2014 +0300
@@ -27,6 +27,7 @@
POP3C_CLIENT_STATE_DISCONNECTED = 0,
/* Trying to connect */
POP3C_CLIENT_STATE_CONNECTING,
+ POP3C_CLIENT_STATE_STARTTLS,
/* Connected, trying to authenticate */
POP3C_CLIENT_STATE_USER,
POP3C_CLIENT_STATE_AUTH,
@@ -68,6 +69,7 @@
pop3c_dns_callback(const struct dns_lookup_result *result,
struct pop3c_client *client);
static void pop3c_client_connect_ip(struct pop3c_client *client);
+static int pop3c_client_ssl_init(struct pop3c_client *client);
struct pop3c_client *
pop3c_client_init(const struct pop3c_client_settings *set)
@@ -267,6 +269,12 @@
io_loop_destroy(&ioloop);
}
+static void pop3c_client_starttls(struct pop3c_client *client)
+{
+ o_stream_nsend_str(client->output, "STLS\r\n");
+ client->state = POP3C_CLIENT_STATE_STARTTLS;
+}
+
static void pop3c_client_authenticate1(struct pop3c_client *client)
{
const struct pop3c_client_settings *set = &client->set;
@@ -339,7 +347,19 @@
client->set.host, line);
return -1;
}
- pop3c_client_authenticate1(client);
+ if (client->set.ssl_mode == POP3C_CLIENT_SSL_MODE_STARTTLS)
+ pop3c_client_starttls(client);
+ else
+ pop3c_client_authenticate1(client);
+ break;
+ case POP3C_CLIENT_STATE_STARTTLS:
+ if (!success) {
+ i_error("pop3c(%s): STLS failed: %s",
+ client->set.host, line);
+ return -1;
+ }
+ if (pop3c_client_ssl_init(client) < 0)
+ pop3c_client_disconnect(client);
break;
case POP3C_CLIENT_STATE_USER:
if (!success) {
More information about the dovecot-cvs
mailing list