dovecot-2.2: doveadm: If passdb lookup returns port, use it to o...

dovecot at dovecot.org dovecot at dovecot.org
Fri Nov 14 06:57:16 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/2fff557c9837
changeset: 18086:2fff557c9837
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Nov 13 22:55:59 2014 -0800
description:
doveadm: If passdb lookup returns port, use it to override the doveadm_port setting.

diffstat:

 src/doveadm/doveadm-mail-server.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (40 lines):

diff -r 3eba1442493d -r 2fff557c9837 src/doveadm/doveadm-mail-server.c
--- a/src/doveadm/doveadm-mail-server.c	Fri Nov 14 02:00:12 2014 +0200
+++ b/src/doveadm/doveadm-mail-server.c	Thu Nov 13 22:55:59 2014 -0800
@@ -179,7 +179,7 @@
 	struct auth_user_info info;
 	pool_t pool;
 	const char *auth_socket_path, *proxy_host, *const *fields;
-	unsigned int i;
+	unsigned int i, proxy_port;
 	bool proxying;
 	int ret;
 
@@ -214,12 +214,17 @@
 		   so just continue with the default host */
 	} else {
 		proxy_host = NULL; proxying = FALSE;
+		proxy_port = ctx->set->doveadm_port;
 		for (i = 0; fields[i] != NULL; i++) {
 			if (strncmp(fields[i], "proxy", 5) == 0 &&
 			    (fields[i][5] == '\0' || fields[i][5] == '='))
 				proxying = TRUE;
 			else if (strncmp(fields[i], "host=", 5) == 0)
 				proxy_host = fields[i]+5;
+			else if (strncmp(fields[i], "port=", 5) == 0) {
+				if (str_to_uint(fields[i]+5, &proxy_port) < 0)
+					proxy_port = 0;
+			}
 		}
 		if (!proxying)
 			ret = 0;
@@ -233,8 +238,7 @@
 			}
 			ret = -1;
 		} else {
-			*host_r = t_strdup_printf("%s:%u", proxy_host,
-						  ctx->set->doveadm_port);
+			*host_r = t_strdup_printf("%s:%u", proxy_host, proxy_port);
 		}
 	}
 	pool_unref(&pool);


More information about the dovecot-cvs mailing list