dovecot-2.2: doveadm-server: Pass local/remote_ip/port to passdb...

dovecot at dovecot.org dovecot at dovecot.org
Tue May 28 17:10:11 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/feee5a1527d9
changeset: 16407:feee5a1527d9
user:      Timo Sirainen <tss at iki.fi>
date:      Tue May 28 17:10:03 2013 +0300
description:
doveadm-server: Pass local/remote_ip/port to passdb lookups so proxy_maybe works.

diffstat:

 src/doveadm/client-connection.c   |  9 ++++++---
 src/doveadm/client-connection.h   |  1 +
 src/doveadm/doveadm-mail-server.c |  4 ++++
 3 files changed, 11 insertions(+), 3 deletions(-)

diffs (58 lines):

diff -r c40d67ee9de2 -r feee5a1527d9 src/doveadm/client-connection.c
--- a/src/doveadm/client-connection.c	Tue May 28 16:30:38 2013 +0300
+++ b/src/doveadm/client-connection.c	Tue May 28 17:10:03 2013 +0300
@@ -166,6 +166,10 @@
 
 	memset(&input, 0, sizeof(input));
 	input.service = "doveadm";
+	input.local_ip = conn->local_ip;
+	input.remote_ip = conn->remote_ip;
+	input.local_port = conn->local_port;
+	input.remote_port = conn->remote_port;
 
 	for (argc = 0; args[argc] != NULL; argc++)
 		args[argc] = str_tabunescape(args[argc]);
@@ -390,7 +394,6 @@
 client_connection_create(int fd, int listen_fd, bool ssl)
 {
 	struct client_connection *conn;
-	unsigned int port;
 	pool_t pool;
 
 	pool = pool_alloconly_create("doveadm client", 1024*16);
@@ -402,8 +405,8 @@
 	conn->output = o_stream_create_fd(fd, (size_t)-1, FALSE);
 	o_stream_set_no_error_handling(conn->output, TRUE);
 
-	(void)net_getsockname(fd, &conn->local_ip, &port);
-	(void)net_getpeername(fd, &conn->remote_ip, &port);
+	(void)net_getsockname(fd, &conn->local_ip, &conn->local_port);
+	(void)net_getpeername(fd, &conn->remote_ip, &conn->remote_port);
 
 	if (client_connection_read_settings(conn) < 0) {
 		client_connection_destroy(&conn);
diff -r c40d67ee9de2 -r feee5a1527d9 src/doveadm/client-connection.h
--- a/src/doveadm/client-connection.h	Tue May 28 16:30:38 2013 +0300
+++ b/src/doveadm/client-connection.h	Tue May 28 17:10:03 2013 +0300
@@ -12,6 +12,7 @@
 	struct ostream *output;
 	struct ssl_iostream *ssl_iostream;
 	struct ip_addr local_ip, remote_ip;
+	unsigned int local_port, remote_port;
 	const struct doveadm_settings *set;
 
 	unsigned int handshaked:1;
diff -r c40d67ee9de2 -r feee5a1527d9 src/doveadm/doveadm-mail-server.c
--- a/src/doveadm/doveadm-mail-server.c	Tue May 28 16:30:38 2013 +0300
+++ b/src/doveadm/doveadm-mail-server.c	Tue May 28 17:10:03 2013 +0300
@@ -190,6 +190,10 @@
 
 	memset(&info, 0, sizeof(info));
 	info.service = master_service_get_name(master_service);
+	info.local_ip = input->local_ip;
+	info.remote_ip = input->remote_ip;
+	info.local_port = input->local_port;
+	info.remote_port = input->remote_port;
 
 	pool = pool_alloconly_create("auth lookup", 1024);
 	auth_conn = mail_storage_service_get_auth_conn(ctx->storage_service);


More information about the dovecot-cvs mailing list