Petr Novotny <[EMAIL PROTECTED]> writes on 7 June 1999 at 09:44:11 +0100
 > -----BEGIN PGP SIGNED MESSAGE-----
 > Hash: SHA1
 > 
 > > What I want, of course, is the IP address the
 > > connect was from.  Has anybody patched rblsmtpd to log that >already?
 > 
 > This is what I did:
 > - ------- cut here -------
 > +++ rblsmtpd-0.70/rblsmtpd.c    Mon May 10 21:19:25 1999
 > @@ -75,6 +75,9 @@
 >         break;
 >        default:
 >          if (!stralloc_copys(&message,flagbounce ? "553 " : "451 ")) die_sys();
 > +       if (!stralloc_cats(&message,"(Remote IP: ")) die_sys();
 > +       if (!stralloc_cats(&message,x)) die_sys();
 > +       if (!stralloc_cats(&message,") ")) die_sys();
 >          if (!stralloc_cat(&message,&rbltext)) die_sys();
 >      }
 >    }
 > - ---- cut here ---
 > It works and I didn't see any leaks - after all, rblsmtpd exits frequently
 > anyway.
 > 
 > Comments anyone?

A little simpler than mine.  I *think* x sometimes has the RBLSMTP
environmnent variable rather than TCPREMOTEIP at that stage of the
code; I added a new variable and specifically preserved the IP
string. 

However, Bruce Guenther has pointed out that if you simply turn on
verbose logging (-v) in tcpserver, it gives you an extra line on
connect and disconnect which includes the IP.  So there's a way to get
the information with unpatched software, too.  (The man page for
tcpserver just says something like "all available messages" for -v; I
expected it would be too verbose and didn't try it.  Oops.) 
-- 
David Dyer-Bennet                                              [EMAIL PROTECTED]
http://www.ddb.com/~ddb (photos, sf) Minicon: http://www.mnstf.org/minicon
http://ouroboros.demesne.com/ The Ouroboros Bookworms
Join the 20th century before it's too late!

Reply via email to