tpop3d-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tpop3d-discuss]Found bug in netloop.c with TCP_WRAPPERS


From: Boris Kovalenko
Subject: [tpop3d-discuss]Found bug in netloop.c with TCP_WRAPPERS
Date: Sun, 13 Mar 2005 11:40:55 +0500
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

Hello!

Bug isn't critical, but should be fixed. The string returned by inet_ntoa() resides in a static memory area, so line

log_print(LOG_ERR, "net_loop: tcp_wrappers: connection from %s to local address %s:%d refused", inet_ntoa(sin.sin_addr), inet_ntoa(sinlocal.sin_addr), htons(sinlocal.sin_port));

is incorrect. The patch attached fixes this problem, but it is "dirty" and probably should be recoded.

With respect,
        Boris Kovalenko
--- netloop.c.orig      Tue Nov 25 00:58:28 2003
+++ netloop.c   Sun Mar 13 11:37:57 2005
@@ -140,7 +140,11 @@
 
 #ifdef USE_TCP_WRAPPERS
                 else if (!hosts_ctl(tcpwrappersname, STRING_UNKNOWN, 
inet_ntoa(sin.sin_addr), STRING_UNKNOWN)) {
-                    log_print(LOG_ERR, "net_loop: tcp_wrappers: connection 
from %s to local address %s:%d refused", inet_ntoa(sin.sin_addr), 
inet_ntoa(sinlocal.sin_addr), htons(sinlocal.sin_port));
+                   char        l_addr[16], r_addr[16];
+                   
+                   strcpy(r_addr, inet_ntoa(sin.sin_addr));
+                   strcpy(l_addr, inet_ntoa(sinlocal.sin_addr));
+                    log_print(LOG_ERR, "net_loop: tcp_wrappers: connection 
from %s to local address %s:%d refused", r_addr, l_addr, 
htons(sinlocal.sin_port));
                     close(s);
                 }
 #endif

reply via email to

[Prev in Thread] Current Thread [Next in Thread]