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.

Adam
--- imapd.c.old 2006-05-30 02:30:35.000000000 +0200
+++ imapd.c     2007-09-18 15:17:52.000000000 +0200
@@ -6186,7 +6186,7 @@
 }
 #endif
 
-static void chkdisabled(const char *ip)
+static void chkdisabled(const char *ip, const char *port)
 {
        if (auth_getoptionenvint("disableimap"))
        {
@@ -6195,8 +6195,8 @@
                exit(0);
        }
 
-       fprintf(stderr, "INFO: LOGIN, user=%s, ip=[%s], protocol=%s\n",
-               getenv("AUTHENTICATED"), ip,
+  fprintf(stderr, "INFO: LOGIN, user=%s, ip=[%s], port=[%s], protocol=%s\n",
+                                       getenv("AUTHENTICATED"), ip, port,
                protocol);
 }
 
@@ -6205,6 +6205,7 @@
        const char *ip;
        const char *p;
        const char *tag;
+       const char *port;
        mode_t oldumask;
 
        time(&start_time);
@@ -6259,6 +6260,8 @@
        ip=getenv("TCPREMOTEIP");
        if (!ip || !*ip)        exit(0);
 
+       port=getenv("TCPREMOTEPORT");
+       
        protocol=getenv("PROTOCOL");
 
        if (!protocol || !*protocol)
@@ -6280,8 +6283,8 @@
 
                if ( stat(".", &buf) < 0 || buf.st_mode & S_ISVTX)
                {
-                       fprintf(stderr, "INFO: LOCKED, user=%s, ip=[%s]\n",
-                               getenv("AUTHENTICATED"), ip);
+       fprintf(stderr, "INFO: LOCKED, user=%s, ip=[%s], port=[%s]\n",
+                                       getenv("AUTHENTICATED"), ip, port);
                        writes("* BYE Your account is temporarily unavailable 
(+t bit set on home directory).\r\n");
                        writeflush();
                        exit(0);
@@ -6374,7 +6377,7 @@
                libmail_kwVerbotten=KEYWORD_SMAPVERBOTTEN;
                libmail_kwCaseSensitive=1;
 
-               chkdisabled(ip);
+      chkdisabled(ip, port);
                smap();
                logoutmsg();
                emptytrash();
@@ -6390,7 +6393,7 @@
        else
                writes("* PREAUTH Ready.\r\n");
        writeflush();
-       chkdisabled(ip);
+  chkdisabled(ip, port);
        imapscan_init(&current_maildir_info);
        mainloop();
        bye();
-------------------------------------------------------------------------
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