Adam Hasselbalch Hansen wrote:
Enclosed is a patch that makes imapd log originating port number in addition to ip.

This is due to new legislation in Denmark, requiring ISPs and hosting companies to log the originating port of all traffic.

This has been successfully applied to 0.53.3 and 0.56.0.

I forgot the pop-part. It is enclosed.

/Adam



--- courier-0.56.0/imap/pop3dserver.c	2007-09-20 16:04:10.000000000 +0200
+++ courier-0.56.0-new/imap/pop3dserver.c	2007-09-20 16:04:20.000000000 +0200
@@ -62,7 +62,7 @@
 extern void pop3dcapa();
 static void acctout(const char *disc);
 
-static const char *authaddr, *remoteip;
+static const char *authaddr, *remoteip, *remoteport;
 
 struct msglist {
 	struct msglist *next;
@@ -794,6 +794,7 @@
 {
 	static const char msg2[]=", user=";
 	static const char msg3[]=", ip=[";
+	static const char msgport[]="], port=[";
 	static const char msg4[]="], top=";
 	static const char msg5[]=", retr=";
 	static const char msg6[]=", time=";
@@ -816,7 +817,7 @@
 	libmail_str_size_t(bytes_received_count, numAR);
 	libmail_str_size_t(bytes_sent_count, numAS);
 
-	p=malloc(strlen(authaddr)+strlen(remoteip)+strlen(disc)+
+	p=malloc(strlen(authaddr)+strlen(remoteip)+strlen(remoteport)+strlen(disc)+
 		 strlen(num1)+strlen(num2)+strlen(num3)+
 		 strlen(numAR)+strlen(numAS)+200);	/* Should be enough */
 
@@ -825,6 +826,8 @@
 	strcat(p, authaddr);
 	strcat(p, msg3);
 	strcat(p, remoteip);
+	strcat(p, msgport);
+	strcat(p, remoteport);
 	strcat(p, msg4);
 	strcat(p, num1);
 	strcat(p, msg5);
@@ -1020,13 +1023,15 @@
 	if ((remoteip=getenv("TCPREMOTEIP")) == NULL)
 		remoteip="127.0.0.1";
 
+	remoteport=getenv("TCPREMOTEPORT");
+
 	{
 	struct	stat	buf;
 
 		if ( stat(".", &buf) < 0 || buf.st_mode & S_ISVTX)
 		{
-			fprintf(stderr, "INFO: LOCKED, user=%s, ip=[%s]\n",
-				authaddr, remoteip);
+			fprintf(stderr, "INFO: LOCKED, user=%s, ip=[%s], port=[%s]\n",
+							authaddr, remoteip, remoteport);
 			printed(printf("-ERR Your account is temporarily unavailable (+t bit set on home directory).\r\n"));
 			exit(0);
 		}
@@ -1057,9 +1062,10 @@
 		exit(1);
 	}
 
-	fprintf(stderr, "INFO: LOGIN, user=%s, ip=[%s]\n",
+	fprintf(stderr, "INFO: LOGIN, user=%s, ip=[%s], port=[%s]\n",
 			authaddr,
-			remoteip);
+					remoteip,
+					remoteport);
 	fflush(stderr);
 
 	msglist_cnt=0;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Courier-imap mailing list
Courier-imap@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-imap

Reply via email to