Xref: utzoo comp.bugs.sys5:957 comp.mail.uucp:3111 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!unmvax!pprg.unm.edu!hc!lll-winken!uunet!cbmvax!snark!eric From: eric@snark.uu.net (Eric S. Raymond) Newsgroups: comp.bugs.sys5,comp.mail.uucp Subject: Serious misfeature in smail2.2 under SVr3 Message-ID: <1RN5Gz#BCQrmS=eric@snark.uu.net> Date: 7 May 89 15:49:59 GMT Followup-To: comp.bugs.sys5 Lines: 79 THE SYMPTOM: On SVr3.0 and later UNIXes installation of smail2.3 may cause /etc/profile processing to hang, preventing users (including root!) from logging in. This behavior was first observed on a Toshiba 5100 running T/PIX. THE PROBLEM: These systems call mail -e to check mail. The svbinmail supplied with 2.3 and earlier versions of smail interprets -e as a directive to go into reader mode, waiting for input. Because /etc/profile typically traps and eats interrupts, this can result in a hang and serious lossage. THE FIX: Teach svbinmail how to do `mail -e' properly. This fix should be portable to BSD systems, but has been tested unly on SV. It is not complicated. To apply, simply pipe this article through patch -d /src where is your toplevel smail source directory. SMAIL 3.0 DEVELOPERS: Please incorporate this code or equivalent. The last thing we need is for this bug to survive in your stuff... *** svbinmail.c.old Sat May 6 09:04:11 1989 --- svbinmail.c Sat May 6 10:03:07 1989 *************** *** 11,21 **** --- 11,26 ---- /* */ #include + #include + #include + #include #include "defs.h" #ifdef BSD #include + #define MAILDIR "/usr/spool/mail/%s" #else #include + #define MAILDIR "/usr/mail/%s" #endif #ifdef SENDMAIL *************** *** 32,37 **** --- 37,43 ---- char prog[128]; void perror(), exit(), usage(); + struct passwd *getpwuid(); main(argc, argv) int argc; *************** *** 53,58 **** --- 59,79 ---- while((c = getopt(argc, argv, "epqrtf:")) != EOF) { switch(c) { case 'e': + { + char mailfile[BUFSIZ]; + struct stat stbuf; + struct passwd *pw; + + if ((pw = getpwuid(getuid())) == 0) + return(2); + (void) sprintf(mailfile, + MAILDIR, pw->pw_name); + if (stat(mailfile, &stbuf) == -1) + return(1); + else + return(stbuf.st_size == 0); + } + break; case 'p': case 'q': case 'r': -- Eric S. Raymond (the mad mastermind of TMN-Netnews) uunet!snark!eric | eric@snark.uu.net Phone: (215)-296-5718