fletcher@cs.utexas.edu (Fletcher Mattox) (09/10/89)
Unless I'm mis-reading the code, it looks to me like the "owner-" error hack doesn't work when mail to a list of all local users arrives via SMTP and one of those users doesn't exist. An example: /usr/lib/aliases on somehost.edu looks like: # blurfl doesn't exit, joe and bob do. foolist: joe,blurfl,bob foolist-owner: postmaster Someone on otherhost.edu mails to <foolist@somehost.edu>, he gets back a "550 foolist: User unknown", but foolist-owner is not notified of the error nor is mail delivered to joe and bob. This is in contrast to what happens when the same mail originates on somehost.edu. At least this is the behaviour I see with a heavily hacked 5.59. I'd like to hear someone else confirm it before I try to fix it. Fletcher
sow@cad.luth.se (Sven-Ove Westberg) (09/11/89)
In article <6872@cs.utexas.edu> fletcher@cs.utexas.edu (Fletcher Mattox) writes: | |At least this is the behaviour I see with a heavily hacked 5.59. |I'd like to hear someone else confirm it before I try to fix it. | Yes I think you are right. I use this hack in the alisfiles to avoid the local error to bounce back. # sun-nets@cad.luth.se: "|/usr/lib/sendmail -oi -fowner-sun-nets@cad.luth.se sun-nets-out" sun-nets-out: foo,sun-nets@other.host.se,sun-nets@host.se,user@domain owner-sun-nets@cad.luth.se: me owner-sun-nets-out: me # Sven-Ove Westberg, CAD, University of Lulea, S-951 87 Lulea, Sweden. Internet: sow@cad.luth.se
asjl@comp.vuw.ac.nz (Andy Linton) (09/13/89)
In article <6872@cs.utexas.edu> fletcher@cs.utexas.edu (Fletcher Mattox) writes: >Unless I'm mis-reading the code, it looks to me like the >"owner-" error hack doesn't work when mail to a list of >all local users arrives via SMTP and one of those users >doesn't exist. I use the following to ensure that errors in mail to lists get back to the person who looks after the list locally. This should also work if any of the list expansions go to a non-sendmail host (yes there are some (:-)) since it relies on the Sender: field to return the error a la RFC822 and not on the sendmail hack. -- #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of shell archive." # Contents: distribute.c # Wrapped by asjl@downstage.comp.vuw.ac.nz on Wed Sep 13 13:19:22 1989 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'distribute.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'distribute.c'\" else echo shar: Extracting \"'distribute.c'\" \(4006 characters\) sed "s/^X//" >'distribute.c' <<'END_OF_FILE' X/* X * Distribute changes headers of messages to mailing lists so that there is a X * Sender: field for errors in the list etc and a Reply-To: field for errors X * in mailer design. (:-) X * X * It requires the following sort of set up in /usr/lib/aliases:- X * X * listname:"|/usr/local/lib/mail/distribute listname" X * listname-request:asjl@comp.vuw.ac.nz X * listname-xxx::include:/usr/local/lib/aliaslists/listname X * X * The user addresses mail to "listname", "listname-request" is the person X * responsible for the list and "listname-xxx" is a pointer to the list to X * expand for delivery. X * X * All this should be transparent to the user. X * X * $State: Exp $ X * X * $Log: distribute.c,v $ X * Revision 1.3 89/08/31 09:37:16 asjl X * Modified for use at VUW X * X * Revision 1.1 89/08/31 09:34:27 asjl X * Initial revision X * X * Revision 1.2 89/07/27 14:44:58 crr X * Fix non checking of temp file write failure (bug). X * Use temp file in /var/tmp not /tmp to avoid dump removing it. X * X * Revision 1.1 89/05/26 12:21:52 asjl X * Initial revision X * X * Revision 1.2 89/03/22 10:36:09 root X * Added RCS Keywords X * Reduced number of parameters to one. X * Added check on return code of 'system (cmdstring)' call. X * X */ X X X#include <stdio.h> X#include <ctype.h> X#include <sys/types.h> X#include <sys/file.h> X#include <sysexits.h> X X#define BUF_LINE 500 /* line length buffer */ X#define TRUE 1 /* return(...) codes */ X#define FALSE 0 X#define NULLP(x) ((x*)0) X X#define OWNER_SUFFIX "-request@comp.vuw.ac.nz" X#define DLIST_SUFFIX "-xxx" X Xchar tempfile[] = "/usr/tmp/distrib.XXXXXX"; X X/* X * M A I N P R O G R A M X */ X Xmain (argc, argv) Xint argc; Xchar *argv[]; X{ X register int processing_header, X add_reply_to, X temp_fd; X FILE *new_message; X char *inp, X *outp, X inbuf[BUF_LINE], X reply_tobuf[BUF_LINE], X cmdstring[BUF_LINE]; X X processing_header = TRUE; X add_reply_to = FALSE; X X if ((new_message = fopen (mktemp (tempfile), "w+")) == NULLP(FILE)) X { X exit (EX_CANTCREAT); X } X X while (fgets (inbuf, BUF_LINE, stdin) != NULLP(char)) X { X if (processing_header) X { X if (strncmp (inbuf, "From ", sizeof ("From ") - 1) == 0) X { X /* Discard it */ X continue; X } X if (strncmp (inbuf, "Acknowledge-To: ", X sizeof ("Acknowledge-To: ") - 1) == 0) X { X /* Discard it */ X continue; X } X if (strncmp (inbuf, "Return-Receipt-To: ", X sizeof ("Return-Receipt-To: ") - 1) == 0) X { X /* Discard it */ X continue; X } X if (strncmp (inbuf, "Sender: ", sizeof ("Sender: ") - 1) == 0) X { X fprintf (new_message, "Original-Sender%s", X index (inbuf, ':')); X continue; X } X if (strncmp (inbuf, "Via: ", sizeof ("Via: ") - 1) == 0) X { X fprintf (new_message, "Original-Via%s", index (inbuf, ':')); X continue; X } X if (strncmp (inbuf, "From: ", sizeof ("From: ") - 1) == 0) X { X sprintf (reply_tobuf, "Reply-To%s", index (inbuf, ':')); X add_reply_to = TRUE; X } X if (strncmp (inbuf, "Reply-To: ", sizeof ("Reply-To: ") - 1) == 0) X { X add_reply_to = FALSE; X } X if (strcmp (inbuf, "\n") == 0) X { X fprintf (new_message, "Sender: %s%s\n", argv[1], OWNER_SUFFIX); X if (add_reply_to) X { X if (fputs (reply_tobuf, new_message) == EOF) X { X fclose (new_message); X exit (EX_IOERR); X } X } X processing_header = FALSE; X } X if (fputs (inbuf, new_message) == EOF) X { X fclose (new_message); X exit (EX_IOERR); X } X } X else X { X if (fputs (inbuf, new_message) == EOF) X { X fclose (new_message); X exit (EX_IOERR); X } X } X X } X if ( ferror(new_message) ){ X fclose (new_message); X exit (EX_IOERR); X } X fclose (new_message); X sprintf (cmdstring, "/usr/lib/sendmail -ba -f%s%s %s%s < %s", X argv[1], OWNER_SUFFIX, argv[1], DLIST_SUFFIX, tempfile); X /* Now send the mail as 'daemon' */ X setuid (geteuid ()); X if (system (cmdstring) == 127) /* Couldn't invoke the shell */ X { X X unlink (tempfile); X exit (EX_SOFTWARE); X } X X unlink (tempfile); X exit (EX_OK); X} END_OF_FILE if test 4006 -ne `wc -c <'distribute.c'`; then echo shar: \"'distribute.c'\" unpacked with wrong size! fi # end of 'distribute.c' fi echo shar: End of shell archive. exit 0 -- EMAIL = asjl@comp.vuw.ac.nz FAX = +64 4 712 070 PHONE = +64 4 721 000 x8978 SNAIL = Computer Science Dept, Victoria University, Wellington, NEW ZEALAND
hubert@blake.acs.washington.edu (Steve Hubert) (09/15/89)
In article <6872@cs.utexas.edu> fletcher@cs.utexas.edu (Fletcher Mattox) writes: >Unless I'm mis-reading the code, it looks to me like the >"owner-" error hack doesn't work when mail to a list of >all local users arrives via SMTP and one of those users >doesn't exist. > >An example: > >/usr/lib/aliases on somehost.edu looks like: > ># blurfl doesn't exit, joe and bob do. >foolist: joe,blurfl,bob >foolist-owner: postmaster > >Someone on otherhost.edu mails to <foolist@somehost.edu>, he >gets back a "550 foolist: User unknown", but foolist-owner >is not notified of the error nor is mail delivered to joe >and bob. This is in contrast to what happens when the same >mail originates on somehost.edu. > >At least this is the behaviour I see with a heavily hacked 5.59. >I'd like to hear someone else confirm it before I try to fix it. > >Fletcher I don't think the workarounds to send the errors to the right user are sufficient. To clarify slightly, here is what is happening in the case of two sendmails communicating with each other: The sending sendmail on otherhost sends: RCPT To:<foolist@somehost.edu> and waits for an answer. The server sendmail on somehost.edu finds foolist in aliases and runs into the blurf address. It sends back the message: 550 blurf... User unknown The local sendmail sees the 550 and marks the address *foolist* as unknown. It doesn't notice that the message was about blurf, not foolist. The local sendmail has no choice now but to return this to the original sender. The message isn't delivered to anyone. So what should have happened? Should the server have said anything about blurf being a bad address? The local sendmail didn't even ask about blurf, it just asked about foolist. It seems to me that foolist is a good address and the server shouldn't have returned any 550 error at all. Instead, it should have sent the blurf error to foolist-owner and delivered to all the other good addresses, just like Fletcher says happens when the mail originates on somehost. Has anyone done the modifications to make that happen? Steve Hubert hubert@cac.washington.edu Networks and Distributed Computing, Univ. of Washington, Seattle
hubert@blake.acs.washington.edu (Steve Hubert) (09/15/89)
In article <3632@blake.acs.washington.edu> hubert@cac.washington.edu (Steve Hubert) writes: >I don't think the workarounds to send the errors to the right user >are sufficient. ... (It's always a bad sign when you reply to your own article.) I was wrong. The workarounds are sufficient since they cause a local sendmail invocation and the bug only happens over smtp connections from a remote host. The workarounds will make everything happen as it should. There is still a bug in sendmail, though. Steve Hubert hubert@cac.washington.edu