dean@coplex.uucp (Dean Brooks) (04/21/91)
Well, I have been using smail3.1.19 for several months now, and everything works better than I ever imagined. However, there is one problem that I have, and can't seem to figure out a clean way to do it. I have several mail servers that are aliased via the pipe-driver transport. The message comes in, gets piped through our scripts and then we generate a response; your typical archive server type stuff. I have been relying on the $SENDER environment variable to determine the correct return address, but I am having major problems with it. It appears that the SENDER variable is created from the "From" line (not the "From:" header) in the message that is *supposed* to be created by the UUCP transport system. Of course, several uucp sites around me don't correctly put their entry in the message headers (no "Receieved:" lines). Is there an environment variable (or a way to do this) that will allow me to use the "From:" (not the UUCP "From") line with all the name-comments and other garbage stipped off? I would like to have a "@" type address if possible rather than a bang path, althought probably not possible. If its not possible, would it be easy for me to hack in the code? -- dean@coplex.uucp (Dean Brooks) Copper Electronics, Inc. Louisville, Kentucky
les@chinet.chi.il.us (Leslie Mikesell) (04/22/91)
In article <1991Apr20.194832.21739@coplex.uucp> dean@coplex.uucp (Dean Brooks) writes: > I have been relying on the $SENDER environment variable to >determine the correct return address, but I am having major problems >with it. It appears that the SENDER variable is created from the >"From" line (not the "From:" header) in the message that is *supposed* >to be created by the UUCP transport system. > Of course, several uucp sites around me don't correctly put their >entry in the message headers (no "Receieved:" lines). Is there an >environment variable (or a way to do this) that will allow me to use >the "From:" (not the UUCP "From") line with all the name-comments >and other garbage stipped off? I would like to have a "@" type address >if possible rather than a bang path, althought probably not possible. Keep in mind that the address in $SENDER is where error bounces will go, so if it is not usable your problems are worse than you think. It is pretty unusual for a uucp site not to update the From_ line, although they may not add a Received: header line. If you can't respond back the From_ path, most likely a non-uucp transport has munged it or the patch isn't bi-directional. Neither situation is robust for returning error messages so it deserves to be fixed. > If its not possible, would it be easy for me to hack in the code? Except for sheer size, the smail3 code is pretty easy to follow. However, since you are already piping to a program that has to parse the message, why not just grab the From: line there, or use a front-end like Deliver to parse the headers and give you the body. If your server has to contend with unusable "envelope-from" addresses, you should have some mechanism to let the users give you an alternate address within the body of the message anyway. Lots of transports mung all the header lines just to be consistent. It is pretty much impossible to have a non-domain uucp address passed through the internet and back to a uucp site in a replyable form. Les Mikesell les@chinet.chi.il.us
tron@Veritas.COM (Ronald S. Karr) (04/23/91)
In article <1991Apr20.194832.21739@coplex.uucp> dean@coplex.uucp (Dean Brooks) writes: > Of course, several uucp sites around me don't correctly put their >entry in the message headers (no "Receieved:" lines). Is there an >environment variable (or a way to do this) that will allow me to use >the "From:" (not the UUCP "From") line with all the name-comments >and other garbage stipped off? I would like to have a "@" type address >if possible rather than a bang path, althought probably not possible. In the general case this is impossible. The reason is that the From: header is not guarranteed to contain exactly one address (see RFC822). However, I suppose that smail could be modified to get the first address. Indeed, it is a reasonable enhancement idea. To do this, you would need to find the from: header in the header list, and then grab out the first address. The following code added to pipe.c:get_pipe_env() should do it: struct list *hp; struct addr *from_addr; char *error; ... for (hp = header; hp; hp = hp->succ) { if (HDREQ("from", hp->text)) break; } if (hp) { (void)process_field((char *)NULL, strchr(hp->text, ':') + 1, (char *)NULL, (char *)NULL, &from_addr, islocal?F_LOCAL:0, &error); if (error == NULL) { ... add from_addr->in_addr into environment ... } } -- tron |-<=>-| ARPAnet: veritas!tron@apple.com tron@veritas.com UUCPnet: {amdahl,apple,pyramid}!veritas!tron