]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
login: If proxy returns ssl=yes and no port, switch port to imaps/pop3s.
authorTimo Sirainen <tss@iki.fi>
Wed, 14 Apr 2010 16:19:27 +0000 (19:19 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 14 Apr 2010 16:19:27 +0000 (19:19 +0300)
--HG--
branch : HEAD

src/imap-login/client.c
src/login-common/client-common-auth.c
src/login-common/login-common.h
src/pop3-login/client.c

index daaa21ba870d4c0000931b5d1415a1aeefd964c4..1f1ca319700d9b854862b839f6da111318a90fc3 100644 (file)
@@ -30,7 +30,7 @@
 
 const char *login_protocol = "imap";
 const char *login_process_name = "imap-login";
-unsigned int login_default_port = 143;
+unsigned int login_default_port = 143, login_default_ssl_port = 993;
 
 void login_process_preinit(void)
 {
index 8c9d588037cf624bd281a9130e52103903036ca1..918b750fa33a554086cf3fa29b12d01f9ecb1146 100644 (file)
@@ -57,7 +57,6 @@ static void client_auth_parse_args(struct client *client,
        const char *key, *value, *p;
 
        memset(reply_r, 0, sizeof(*reply_r));
-       reply_r->port = login_default_port;
 
        for (; *args != NULL; args++) {
                p = strchr(*args, '=');
@@ -91,9 +90,11 @@ static void client_auth_parse_args(struct client *client,
                else if (strcmp(key, "master") == 0)
                        reply_r->master_user = value;
                else if (strcmp(key, "ssl") == 0) {
-                       if (strcmp(value, "yes") == 0)
+                       if (strcmp(value, "yes") == 0) {
                                reply_r->ssl_flags |= PROXY_SSL_FLAG_YES;
-                       else if (strcmp(value, "any-cert") == 0) {
+                               if (reply_r->port == 0)
+                                       reply_r->port = login_default_ssl_port;
+                       } else if (strcmp(value, "any-cert") == 0) {
                                reply_r->ssl_flags |= PROXY_SSL_FLAG_YES |
                                        PROXY_SSL_FLAG_ANY_CERT;
                        }
@@ -104,6 +105,8 @@ static void client_auth_parse_args(struct client *client,
                } else if (client->set->auth_debug)
                        i_debug("Ignoring unknown passdb extra field: %s", key);
        }
+       if (reply_r->port == 0)
+               reply_r->port = login_default_port;
 
        if (reply_r->destuser == NULL)
                reply_r->destuser = client->virtual_user;
index adacbb5c0bf0830050856efeac2d9c9e064133c4..e2601fe5a2ee4dfd74b02be96843bf60cc876086 100644 (file)
@@ -13,7 +13,7 @@
        "Plaintext authentication disallowed on non-secure (SSL/TLS) connections."
 
 extern const char *login_protocol, *login_process_name;
-extern unsigned int login_default_port;
+extern unsigned int login_default_port, login_default_ssl_port;
 
 extern struct auth_client *auth_client;
 extern struct master_auth *master_auth;
index 11f554620c4a844b5bef562613011f608ff7c402..025ff305de528095be45504dbd8c492cc5040104 100644 (file)
@@ -24,7 +24,7 @@
 
 const char *login_protocol = "pop3";
 const char *login_process_name = "pop3-login";
-unsigned int login_default_port = 110;
+unsigned int login_default_port = 110, login_default_ssl_port = 995;
 
 void login_process_preinit(void)
 {