[dovecot-cvs] dovecot/src/login-common login-proxy.c,1.9,1.10

cras at dovecot.org cras at dovecot.org
Sun Apr 2 13:46:44 EEST 2006


Update of /var/lib/cvs/dovecot/src/login-common
In directory talvi:/tmp/cvs-serv23034

Modified Files:
	login-proxy.c 
Log Message:
Show client IP properly also with SSL connections.



Index: login-proxy.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/login-common/login-proxy.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- login-proxy.c	26 Feb 2006 10:05:23 -0000	1.9
+++ login-proxy.c	2 Apr 2006 10:46:42 -0000	1.10
@@ -16,6 +16,7 @@
 	struct io *client_io, *server_io;
 	struct istream *server_input;
 	struct ostream *client_output, *server_output;
+	struct ip_addr ip;
 
 	char *host, *user;
 	unsigned int port;
@@ -177,13 +178,14 @@
 	proxy->callback = callback;
 	proxy->context = context;
 
+	proxy->ip = client->ip;
 	proxy->client_fd = -1;
 	return proxy;
 }
 
 void login_proxy_free(struct login_proxy *proxy)
 {
-	struct ip_addr ip;
+	const char *ipstr;
 
 	if (proxy->destroying)
 		return;
@@ -193,10 +195,9 @@
 		main_unref();
 		hash_remove(login_proxies, proxy);
 
-		if (net_getpeername(proxy->client_fd, &ip, NULL) < 0)
-			ip.family = 0;
+		ipstr = net_ip2addr(&proxy->ip);
 		i_info("proxy(%s): disconnecting %s",
-		       proxy->user, net_ip2addr(&ip));
+		       proxy->user, ipstr != NULL ? ipstr : "");
 
 		if (proxy->client_io != NULL)
 			io_remove(&proxy->client_io);



More information about the dovecot-cvs mailing list