dovecot-2.2: proxying cleanup: Send TTL=1 (instead of TTL=0) as ...

dovecot at dovecot.org dovecot at dovecot.org
Fri Feb 22 12:42:40 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/48c1c58948f5
changeset: 15887:48c1c58948f5
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Feb 22 12:42:26 2013 +0200
description:
proxying cleanup: Send TTL=1 (instead of TTL=0) as "no more proxying".

diffstat:

 src/imap-login/imap-proxy.c    |  2 +-
 src/lib-lda/lmtp-client.c      |  6 +++---
 src/lib-lda/lmtp-client.h      |  4 ++--
 src/lmtp/commands.c            |  2 +-
 src/lmtp/lmtp-proxy.c          |  3 ++-
 src/login-common/login-proxy.c |  2 +-
 src/pop3-login/pop3-proxy.c    |  2 +-
 7 files changed, 11 insertions(+), 10 deletions(-)

diffs (106 lines):

diff -r 8740056e9b2f -r 48c1c58948f5 src/imap-login/imap-proxy.c
--- a/src/imap-login/imap-proxy.c	Fri Feb 22 10:32:05 2013 +0200
+++ b/src/imap-login/imap-proxy.c	Fri Feb 22 12:42:26 2013 +0200
@@ -29,7 +29,7 @@
 
 static void proxy_write_id(struct imap_client *client, string_t *str)
 {
-	i_assert(client->common.proxy_ttl > 0);
+	i_assert(client->common.proxy_ttl > 1);
 
 	str_printfa(str, "I ID ("
 		    "\"x-session-id\" \"%s\" "
diff -r 8740056e9b2f -r 48c1c58948f5 src/lib-lda/lmtp-client.c
--- a/src/lib-lda/lmtp-client.c	Fri Feb 22 10:32:05 2013 +0200
+++ b/src/lib-lda/lmtp-client.c	Fri Feb 22 12:42:26 2013 +0200
@@ -97,7 +97,7 @@
 		p_strdup(pool, set->dns_client_socket_path);
 	client->set.source_ip = set->source_ip;
 	client->set.source_port = set->source_port;
-	client->set.proxy_ttl_plus_1 = set->proxy_ttl_plus_1;
+	client->set.proxy_ttl = set->proxy_ttl;
 	client->set.proxy_timeout_secs = set->proxy_timeout_secs;
 	client->finish_callback = finish_callback;
 	client->finish_context = context;
@@ -433,9 +433,9 @@
 	if (client->set.source_port != 0 &&
 	    str_array_icase_find(client->xclient_args, "PORT"))
 		str_printfa(str, " PORT=%u", client->set.source_port);
-	if (client->set.proxy_ttl_plus_1 != 0 &&
+	if (client->set.proxy_ttl != 0 &&
 	    str_array_icase_find(client->xclient_args, "TTL"))
-		str_printfa(str, " TTL=%u", client->set.proxy_ttl_plus_1-1);
+		str_printfa(str, " TTL=%u", client->set.proxy_ttl);
 	if (client->set.proxy_timeout_secs != 0 &&
 	    str_array_icase_find(client->xclient_args, "TIMEOUT"))
 		str_printfa(str, " TIMEOUT=%u", client->set.proxy_timeout_secs);
diff -r 8740056e9b2f -r 48c1c58948f5 src/lib-lda/lmtp-client.h
--- a/src/lib-lda/lmtp-client.h	Fri Feb 22 10:32:05 2013 +0200
+++ b/src/lib-lda/lmtp-client.h	Fri Feb 22 12:42:26 2013 +0200
@@ -21,8 +21,8 @@
 	   send the these as ADDR/PORT/TTL/TIMEOUT */
 	struct ip_addr source_ip;
 	unsigned int source_port;
-	/* send TTL as this -1, so the default 0 means "don't send it" */
-	unsigned int proxy_ttl_plus_1;
+	/* send TTL as this (default 0 means "don't send it") */
+	unsigned int proxy_ttl;
 	/* remote is notified that the connection is going to be closed after
 	   this many seconds, so it should try to keep lock waits and such
 	   lower than this. */
diff -r 8740056e9b2f -r 48c1c58948f5 src/lmtp/commands.c
--- a/src/lmtp/commands.c	Fri Feb 22 10:32:05 2013 +0200
+++ b/src/lmtp/commands.c	Fri Feb 22 12:42:26 2013 +0200
@@ -297,7 +297,7 @@
 		return TRUE;
 	}
 
-	if (client->proxy_ttl == 0) {
+	if (client->proxy_ttl <= 1) {
 		i_error("Proxying to <%s> appears to be looping (TTL=0)",
 			username);
 		client_send_line(client, "554 5.4.6 <%s> "
diff -r 8740056e9b2f -r 48c1c58948f5 src/lmtp/lmtp-proxy.c
--- a/src/lmtp/lmtp-proxy.c	Fri Feb 22 10:32:05 2013 +0200
+++ b/src/lmtp/lmtp-proxy.c	Fri Feb 22 12:42:26 2013 +0200
@@ -61,6 +61,7 @@
 	struct lmtp_proxy *proxy;
 	pool_t pool;
 
+	i_assert(set->proxy_ttl > 0);
 	o_stream_ref(client_output);
 
 	pool = pool_alloconly_create("lmtp proxy", 1024);
@@ -136,7 +137,7 @@
 	client_set.dns_client_socket_path = proxy->set.dns_client_socket_path;
 	client_set.source_ip = proxy->set.source_ip;
 	client_set.source_port = proxy->set.source_port;
-	client_set.proxy_ttl_plus_1 = proxy->set.proxy_ttl+1;
+	client_set.proxy_ttl = proxy->set.proxy_ttl;
 	client_set.proxy_timeout_secs = set->timeout_msecs/1000;
 
 	conn = p_new(proxy->pool, struct lmtp_proxy_connection, 1);
diff -r 8740056e9b2f -r 48c1c58948f5 src/login-common/login-proxy.c
--- a/src/login-common/login-proxy.c	Fri Feb 22 10:32:05 2013 +0200
+++ b/src/login-common/login-proxy.c	Fri Feb 22 12:42:26 2013 +0200
@@ -299,7 +299,7 @@
 		return -1;
 	}
 
-	if (client->proxy_ttl == 0) {
+	if (client->proxy_ttl <= 1) {
 		i_error("proxy(%s): TTL reached zero - "
 			"proxies appear to be looping?", client->virtual_user);
 		return -1;
diff -r 8740056e9b2f -r 48c1c58948f5 src/pop3-login/pop3-proxy.c
--- a/src/pop3-login/pop3-proxy.c	Fri Feb 22 10:32:05 2013 +0200
+++ b/src/pop3-login/pop3-proxy.c	Fri Feb 22 12:42:26 2013 +0200
@@ -37,7 +37,7 @@
 {
 	string_t *str;
 
-	i_assert(client->common.proxy_ttl > 0);
+	i_assert(client->common.proxy_ttl > 1);
 	if (client->proxy_xclient) {
 		/* remote supports XCLIENT, send it */
 		o_stream_nsend_str(output, t_strdup_printf(


More information about the dovecot-cvs mailing list