#ANNEXE 22 - Patch pop-before-smtp-1.35 modifie pour popa3d-0.6.4.1.tar.gz #========================================================================= # # # Patch pop-before-smtp-1.35/contrib/popa3d/popa3d-0.4.patch # modifie pour popa3d-0.6.4.1.tar.gz # Source : http://popbsmtp.sourceforge.net/ # diff -urbBaN popa3d-0.6.4.1/pop_auth.c popa3d-0.6.4.1_my/pop_auth.c --- popa3d-0.6.4.1/pop_auth.c Mon Sep 9 13:07:48 2002 +++ popa3d-0.6.4.1_my/pop_auth.c Mon Aug 16 14:33:08 2004 @@ -7,6 +7,8 @@ #include #include +#include "popbsmtpsupport.h" + #include "misc.h" #include "params.h" #include "protocol.h" @@ -75,15 +77,15 @@ #if POP_VIRTUAL if (virtual_domain) { syslog(result == AUTH_OK ? SYSLOG_PRI_LO : SYSLOG_PRI_HI, - "Authentication %s for %s@%s", + "Authentication %s for %s@%s -- [%s]", result == AUTH_OK ? "passed" : "failed", user ? user : "UNKNOWN USER", - virtual_domain); + virtual_domain, inet_ntoa(saddr.sin_addr)); return; } #endif syslog(result == AUTH_OK ? SYSLOG_PRI_LO : SYSLOG_PRI_HI, - "Authentication %s for %s", + "Authentication %s for %s -- [%s]", result == AUTH_OK ? "passed" : "failed", - user ? user : "UNKNOWN USER"); + user ? user : "UNKNOWN USER",inet_ntoa(saddr.sin_addr)); } diff -urbBaN popa3d-0.6.4.1/pop_root.c popa3d-0.6.4.1_my/pop_root.c --- popa3d-0.6.4.1/pop_root.c Thu Mar 21 21:15:19 2002 +++ popa3d-0.6.4.1_my/pop_root.c Mon Aug 16 14:34:14 2004 @@ -44,6 +44,8 @@ static char *user; static char *spool, *mailbox; +#include "popbsmtpsupport.h" + int log_error(char *s) { syslog(SYSLOG_PRI_ERROR, "%s: %m", s); @@ -207,6 +209,13 @@ if (virtual_startup()) return 1; #endif +#if !POP_STANDALONE + slen = sizeof(saddr); + if (getpeername(0, (struct sockaddr *)&saddr, &slen)<0) { + syslog(SYSLOG_PRIORITY, "getpeername(0) failed"); + return 1; + } +#endif return 0; } diff -urbBaN popa3d-0.6.4.1/popbsmtpsupport.h popa3d-0.6.4.1_my/popbsmtpsupport.h --- popa3d-0.6.4.1/popbsmtpsupport.h Thu Jan 1 01:00:00 1970 +++ popa3d-0.6.4.1_my/popbsmtpsupport.h Mon Aug 16 14:35:58 2004 @@ -0,0 +1,16 @@ +#ifndef _SYS_TYPES_H_ +#include +#endif +#ifndef _SYS_SOCKET_H_ +#include +#endif +#ifndef _NETINET_IN_H_ +#include +#endif +#ifndef _ARPA_INET_H_ +#include +#endif + +struct sockaddr_in saddr; +int slen; + diff -urbBaN popa3d-0.6.4.1/standalone.c popa3d-0.6.4.1_my/standalone.c --- popa3d-0.6.4.1/standalone.c Sun Mar 9 20:34:23 2003 +++ popa3d-0.6.4.1_my/standalone.c Mon Aug 16 14:35:29 2004 @@ -28,6 +28,8 @@ int deny_severity = SYSLOG_PRI_HI; #endif +#include "popbsmtpsupport.h" + /* * These are defined in pop_root.c. */ @@ -171,6 +173,7 @@ addrlen = sizeof(addr); new = accept(sock, (struct sockaddr *)&addr, &addrlen); + memcpy(&saddr, &addr, addrlen); /* * I wish there was a portable way to classify errno's... In this case, * it appears to be better to risk eating up the CPU on a fatal error