Hey, I hacked something together..
It's a patch to both qmail (for stamping the headers in) and vpopmail. I don't know if it will apply cleanly to the qmail codebase as the patch file was generated off of qmail+qregex+tarpit+my mods This is probably worthless :) but here it is: *** CUT HERE *** --- qmail-1.03/qmail-smtpd.c.orig Wed Jan 8 10:25:11 2003 +++ qmail-1.03/qmail-smtpd.c Wed Jan 8 10:29:18 2003 @@ -86,6 +86,7 @@ char *remoteinfo; char *local; char *relayclient; +char *vpopusername; stralloc helohost = {0}; char *fakehelo; /* pointer into helohost, or 0 */ @@ -155,6 +156,7 @@ if (!remotehost) remotehost = "unknown"; remoteinfo = env_get("TCPREMOTEINFO"); relayclient = env_get("RELAYCLIENT"); + vpopusername = env_get("USERNAME"); dohelo(remotehost); } @@ -423,6 +425,7 @@ int hops; unsigned long qp; char *qqx; + char *popbeforebuf[128]; if (!seenmail) { err_wantmail(); return; } if (!rcptto.len) { err_wantrcpt(); return; } @@ -433,6 +436,12 @@ out("354 go ahead\r\n"); received(&qqt,"SMTP",local,remoteip,remotehost,remoteinfo,fakehelo); + if (vpopusername) + { + sprintf(popbeforebuf, "X-Pop-Before-SMTP-Sender: %s\n", vpopusername); + qmail_puts(&qqt, popbeforebuf); + } + blast(&hops); hops = (hops >= MAXHOPS); if (hops) qmail_fail(&qqt); --- vpopmail-5.2.1/vpopmail.c.orig Wed Jan 8 10:30:23 2003 +++ vpopmail-5.2.1/vpopmail.c Wed Jan 8 10:37:27 2003 @@ -2069,7 +2069,7 @@ } #ifdef POP_AUTH_OPEN_RELAY -int open_smtp_relay() +int open_smtp_relay(char *username, char *domainname) { #ifdef USE_SQL vopen_smtp_relay(); @@ -2140,8 +2140,8 @@ rebuild_cdb = 0; } } - fprintf( fs1, "%s:allow,RELAYCLIENT=\"\",RBLSMTPD=\"\" %d\n", - ipaddr, (int)mytime); + fprintf( fs1, "%s:allow,RELAYCLIENT=\"\",RBLSMTPD=\"\",USERNAME=\"%s@%s\" %d\n", + ipaddr, username, domainname, (int)mytime); fclose(fs); fclose(fs1); --- vpopmail-5.2.1/vpopmail.h.orig Wed Jan 8 10:42:53 2003 +++ vpopmail-5.2.1/vpopmail.h Wed Jan 8 10:38:28 2003 @@ -146,7 +146,7 @@ struct vqpasswd *vauth_user(char *user, char *domain, char *password, char *apop); int vmake_maildir(char *domain, char *dir); int vsqwebmail_pass( char *dir, char *crypted, uid_t uid, gid_t gid ); -int open_smtp_relay(); +int open_smtp_relay(char *username, char *domainname); unsigned long tcprules_open(); int vfd_copy(int,int); int vfd_move(int,int); --- vpopmail-5.2.1/vchkpw.c.orig Wed Jan 8 10:52:18 2003 +++ vpopmail-5.2.1/vchkpw.c Wed Jan 8 10:54:01 2003 @@ -401,7 +401,7 @@ #ifdef POP_AUTH_OPEN_RELAY /* Check if we should open up relay for this account */ if ( (vpw->pw_gid & NO_RELAY) == 0 ) { - open_smtp_relay(); + open_smtp_relay(TheUser, TheDomain); } #endif *** CUT HERE *** -----Original Message----- From: Peter Palmreuther [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 12:51 PM To: [EMAIL PROTECTED] Subject: Re: [vchkpw] POP before SMTP Hi Daniel, On Mon, 6 Jan 2003 12:22:54 -0500 "Daniel Corbe" <[EMAIL PROTECTED]> wrote: > Is there any way to get vpopmail to stamp the E-Mail address of the > person who popped into the server on any outgoing messages? Not yet. But an idea would be to modify vpopmail to not only put the IP-address and RELAYCLIENT="" of the caller into tcp.smtp.cdb but also TCPREMOTEINFO=<username>. Should be a rather easy patch. -- Pit
popbefore.patch
Description: Binary data