[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: X-Envelope-From?



On Thu, Apr 17, 2003 at 04:25:23PM +0200, Marek Kowal wrote:
> >   That is defined in the original RFC 821 way back -- and is called:
> >     Return-Path:
> >   :-)
> 
> Ahh, but I meant the Zmailer doing its own job, no matter what the client
> declares in the message headers. Probably I didn't phrase it right, what I

The "Return-Path:" is reserved to be (over-)written by the local-delivery
subsystem.  If client supples message with such, local-delivery will just
simply overwrite it.  (In ZMailer: remove it, and create its own.)

> meant was what I have just found in the (unfortunately!) TODO section of
> Zmailer:
> 
>         - Store the ORCPT information into a "X-Orcpt-To: "-header
>         - Store the NRCPT information into a "X-InRcpt-To: "-header
>         - Store the ENVID information into a "X-Envid: "-header
>         - Store the original FROM:<..> into a "X-OrigFrom: "-header
> 
> I meant the last point of that list. Anyway, since it has not been done,
> I've put the following code into my TA (we have developed our own):

I think you are looking for this:

 $ grep INFROM */*.[c1-8]
 man/mailbox.8:.IP INFROM
 smtpserver/smtpcmds.c:  fputs(" INFROM=rfc822;", SS->mfp);
 $ grep INFROM */*/*.c
 compat/sendmail/sendmail.c:       fprintf(mfp, " INFROM=rfc822;");
 transports/hold/hold.c:         fprintf(mfp," INFROM=%s",rp->infrom);
 transports/libta/ctlopen.c:           if (CISTREQN("INFROM=",s,7)) {
 transports/mailbox/mailbox.c:       sprintf(cp,"INFROM=%.999s",rp->infrom);
 transports/reroute/reroute.c:         fprintf(mfp," INFROM=%s",rp->infrom);

When mailbox runs a pipe to deliver something, there is
environment variable with that data:
     INFROM=rfc822;jdskjfdskfjskd@jdshfjdshf

It is not output to any sort of local header when storing to mailbox,
nor (naturally) when delivering with LMTP to a message store.

However, in _most_ cases that data is same as what local-delivery writes
into the   Return-Path:   header.



> (...)
> #define XSENDERFROM "X-OrigFrom: "
> 
>     len += strlen(XSENDERFROM);
>     len += strlen(dp->senders->user);
> 
> (...)
> 
>     header = realloc(header,len);
>     hlen+=sprintf(header+hlen,"%s%s\r\n\r\n",XSENDERFROM,dp->senders->user);
> (...)


Code fragment from   mailbox.c :

   fromuser = rp->addr->link->user;
   if (*fromuser == 0 ||
       STREQ(rp->addr->link->channel, "error"))
       fromuser = "";

   do {
	hdrs = has_header(rp,"Return-Path:");
	if (hdrs) delete_header(rp,hdrs);
   } while (hdrs);

   append_header(rp,"Return-Path: <%.999s>", fromuser);


> Unfortunately, with this implementation, the X-OrigFrom: is added only in my
> cnp-ta, so for example mails that I'm just relaying remain anonymous ;-(

Nope, it is left for the task of the remote system to preserve
the  MAIL FROM   information (or alter it as it pleases) when
sending onwards.  In the end, when a message is stored somewhere,
RFC 821 says that local delivery shall add "Return-Path:" header
with that MAIL FROM value in it.

Should there be some way to add extra headers with arbitrary contents
into the messages ?  perhaps something like it fits into  smtpserver ?
E.g.: 
    X-posted-from-IP: $I
    X-posted-by-user: $U
    X-posting-time: $T
    X-Abuse-Contact: abuse@this.isp.here
    X-Abuse-Data: $U / $I
or:
    X-Abuse-Contact: abuse@this.isp.here
    X-Abuse-Data: $U / $I / $T

But only do that, when there is authenticated user ?
(either explicitely, or by 'whoson' "pop-before-post"...)

I do think that smtpserver would be the best place for it.
(but also that the issue is not trivial to make generically
suitable for everybody.)

> Cheers,
> Marek.
-- 
/Matti Aarnio	<mea@nic.funet.fi>
-
To unsubscribe from this list: send the line "unsubscribe zmailer" in
the body of a message to majordomo@nic.funet.fi