changeset 9559:9d472f43bcdb HEAD

imap/pop3-login: If proxy returns ssl=yes, change the default port to 993/995.
author Timo Sirainen <tss@iki.fi>
date Wed, 14 Apr 2010 19:14:24 +0300
parents cf3fe573a560
children a6d0fa17ddee
files src/imap-login/client-authenticate.c src/pop3-login/client-authenticate.c
diffstat 2 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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;
--- 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;