dovecot-1.2: imap/pop3-login: If proxy returns ssl=yes, change t...

dovecot at dovecot.org dovecot at dovecot.org
Wed Apr 14 19:14:26 EEST 2010


details:   http://hg.dovecot.org/dovecot-1.2/rev/9d472f43bcdb
changeset: 9559:9d472f43bcdb
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Apr 14 19:14:24 2010 +0300
description:
imap/pop3-login: If proxy returns ssl=yes, change the default port to 993/995.

diffstat:

 src/imap-login/client-authenticate.c |  9 ++++++---
 src/pop3-login/client-authenticate.c |  9 ++++++---
 2 files changed, 12 insertions(+), 6 deletions(-)

diffs (68 lines):

diff -r cf3fe573a560 -r 9d472f43bcdb src/imap-login/client-authenticate.c
--- a/src/imap-login/client-authenticate.c	Tue Apr 13 12:49:48 2010 +0300
+++ b/src/imap-login/client-authenticate.c	Wed Apr 14 19:14:24 2010 +0300
@@ -127,7 +127,7 @@
 	const char *key, *value, *p;
 	enum login_proxy_ssl_flags ssl_flags = 0;
 	string_t *reply;
-	unsigned int port = 143;
+	unsigned int port = 0;
 	unsigned int proxy_timeout_msecs = 0;
 	bool proxy = FALSE, temp = FALSE, nologin = !success;
 	bool authz_failure = FALSE;
@@ -167,9 +167,10 @@
 		else if (strcmp(key, "master") == 0)
 			master_user = value;
 		else if (strcmp(key, "ssl") == 0) {
-			if (strcmp(value, "yes") == 0)
+			if (strcmp(value, "yes") == 0) {
 				ssl_flags |= PROXY_SSL_FLAG_YES;
-			else if (strcmp(value, "any-cert") == 0) {
+				port = 993;
+			} else if (strcmp(value, "any-cert") == 0) {
 				ssl_flags |= PROXY_SSL_FLAG_YES |
 					PROXY_SSL_FLAG_ANY_CERT;
 			}
@@ -181,6 +182,8 @@
 			i_info("Ignoring unknown passdb extra field: %s", key);
 		}
 	}
+	if (port == 0)
+		port = 143;
 
 	if (destuser == NULL)
 		destuser = client->common.virtual_user;
diff -r cf3fe573a560 -r 9d472f43bcdb src/pop3-login/client-authenticate.c
--- a/src/pop3-login/client-authenticate.c	Tue Apr 13 12:49:48 2010 +0300
+++ b/src/pop3-login/client-authenticate.c	Wed Apr 14 19:14:24 2010 +0300
@@ -129,7 +129,7 @@
 	const char *key, *value, *p;
 	enum login_proxy_ssl_flags ssl_flags = 0;
 	string_t *reply;
-	unsigned int port = 110;
+	unsigned int port = 0;
 	unsigned int proxy_timeout_msecs = 0;
 	bool proxy = FALSE, temp = FALSE, nologin = !success;
 
@@ -166,9 +166,10 @@
 		else if (strcmp(key, "master") == 0)
 			master_user = value;
 		else if (strcmp(key, "ssl") == 0) {
-			if (strcmp(value, "yes") == 0)
+			if (strcmp(value, "yes") == 0) {
 				ssl_flags |= PROXY_SSL_FLAG_YES;
-			else if (strcmp(value, "any-cert") == 0) {
+				port = 995;
+			} else if (strcmp(value, "any-cert") == 0) {
 				ssl_flags |= PROXY_SSL_FLAG_YES |
 					PROXY_SSL_FLAG_ANY_CERT;
 			}
@@ -180,6 +181,8 @@
 			i_info("Ignoring unknown passdb extra field: %s", key);
 		}
 	}
+	if (port == 0)
+		port = 110;
 
 	if (destuser == NULL)
 		destuser = client->common.virtual_user;


More information about the dovecot-cvs mailing list