Article View: comp.mail.uucp
Article #2876Patches for smail 2.5
From: Uucp Administration
Date: Thu, 05 Mar 1992 05:12
Date: Thu, 05 Mar 1992 05:12
1546 lines
41756 bytes
41756 bytes
Here are some patches to smail 2.5 which fix some bugs
and add some useful enhancements.
Many of these have been circulated in the past in various
forms, and are brought together in one package here
(Most of them can be applied independently).
Besides bug fixes, they implement local recognition
of the "%" routing operator, pipe-to-program functionality
in the /usr/lib/alias file, and better date format.
Although I've been using these without any problems for
nearly two years with hundreds of email messages daily
(many of which are piped), since I'm just the messenger
for the most part I naturally can't guarantee much more
than a willingness to respond to trouble reports.
In the near future, an enhanced version, smail 2.7,
is likely to become available for beta test - it should
incorporate some of this functionality along with
several other improvements.
Meanwhile, the current version of smail2.5 with these
patches is quite stable, and you are welcome to use them.
....Enjoy...
--------- 8< --------- 8< --------- 8< --------- 8< --------- 8< ---------
#! /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: /usr/src/new/smail/PATCHES/p001
# /usr/src/new/smail/PATCHES/p002 /usr/src/new/smail/PATCHES/p003
# /usr/src/new/smail/PATCHES/p004 /usr/src/new/smail/PATCHES/p005
# /usr/src/new/smail/PATCHES/p006 /usr/src/new/smail/PATCHES/p007
# /usr/src/new/smail/PATCHES/p008 /usr/src/new/smail/PATCHES/p009
# /usr/src/new/smail/PATCHES/p010 /usr/src/new/smail/PATCHES/p011
# /usr/src/new/smail/PATCHES/p012
# Wrapped by uucpadm@becker on Thu Mar 5 00:00:19 1992
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f p001 -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"p001\"
else
echo shar: Extracting \"p001\" \(3267 characters\)
sed "s/^X//" >p001 <<'END_OF_p001'
Xsmail 2.5 fixes - standard configure for System V host - version bdb
X * bugfix: missing pointer decl in headers.c
X - allow more info when running with "-d" or "-v"
X - use actual path name (argv[0]) and paths database on RETRY (if -v)
X * bugfix: treat here!here!here!..@here as local
X * bugfix: clear exitstat before each delivery to prevent non-zero
X results from a previous 'resolve' to cause bounces (although
X delivery goes well).
X * bugfix: binary search on hosts does not find last entry
X (thanks to mjy@sdti.SDTI.COM (Michael J. Young)).
X - allow command line options -o, -i and -m
X
X*** defs.h~ Fri Jun 24 10:23:31 1988
X--- defs.h Fri Jun 24 10:25:35 1988
X***************
X*** 17,23
X */
X
X #ifndef VERSION
X! #define VERSION "smail2.5"
X #endif
X
X /*#define BSD /* if system is a Berkeley system */
X
X--- 17,23 -----
X */
X
X #ifndef VERSION
X! #define VERSION "smail2.5/bdb"
X #endif
X
X /*#define BSD /* if system is a Berkeley system */
X***************
X*** 167,172
X /*
X ** command used to retry failed mail, flag is used to set the routing level.
X */
X #define VFLAG ((debug == VERBOSE)?"-v":"")
X #define RETRY(flag) "%s %s %s -f %s ", SMAIL, VFLAG, flag, spoolfile
X
X
X--- 168,175 -----
X /*
X ** command used to retry failed mail, flag is used to set the routing level.
X */
X+ extern char *argv0; /* argv[0] */
X+ extern char *pathfile; /* in main.c */
X #define VFLAG ((debug == VERBOSE)?"-v":"")
X #define RETRY(flag) "%s %s %s -f %s ", SMAIL, VFLAG, flag, spoolfile
X
X***************
X*** 168,174
X ** command used to retry failed mail, flag is used to set the routing level.
X */
X #define VFLAG ((debug == VERBOSE)?"-v":"")
X! #define RETRY(flag) "%s %s %s -f %s ", SMAIL, VFLAG, flag, spoolfile
X
X /*
X ** use the -a if you have it. This sometimes helps failed mail and warning
X
X--- 171,177 -----
X extern char *argv0; /* argv[0] */
X extern char *pathfile; /* in main.c */
X #define VFLAG ((debug == VERBOSE)?"-v":"")
X! #define RETRY(flag) "%s %s %s -p %s -f %s ", ((debug==VERBOSE)?argv0:SMAIL), VFLAG, flag, pathfile, spoolfile
X
X /*
X ** use the -a if you have it. This sometimes helps failed mail and warning
X
X*** main.c~ Fri May 6 23:19:01 1988
X--- main.c Sat Jun 18 13:17:35 1988
X***************
X*** 93,98
X **
X */
X
X main(argc, argv)
X int argc;
X char *argv[];
X
X--- 93,100 -----
X **
X */
X
X+ char *argv0; /* used by RETRY command */
X+
X main(argc, argv)
X int argc;
X char *argv[];
X***************
X*** 110,115
X char *optstr = "cdvArRlLH:h:p:u:q:a:n:m:f:F:";
X extern char *optarg;
X extern int optind;
X
X /*
X ** see if we aren't invoked as rmail
X
X--- 112,119 -----
X char *optstr = "cdvArRlLH:h:p:u:q:a:n:m:f:F:";
X extern char *optarg;
X extern int optind;
X+
X+ argv0 = argv[0]; /* save our name/path */
X
X /*
X ** see if we aren't invoked as rmail
X
X*** headers.c~ Sun Sep 27 22:45:02 1987
X--- headers.c Sun Sep 27 23:44:58 1987
X***************
X*** 472,477
X nhops = ssplit(from, '!', hop);
X
X for(i = 0; i < (nhops - 1); i++) {
X b = hop[i];
X if(*b == '\0') {
X continue;
X
X--- 472,480 -----
X nhops = ssplit(from, '!', hop);
X
X for(i = 0; i < (nhops - 1); i++) {
X+ #ifdef HIDDENHOSTS
X+ register char *p;
X+ #endif
X b = hop[i];
X if(*b == '\0') {
X continue;
X
END_OF_p001
if test 3267 -ne `wc -c <p001`; then
echo shar: \"p001\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f p002 -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"p002\"
else
echo shar: Extracting \"p002\" \(828 characters\)
sed "s/^X//" >p002 <<'END_OF_p002'
Xsmail 2.5 P002 : change default "From: bla (xx)" to "From: xx <bla>"
X
X*** headers.c~ Mon Sep 28 14:52:25 1987
X--- headers.c Tue Oct 20 22:34:32 1987
X***************
X*** 701,707
X
X /*
X ** default From:
X! ** From: user@hostdomain (Full Name)
X */
X def_from(from)
X char *from;
X
X--- 701,707 -----
X
X /*
X ** default From:
X! ** From: Full Name <user@hostdomain>
X */
X def_from(from)
X char *from;
X***************
X*** 727,733
X }
X if(name[0] != '\0') {
X (void) sprintf(fromline,
X! "From: %s@%s (%s)", from, hostdomain, name);
X } else {
X (void) sprintf(fromline,
X "From: %s@%s", from, hostdomain);
X
X--- 727,733 -----
X }
X if(name[0] != '\0') {
X (void) sprintf(fromline,
X! "From: %s <%s@%s>", name, from, hostdomain);
X } else {
X (void) sprintf(fromline,
X "From: %s@%s", from, hostdomain);
X
END_OF_p002
if test 828 -ne `wc -c <p002`; then
echo shar: \"p002\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f p003 -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"p003\"
else
echo shar: Extracting \"p003\" \(2942 characters\)
sed "s/^X//" >p003 <<'END_OF_p003'
Xsmail 2.5 P003 : modify date format from
X 28 Sep 1987 14:52:34 CET (Mon) to
X Mon, 28 Sep 1987 14:52:34 CET (+0100)
X Take USG DST in account
X
X*** misc.c~ Mon Sep 28 14:52:34 1987
X--- misc.c Sat May 7 14:34:29 1988
X***************
X*** 149,154
X register int i;
X #ifndef BSD
X extern char *tzname[];
X time_t t, time();
X #else
X /* V7 and 4BSD */
X
X--- 149,156 -----
X register int i;
X #ifndef BSD
X extern char *tzname[];
X+ extern long timezone;
X+ char dspace[40];
X time_t t, time();
X int dst; /* dst active */
X long tz;
X***************
X*** 150,155
X #ifndef BSD
X extern char *tzname[];
X time_t t, time();
X #else
X /* V7 and 4BSD */
X struct timeb t;
X
X--- 152,159 -----
X extern long timezone;
X char dspace[40];
X time_t t, time();
X+ int dst; /* dst active */
X+ long tz;
X #else
X /* V7 and 4BSD */
X struct timeb t;
X***************
X*** 180,185
X
X q = b;
X
X p = &ud[8]; /* 16 */
X if (*p == ' ')
X p++;
X
X--- 184,196 -----
X
X q = b;
X
X+ p = &ud[0]; /* Mon */
X+ *q++ = *p++;
X+ *q++ = *p++;
X+ *q++ = *p++;
X+ *q++ = ',';
X+ *q++ = ' ';
X+
X p = &ud[8]; /* 16 */
X if (*p == ' ')
X p++;
X***************
X*** 205,211
X
X /* -PST or -PDT */
X #ifndef BSD
X! p = tzname[localtime(&t)->tm_isdst];
X #else
X p = timezone(t.timezone, localtime(&t.time)->tm_isdst);
X #endif
X
X--- 216,224 -----
X
X /* -PST or -PDT */
X #ifndef BSD
X! dst = localtime(&t)->tm_isdst;
X! tz = timezone - (dst ? 3600 : 0);
X! p = tzname[dst];
X #else
X p = timezone(t.timezone, localtime(&t.time)->tm_isdst);
X if (p[3] != '\0')
X***************
X*** 208,214
X p = tzname[localtime(&t)->tm_isdst];
X #else
X p = timezone(t.timezone, localtime(&t.time)->tm_isdst);
X- #endif
X! if (p[3] != '\0')
X {
X /* hours from GMT */
X
X--- 221,226 -----
X p = tzname[dst];
X #else
X p = timezone(t.timezone, localtime(&t.time)->tm_isdst);
X! if (p[3] == '+' || p[3] == '-')
X {
X /* hours from GMT */
X***************
X*** 224,229
X *q++ = *p++;
X }
X else
X {
X *q++ = ' ';
X *q++ = *p++;
X
X--- 236,242 -----
X *q++ = *p++;
X }
X else
X+ #endif
X {
X *q++ = ' ';
X if (*p) *q++ = *p++;
X***************
X*** 226,234
X else
X {
X *q++ = ' ';
X! *q++ = *p++;
X! *q++ = *p++;
X! *q++ = *p++;
X }
X
X p = &ud[0]; /* Mon */
X
X--- 239,247 -----
X #endif
X {
X *q++ = ' ';
X! if (*p) *q++ = *p++;
X! if (*p) *q++ = *p++;
X! if (*p) *q++ = *p++;
X }
X #ifndef BSD
X if (tz != 0) {
X***************
X*** 230,243
X *q++ = *p++;
X *q++ = *p++;
X }
X!
X! p = &ud[0]; /* Mon */
X! *q++ = ' ';
X! *q++ = '(';
X! *q++ = *p++;
X! *q++ = *p++;
X! *q++ = *p++;
X! *q++ = ')';
X
X *q = '\0';
X return (b);
X
X--- 243,257 -----
X if (*p) *q++ = *p++;
X if (*p) *q++ = *p++;
X }
X! #ifndef BSD
X! if (tz != 0) {
X! (void) sprintf (q, " (%c%02d%02d)",
X! ((tz > 0) ? '-' : '+'),
X! abs(tz/3600),
X! abs(tz%3600)/60);
X! q += strlen (q);
X! }
X! #endif
X
X *q = '\0';
X return (b);
END_OF_p003
if test 2942 -ne `wc -c <p003`; then
echo shar: \"p003\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f p004 -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"p004\"
else
echo shar: Extracting \"p004\" \(3879 characters\)
sed "s/^X//" >p004 <<'END_OF_p004'
Xsmail 2.5 P004 : customize for '-i' and '-m' option
X
X*** main.c~ Mon Sep 28 14:52:30 1987
X--- main.c Mon Oct 26 15:50:08 1987
X***************
X*** 28,34
X ** -l user@domain goes to local mailer
X ** -L all mail goes local
X ** -q number mail queueing cost threshold
X! ** -m number limit on number of uux_noqueue jobs
X ** -u string string of flags for uux
X ** -F address name to substitute in From: line
X ** -a aliasfile aliases filename (not used with SENDMAIL)
X
X--- 28,35 -----
X ** -l user@domain goes to local mailer
X ** -L all mail goes local
X ** -q number mail queueing cost threshold
X! ** (mail) -m number limit on number of uux_noqueue jobs
X! ** (rmail) -m <for compatibility only>
X ** -u string string of flags for uux
X ** -F address name to substitute in From: line
X ** -a aliasfile aliases filename (not used with SENDMAIL)
X***************
X*** 33,38
X ** -F address name to substitute in From: line
X ** -a aliasfile aliases filename (not used with SENDMAIL)
X ** -n namelist list of full names for simple aliases
X */
X
X #include <stdio.h>
X
X--- 34,40 -----
X ** -F address name to substitute in From: line
X ** -a aliasfile aliases filename (not used with SENDMAIL)
X ** -n namelist list of full names for simple aliases
X+ ** -i <for compatibility only>
X */
X
X #include <stdio.h>
X***************
X*** 106,111
X char *p;
X int c;
X int printaddr = 0; /* or set by -A */
X int nargc;
X char **nargv, **alias();
X
X
X--- 108,114 -----
X char *p;
X int c;
X int printaddr = 0; /* or set by -A */
X+ int rmail = 1;
X int nargc;
X char **nargv, **alias();
X
X***************
X*** 109,115
X int nargc;
X char **nargv, **alias();
X
X! char *optstr = "cdvArRlLH:h:p:u:q:a:n:m:f:F:";
X extern char *optarg;
X extern int optind;
X
X
X--- 112,118 -----
X int nargc;
X char **nargv, **alias();
X
X! char *optstr = "cdvmAriRlLH:h:p:u:q:a:n:f:F:"; /* rmail */
X extern char *optarg;
X extern int optind;
X
X***************
X*** 126,131
X
X if(*p != 'r' ) {
X handle = ALL;
X }
X
X /*
X
X--- 129,136 -----
X
X if(*p != 'r' ) {
X handle = ALL;
X+ optstr = "cdvAriRlLH:h:p:u:q:a:n:m:f:F:"; /* smail */
X+ rmail = 0;
X }
X
X /*
X***************
X*** 148,154
X case 'n': fnlist = optarg; break;
X case 'H': (void) strcpy(hostdomain, optarg); break;
X case 'h': (void) strcpy(hostname, optarg); break;
X! case 'm': if(isdigit(*optarg)) {
X maxnoqueue = atoi(optarg);
X }
X break;
X
X--- 153,159 -----
X case 'n': fnlist = optarg; break;
X case 'H': (void) strcpy(hostdomain, optarg); break;
X case 'h': (void) strcpy(hostname, optarg); break;
X! case 'm': if(!rmail && isdigit(*optarg)) {
X maxnoqueue = atoi(optarg);
X }
X break;
X***************
X*** 157,162
X queuecost = atoi(optarg);
X }
X break;
X default:
X error( EX_USAGE, "valid flags are %s\n", optstr);
X }
X
X--- 162,168 -----
X queuecost = atoi(optarg);
X }
X break;
X+ case 'i': break; /* compatibility */
X default:
X error( EX_USAGE, "valid flags are %s\n", optstr);
X }
X
X*** svbinmail.c~ Mon Sep 28 14:52:42 1987
X--- svbinmail.c Mon Oct 26 15:35:54 1987
X***************
X*** 45,51
X if(argc == 1) {
X reading = TRUE;
X } else {
X! while((c = getopt(argc, argv, "epqrtf:")) != EOF) {
X switch(c) {
X case 'e':
X case 'p':
X
X--- 45,51 -----
X if(argc == 1) {
X reading = TRUE;
X } else {
X! while((c = getopt(argc, argv, "epqrtimf:")) != EOF) {
X switch(c) {
X case 'e':
X case 'p':
X***************
X*** 55,60
X reading = TRUE;
X break;
X case 't':
X sending = TRUE;
X break;
X default:
X
X--- 55,62 -----
X reading = TRUE;
X break;
X case 't':
X+ case 'i':
X+ case 'm':
X sending = TRUE;
X break;
X default:
X
END_OF_p004
if test 3879 -ne `wc -c <p004`; then
echo shar: \"p004\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f p005 -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"p005\"
else
echo shar: Extracting \"p005\" \(3028 characters\)
sed "s/^X//" >p005 <<'END_OF_p005'
Xsmail 2.5 P005 : islocal, pipes and files
X
X- Correct bug in handling addresses like here!user@here. Routine 'islocal'
X now calls itself recurively after stripping the local domain.
X
X*** alias.c~ Mon Dec 12 09:21:35 1988
X--- alias.c Mon Dec 12 09:38:24 1988
X***************
X*** 255,260
X /*
X ** Do possible fullname substitution.
X */
X #ifdef DOT_REQD
X if (index(user, '.') != NULL)
X #endif
X
X--- 274,288 -----
X /*
X ** Do possible fullname substitution.
X */
X+
X+ /*
X+ ** Allow "_" to be used also.
X+ */
X+ if (index(user, '_') != NULL) {
X+ char *cp = user;
X+ while ((cp = index(cp,'_')) != NULL)
X+ *cp++ = '.';
X+ }
X #ifdef DOT_REQD
X if (index(user, '.') != NULL)
X #endif
X
X*** headers.c~ Fri Jul 15 13:34:28 1988
X--- headers.c Fri Jul 15 16:04:55 1988
X***************
X*** 236,242
X ||(strcmpic(domain, &MYDOM[1]) == 0) /* user@MYDOM no dot */
X #endif
X ||(strcmpic(domain, hostuucp) == 0)) {/* user@hostuucp */
X! return(1);
X }
X return(0);
X }
X
X--- 250,262 -----
X ||(strcmpic(domain, &MYDOM[1]) == 0) /* user@MYDOM no dot */
X #endif
X ||(strcmpic(domain, hostuucp) == 0)) {/* user@hostuucp */
X! /* solve @here:here!user@here problem */
X! if (domain[0] == '\0') return 1;
X! else {
X! char tmp[SMLBUF];
X! (void) strcpy (tmp, user);
X! return islocal (tmp, domain, user);
X! }
X }
X return(0);
X }
X
Xsmail2.5 bugfix:
X- When resolve sets exitstat, and the first delivery succeeds,
X 'delivery' thinks that the delivery failed and bounces the mail.
X
X*** deliver.c~ Sun Jul 31 16:58:52 1988
X--- deliver.c Sun Jul 31 17:04:15 1988
X***************
X*** 100,105
X char *send = scommand;
X
X /*
X ** If we don't have sendmail, arrange to trap standard error
X ** for inclusion in the message that is returned with failed mail.
X */
X
X--- 100,110 -----
X char *send = scommand;
X
X /*
X+ ** Prevent errors from previous passes.
X+ */
X+ exitstat = 0;
X+
X+ /*
X ** If we don't have sendmail, arrange to trap standard error
X ** for inclusion in the message that is returned with failed mail.
X */
X
XFix: allow -o, -i and -m on the command line.
XUsed by mailx on hpux 6.2
X
X*** main.c~ Fri Jan 20 19:33:51 1989
X--- main.c Fri Jan 20 19:36:11 1989
X***************
X*** 35,40 ****
X--- 35,41 ----
X ** -a aliasfile aliases filename (not used with SENDMAIL)
X ** -n namelist list of full names for simple aliases
X ** -i <for compatibility only>
X+ ** -o <for compatibility only, HP-UX 6.2 >
X */
X
X #include <stdio.h>
X***************
X*** 129,135 ****
X
X if(*p != 'r' ) {
X handle = ALL;
X! optstr = "cdvAriRlLH:h:p:u:q:a:n:m:f:F:"; /* smail */
X rmail = 0;
X }
X
X--- 130,136 ----
X
X if(*p != 'r' ) {
X handle = ALL;
X! optstr = "cdvAroiRlLH:h:p:u:q:a:n:m:f:F:"; /* smail */
X rmail = 0;
X }
X
X***************
X*** 163,168 ****
X--- 164,170 ----
X }
X break;
X case 'i': break; /* compatibility */
X+ case 'o': break; /* compatibility */
X default:
X error( EX_USAGE, "valid flags are %s\n", optstr);
X }
X
END_OF_p005
if test 3028 -ne `wc -c <p005`; then
echo shar: \"p005\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f p006 -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"p006\"
else
echo shar: Extracting \"p006\" \(3599 characters\)
sed "s/^X//" >p006 <<'END_OF_p006'
XFrom uucpadm Wed May 3 17:27 EDT 1989
X>From utgpu!utzoo!dciem!chk Wed May 3 17:27:14 1989 remote from geac
XReceived: by becker.UUCP (smail2.5)
X id AA14880; 3 May 89 17:27:14 EDT (Wed)
XReceived: by geac.UUCP (smail2.5)
X id AA09866; 3 May 89 16:27:07 EDT (Wed)
XReceived: from utzoo by gpu.utcs.utoronto.ca with UUCP id 5277; Wed, 3 May 89 16:09:44 EDT
XReceived: by utzoo.uucp ; Wed May 3 16:07:49 1989
XReceived: by dretor.dciem.dnd.ca (3.2/SMI-3.2)
X id AA06856; Wed, 3 May 89 16:01:47 EDT
XFrom: chk@dciem.uucp (C. Harald Koch)
XMessage-Id: <8905032001.AA06856@dretor.dciem.dnd.ca>
XSubject: Patches to SMAIL to deliver to pipes
XTo: utcsri!alias!rae@utzoo.uucp (Reid Ellis),
X utgpu!becker!bdb@utzoo.uucp (Bruce Becker),
X utgpu!geac!eric@utzoo.uucp (Eric Dirks)
XDate: Wed, 3 May 89 16:01:43 EDT
XX-Mailer: ELM [version 2.2 PL0]
XStatus: RO
X
XWell, The fix to SMail's deliver.c turned out to be really simple: Just add
Xa check for a LOCAL address with a username starting with '|'. If we find
Xone, we deliver it right away using the rest of the address as the delivery
Xcommand. If the command fails, the stderr of the command will automatically
Xbe sent back to the sender.
X
XNOTE: THIS IS A SECURITY HOLE A MILE WIDE! USE AT YOUR OWN RISK! No check is
Xmade to see if the sender should be allowed to execute the command. That
Xkind of checking could be inserted in the if statement (i.e.
X
X formv[i] = SENT;
X if (!check_command(from, userv[i])) {
X /* shouldn't execute the pipe due to security */
X }
X else {
X strcpy(lcommand, userv[i]+1);
X goto retry;
X
XSomeone then needs to write the check_command function. I leave that to you
Xenterprising souls :-)
X
X -chk
X
X-------Cut Here------------------------------
X*** Odeliver.c Wed Mar 15 12:11:23 1989
X--- deliver.c Wed May 3 15:40:45 1989
X***************
X*** 129,134 ****
X--- 129,144 ----
X ** By default, don't allow more than 'maxnoqueue' uucico commands to
X ** be started by a single invocation of 'smail'.
X */
X+ retrying = 0;
X+ if (form == LOCAL && *userv[i] == '|') {
X+ /* piping to command. THIS IS A SECURITY HOLE!!!!! */
X+ strcpy(lcommand, userv[i]+1);
X+ formv[i] = SENT;
X+
X+ /* Gasp! a GOTO! The Sin Without Redemption! */
X+ goto retry;
X+ }
X+
X if(uuxargs == NULL) { /* flags not set on command line */
X if(noqcnt < maxnoqueue && costv[i] <= queuecost) {
X flags = uux_noqueue;
X***************
X*** 150,156
X flags = uuxargs;
X }
X
X- retrying = 0;
X if(routing == JUSTDOMAIN) {
X sflag = "-r";
X } else if(routing == ALWAYS) {
X
X--- 152,157 -----
X flags = uuxargs;
X }
X
X if(routing == JUSTDOMAIN) {
X sflag = "-r";
X } else if(routing == ALWAYS) {
X
X
XI discovered that it is really easy to disallow addresses containing the
Xpipe character on the smail command line, by modifying alias.c. This means
Xthat the only place where piping to a command can occur is from an alias
Xfile, so that you only have to make sure that your smail aliases file is
Xprotected from tampering.
X
XHere is the patch. Basically, it silently ignores *any* command line
Xargument containing the character '|', before starting to look for aliases.
X
X -chk
X----Cut Here----------
X*** Oalias.c Mon Feb 6 09:57:02 1989
X--- alias.c Wed May 3 16:13:21 1989
X***************
X*** 116,122 ****
X ** push all of the addresses onto a stack
X */
X for(i=0; i < *pargc; i++) {
X! push(addr, argv[i]);
X }
X
X /*
X--- 116,124 ----
X ** push all of the addresses onto a stack
X */
X for(i=0; i < *pargc; i++) {
X! if (!index(argv[i], '|')) {
X! push(addr, argv[i]);
X! }
X }
X
X /*
X
X
END_OF_p006
if test 3599 -ne `wc -c <p006`; then
echo shar: \"p006\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f p007 -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"p007\"
else
echo shar: Extracting \"p007\" \(4058 characters\)
sed "s/^X//" >p007 <<'END_OF_p007'
XArticle 808 of comp.mail.uucp:
XPath: becker!censor!utzoo!utgpu!watmath!clyde!att!rutgers!gatech!bloom-beacon!mit-eddie!bu-cs!mirror!necntc!necis!mrst!sdti!mjy
XFrom: mjy@sdti.SDTI.COM (Michael J. Young)
XNewsgroups: comp.mail.uucp
XSubject: Bug in Smail 2.5 and Fix
XMessage-ID: <342@sdti.SDTI.COM>
XDate: 1 Dec 88 19:44:26 GMT
XReply-To: mjy@sdti.SDTI.COM (Michael J. Young)
XOrganization: Software Development Technologies, Sudbury MA
XLines: 111
X
XWell, it finally happened. The maps have gotten so large that I can no
Xlonger run pathalias on even just [du].usa.* without running out of memory
X(4.5 Meg) on a swapping Unix. So I had to go back to using 'smart-host' to
Xget my routing done. And guess what? Smail 2.5 never seems to be able to
Xfind 'smart-host' in my 'paths' file if it happened to be the last line of
Xthe file.
X
XIt turns out that there are a couple of problems with the binary search
Xroutine in getpath.c (looks like the quote on line 50 was prophetic!).
XThese were discovered and fixed by my colleague, Prescott K. Turner
X(turner@sdti.sdti.com), who really seems to enjoy fixing binary search
Xroutines! The following comments are what he told me:
X
X1. Line 67: Reaching EOF during the string search rules out the upper
X half of the range (between middle and hi). It shouldn't rule out
X the entire range. Line 67 should be changed to "break;".
X
X Note that as the code exists, the test for "c != EOF" on line 74
X is never operative. But with the recommended fix, the test has the
X proper effect. Perhaps this bug was introduced in order to avoid
X the bug on line 59.
X
X2. Line 59: The test for EOF should be moved inside the "pos != 0"
X if on line 56, to make sure that the test is only made if "c" has
X been updated since the last fseek.
X
XSo here's the "official" bug report and suggested fix:
X
XProblem:
X A bug in the binary search routine in getpath() causes smail
X to sometimes fail to find an entry in /usr/lib/uucp/paths.
X The problem shows up when the searched-for entry happens to
X be the last entry in the 'paths' file. Under some conditions
X getpath() seeks into the middle of the last line, moves to the
X end of the line, then terminates on EOF.
X
XRepeat by:
X Set up a 'paths' file with the following two lines:
X
X foo %s 0
X smart-host foo!%s 120
X
X Then run 'smail -AdR uunet!test'. The attempt to find
X 'smart-host' in the 'paths' file will fail.
X
XFix:
X Apply the following patch.
X
X*** getpath.c.orig Thu Dec 1 13:58:38 1988
X--- getpath.c Thu Dec 1 13:58:17 1988
X***************
X*** 53,59
X for( ;; ) {
X pos = middle = ( hi+lo+1 )/2;
X (void) fseek(file, pos, 0); /* find midpoint */
X! if(pos != 0)
X while(((c = getc(file)) != EOF) && (c != '\n'))
X ; /* go to beginning of next line */
X if(c == EOF) {
X
X--- 53,59 -----
X for( ;; ) {
X pos = middle = ( hi+lo+1 )/2;
X (void) fseek(file, pos, 0); /* find midpoint */
X! if(pos != 0){
X while(((c = getc(file)) != EOF) && (c != '\n'))
X ; /* go to beginning of next line */
X if(c == EOF) {
X***************
X*** 56,63
X if(pos != 0)
X while(((c = getc(file)) != EOF) && (c != '\n'))
X ; /* go to beginning of next line */
X! if(c == EOF) {
X! return(EX_NOHOST);
X }
X for( flag = 0, s = path; flag == 0; s++ ) { /* match??? */
X if( *s == '\0' ) {
X
X--- 56,64 -----
X if(pos != 0){
X while(((c = getc(file)) != EOF) && (c != '\n'))
X ; /* go to beginning of next line */
X! if(c == EOF) {
X! return(EX_NOHOST);
X! }
X }
X for( flag = 0, s = path; flag == 0; s++ ) { /* match??? */
X if( *s == '\0' ) {
X***************
X*** 64,70
X goto solved;
X }
X if((c = getc(file)) == EOF) {
X! return(EX_NOHOST);
X }
X flag = lower(c) - lower(*s);
X }
X
X--- 65,71 -----
X goto solved;
X }
X if((c = getc(file)) == EOF) {
X! break;
X }
X flag = lower(c) - lower(*s);
X }
X--
XMike Young
XSoftware Development Technologies, Inc., Sudbury MA Tel: +1 508 443 5779
XInternet: mjy@sdti.sdti.com UUCP: {harvard,mit-eddie}!sdti!mjy
X
X
END_OF_p007
if test 4058 -ne `wc -c <p007`; then
echo shar: \"p007\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f p008 -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"p008\"
else
echo shar: Extracting \"p008\" \(2855 characters\)
sed "s/^X//" >p008 <<'END_OF_p008'
XFrom censor!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!unmvax!pprg.unm.edu!hc!lll-winken!uunet!cbmvax!snark!eric Wed May 17 10:45:52 EDT 1989
XArticle 1387 of comp.mail.uucp:
XPath: becker!censor!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!unmvax!pprg.unm.edu!hc!lll-winken!uunet!cbmvax!snark!eric
X>From: eric@snark.uu.net (Eric S. Raymond)
XNewsgroups: comp.bugs.sys5,comp.mail.uucp
XSubject: Serious misfeature in smail2.2 under SVr3
XMessage-ID: <1RN5Gz#BCQrmS=eric@snark.uu.net>
XDate: 7 May 89 15:49:59 GMT
XFollowup-To: comp.bugs.sys5
XLines: 79
XXref: becker comp.bugs.sys5:385 comp.mail.uucp:1387
X
XTHE SYMPTOM:
X On SVr3.0 and later UNIXes installation of smail2.3 may cause /etc/profile
Xprocessing to hang, preventing users (including root!) from logging in. This
Xbehavior was first observed on a Toshiba 5100 running T/PIX.
X
XTHE PROBLEM:
X These systems call mail -e to check mail. The svbinmail supplied with 2.3
Xand earlier versions of smail interprets -e as a directive to go into reader
Xmode, waiting for input. Because /etc/profile typically traps and eats
Xinterrupts, this can result in a hang and serious lossage.
X
XTHE FIX:
X Teach svbinmail how to do `mail -e' properly. This fix should be portable
Xto BSD systems, but has been tested unly on SV. It is not complicated.
XTo apply, simply pipe this article through patch -d <smaildir>/src where
X<smaildir> is your toplevel smail source directory.
X
XSMAIL 3.0 DEVELOPERS:
X Please incorporate this code or equivalent. The last thing we need is
Xfor this bug to survive in your stuff...
X
X*** svbinmail.c.old Sat May 6 09:04:11 1989
X--- svbinmail.c Sat May 6 10:03:07 1989
X***************
X*** 11,21 ****
X--- 11,26 ----
X /* */
X
X #include <stdio.h>
X+ #include <pwd.h>
X+ #include <sys/types.h>
X+ #include <sys/stat.h>
X #include "defs.h"
X #ifdef BSD
X #include <strings.h>
X+ #define MAILDIR "/usr/spool/mail/%s"
X #else
X #include <string.h>
X+ #define MAILDIR "/usr/mail/%s"
X #endif
X
X #ifdef SENDMAIL
X***************
X*** 32,37 ****
X--- 37,43 ----
X char prog[128];
X
X void perror(), exit(), usage();
X+ struct passwd *getpwuid();
X
X main(argc, argv)
X int argc;
X***************
X*** 53,58 ****
X--- 59,79 ----
X while((c = getopt(argc, argv, "epqrtf:")) != EOF) {
X switch(c) {
X case 'e':
X+ {
X+ char mailfile[BUFSIZ];
X+ struct stat stbuf;
X+ struct passwd *pw;
X+
X+ if ((pw = getpwuid(getuid())) == 0)
X+ return(2);
X+ (void) sprintf(mailfile,
X+ MAILDIR, pw->pw_name);
X+ if (stat(mailfile, &stbuf) == -1)
X+ return(1);
X+ else
X+ return(stbuf.st_size == 0);
X+ }
X+ break;
X case 'p':
X case 'q':
X case 'r':
X--
X Eric S. Raymond (the mad mastermind of TMN-Netnews)
X uunet!snark!eric | eric@snark.uu.net Phone: (215)-296-5718
X
X
END_OF_p008
if test 2855 -ne `wc -c <p008`; then
echo shar: \"p008\" unpacked with wrong size!
fi # end of overwriting check
fi
if test -f p009 -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"p009\"
else
echo shar: Extracting \"p009\" \(1896 characters\)
sed "s/^X//" >p009 <<'END_OF_p009'
XArticle 14 of comp.mail.misc:
XPath: ziebmef!ncrcan!lsuc!utzoo!mnetor!uunet!mcvax!eutrc3!wswietse
XFrom: wswietse@eutrc3.UUCP (Wietse Venema)
XNewsgroups: comp.mail.misc
XSubject: patch for smail 2.5
XMessage-ID: <220@eutrc3.UUCP>
XDate: 24 Apr 88 15:58:06 GMT
XOrganization: Tech. Univ. Eindhoven, Neth.
XLines: 56
X
X
XProblem:
X When smail invokes the local SysV mailer for delivery,
X the local mailer's standard output clobbers its standard
X error output, producing hard to understand error reports.
X
XRepeat by:
X For example, the command `mail noperson' causes smail to
X return the message to the originator, with the following
X error report:
X
X Mail saved in dead.letter
X on
X
X instead of:
X
X mail: can't send to noperson
X Mail saved in dead.letter
X
XFix:
X Apply the following patch. The freopen() calls that capture
X the local mailer's outputs are changed from "w" (creation)
X mode to "a" (append) mode.
X
XThis patch solves a problem I had when installing smail on a
XSystem-V/AT host. It may also be relevant for other UNIX versions.
X
X*** deliver.c- Fri Sep 25 14:44:51 1987
X--- deliver.c Sat Apr 23 17:02:14 1988
X***************
X*** 106,114 ****
X (void) unlink(stderrfile);
X (void) strcpy(stderrfile, "/tmp/stderrXXXXXX");
X (void) mktemp(stderrfile);
X! (void) freopen(stderrfile, "w", stderr);
X if(debug != YES) {
X! (void) freopen(stderrfile, "w", stdout);
X }
X
X *lend = *rend = *send = '\0';
X--- 106,114 ----
X (void) unlink(stderrfile);
X (void) strcpy(stderrfile, "/tmp/stderrXXXXXX");
X (void) mktemp(stderrfile);
X! (void) freopen(stderrfile, "a", stderr);
X if(debug != YES) {
X! (void) freopen(stderrfile, "a", stdout);
X }
X
X *lend = *rend = *send = '\0';
X
X
X--
Xuucp: mcvax!eutrc3!wswietse | Eindhoven University of Technology
Xbitnet: wswietse@heithe5 | Dept. of Mathematics and Computer Science
Xsurf: tuerc5::wswietse | Eindhoven, The Netherlands.
X
X
END_OF_p009
if test 1896 -ne `wc -c <p009`; then
echo shar: \"p009\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f p010 -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"p010\"
else
echo shar: Extracting \"p010\" \(888 characters\)
sed "s/^X//" >p010 <<'END_OF_p010'
XThis patch causes smail to try to resolve a dotted hostname
Xfirst before using a domain lookup on the name subtree.
X
X
X*** ORIG/resolve.c Mon Dec 7 12:58:42 1987
X--- resolve.c Sun Dec 17 02:33:42 1989
X***************
X*** 232,240
X ** Returns with error if we find no path.
X */
X for(step = 0; (step < domains); step++) {
X! if((getpath(domainv[step]-1, path, cost) == EX_OK) /* w/ dot */
X! || (getpath(domainv[step] , path, cost) == EX_OK))/* no dot */
X! break;
X }
X
X if(step == domains) {
X
X--- 232,244 -----
X ** Returns with error if we find no path.
X */
X for(step = 0; (step < domains); step++) {
X! if ((step == 0) && /* no dot */
X! (getpath(domainv[step] , path, cost) == EX_OK))
X! break;
X!
X! else if((getpath(domainv[step]-1, path, cost) == EX_OK) ||
X! (getpath(domainv[step] , path, cost) == EX_OK))
X! break;
X }
X
X if(step == domains) {
END_OF_p010
if test 888 -ne `wc -c <p010`; then
echo shar: \"p010\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f p011 -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"p011\"
else
echo shar: Extracting \"p011\" \(1065 characters\)
sed "s/^X//" >p011 <<'END_OF_p011'
XThis patch allows smail to resolve "%"-style addresses.
X
X
X*** ORIG/headers.c Mon Dec 7 12:58:21 1987
X--- headers.c Sun Dec 17 01:42:46 1989
X***************
X*** 57,62
X ** user@domain DOMAIN
X ** @domain,address LOCAL (just for sendmail)
X ** host!address UUCP
X **
X */
X
X
X--- 57,63 -----
X ** user@domain DOMAIN
X ** @domain,address LOCAL (just for sendmail)
X ** host!address UUCP
X+ ** user%domain DOMAIN (for sendmail compatibility)
X **
X */
X
X***************
X*** 153,158
X }
X return (DOMAIN);
X }
X /*
X ** Done trying. This must be just a user name, form LOCAL.
X */
X
X--- 154,170 -----
X }
X return (DOMAIN);
X }
X+ /*
X+ ** Try splitting at %. If it works, this is user%domain, form DOMAIN.
X+ ** Prefer the righthand % in a%b%c.
X+ */
X+ if ((parts = ssplit(address, '%', partv)) >= 2) {
X+ (void) strcpy(domain, partv[parts-1]);
X+ (void) strncpy(user, partv[0], partv[parts-1]-partv[0]-1);
X+ user[partv[parts-1]-partv[0]-1] = '\0';
X+ return (DOMAIN);
X+ }
X+
X /*
X ** Done trying. This must be just a user name, form LOCAL.
X */
END_OF_p011
if test 1065 -ne `wc -c <p011`; then
echo shar: \"p011\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f p012 -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"p012\"
else
echo shar: Extracting \"p012\" \(4003 characters\)
sed "s/^X//" >p012 <<'END_OF_p012'
XFix case problems in resolving local logins etc.
X
X*** ORIG/alias.c Mon Dec 7 12:58:02 1987
X--- alias.c Tue Aug 14 23:01:06 1990
X***************
X*** 219,225
X }
X }
X
X! if((home = tilde(user)) != NULL) {
X /* don't allow multiple sourcing
X ** of a given .forward file
X */
X
X--- 221,227 -----
X }
X }
X
X! if((home = tilde(user, ubuf)) != NULL) {
X /* don't allow multiple sourcing
X ** of a given .forward file
X */
X***************
X*** 248,253
X continue;
X }
X }
X }
X #endif /* not SENDMAIL */
X
X
X--- 250,256 -----
X continue;
X }
X }
X+ (void) strcpy(u->string, ubuf);
X }
X #endif /* not SENDMAIL */
X
X***************
X*** 384,390
X ** include another file of aliases
X */
X
X! if(strncmp(p, ":include:", 9) == 0) {
X char *nl;
X p += 9;
X if((nl = index(p, '\n')) != NULL) {
X
X--- 396,402 -----
X ** include another file of aliases
X */
X
X! if(strncmpic(p, ":include:", 9) == 0) {
X char *nl;
X p += 9;
X if((nl = index(p, '\n')) != NULL) {
X
X*** ORIG/pw.c Mon Dec 7 12:58:39 1987
X--- pw.c Tue Aug 14 22:12:31 1990
X***************
X*** 38,43
X */
X
X for(f=pwhead; f != NULL; f=f->vlink) {
X if(strcmp(user, f->lname) == 0) {
X return(f->fname);
X }
X
X--- 38,44 -----
X */
X
X for(f=pwhead; f != NULL; f=f->vlink) {
X+ #ifdef CASEALIAS
X if(strcmp(user, f->lname) == 0) {
X #else
X if(strcmpic(user, f->lname) == 0) {
X***************
X*** 39,44
X
X for(f=pwhead; f != NULL; f=f->vlink) {
X if(strcmp(user, f->lname) == 0) {
X return(f->fname);
X }
X }
X
X--- 40,48 -----
X for(f=pwhead; f != NULL; f=f->vlink) {
X #ifdef CASEALIAS
X if(strcmp(user, f->lname) == 0) {
X+ #else
X+ if(strcmpic(user, f->lname) == 0) {
X+ #endif
X return(f->fname);
X }
X }
X***************
X*** 47,52
X */
X
X while((f=pwparse()) != PNULL) {
X if(strcmp(user, f->lname) == 0) {
X return(f->fname);
X }
X
X--- 51,57 -----
X */
X
X while((f=pwparse()) != PNULL) {
X+ #ifdef CASEALIAS
X if(strcmp(user, f->lname) == 0) {
X #else
X if(strcmpic(user, f->lname) == 0) {
X***************
X*** 48,53
X
X while((f=pwparse()) != PNULL) {
X if(strcmp(user, f->lname) == 0) {
X return(f->fname);
X }
X }
X
X--- 53,61 -----
X while((f=pwparse()) != PNULL) {
X #ifdef CASEALIAS
X if(strcmp(user, f->lname) == 0) {
X+ #else
X+ if(strcmpic(user, f->lname) == 0) {
X+ #endif
X return(f->fname);
X }
X }
X***************
X*** 83,90
X
X #ifndef SENDMAIL
X char *
X! tilde(user)
X! char *user;
X {
X pwlist *f;
X
X
X--- 91,98 -----
X
X #ifndef SENDMAIL
X char *
X! tilde(user, lnm)
X! char *user, *lnm;
X {
X pwlist *f;
X
X***************
X*** 93,98
X */
X
X for(f=pwhead; f != NULL; f=f->vlink) {
X if(strcmp(user, f->lname) == 0) {
X return(f->home);
X }
X
X--- 101,107 -----
X */
X
X for(f=pwhead; f != NULL; f=f->vlink) {
X+ #ifdef CASEALIAS
X if(strcmp(user, f->lname) == 0) {
X #else
X if(strcmpic(user, f->lname) == 0) {
X***************
X*** 94,99
X
X for(f=pwhead; f != NULL; f=f->vlink) {
X if(strcmp(user, f->lname) == 0) {
X return(f->home);
X }
X }
X
X--- 103,112 -----
X for(f=pwhead; f != NULL; f=f->vlink) {
X #ifdef CASEALIAS
X if(strcmp(user, f->lname) == 0) {
X+ #else
X+ if(strcmpic(user, f->lname) == 0) {
X+ #endif
X+ strcpy(lnm, f->lname);
X return(f->home);
X }
X }
X***************
X*** 102,107
X */
X
X while((f=pwparse()) != PNULL) {
X if(strcmp(user, f->lname) == 0) {
X return(f->home);
X }
X
X--- 115,121 -----
X */
X
X while((f=pwparse()) != PNULL) {
X+ #ifdef CASEALIAS
X if(strcmp(user, f->lname) == 0) {
X #else
X if(strcmpic(user, f->lname) == 0) {
X***************
X*** 103,108
X
X while((f=pwparse()) != PNULL) {
X if(strcmp(user, f->lname) == 0) {
X return(f->home);
X }
X }
X
X--- 117,126 -----
X while((f=pwparse()) != PNULL) {
X #ifdef CASEALIAS
X if(strcmp(user, f->lname) == 0) {
X+ #else
X+ if(strcmpic(user, f->lname) == 0) {
X+ #endif
X+ strcpy(lnm, f->lname);
X return(f->home);
X }
X }
END_OF_p012
if test 4003 -ne `wc -c <p012`; then
echo shar: \"p012\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of shell archive.
exit 0
--------- 8< --------- 8< --------- 8< --------- 8< --------- 8< ---------
--
Bruce Becker Uucp Administration Toronto, Ont. Vox: +1 416 699 1868
Internet: uucpadm@becker.gts.org UUCP: ...!lsuc!becker!uucpadm
"Radish Found With Politician Growing From Taproot" - The Rational Inquisitor
Technical Details
Message-ID:
<138709@becker.UUCP>Path:
arc1-ca.pugleaf.net!wupost!cs.utexas.edu!utgpu!utzoo!mnetor!tmsoft!becker!uucpadmShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!wupost!cs.utexas.edu!utgpu!utzoo!mnetor!tmsoft!becker!uucpadm From: uucpadm@becker.UUCP (Uucp Administration) Newsgroups: comp.mail.uucp,alt.sources Subject: Patches for smail 2.5 Message-ID: <138709@becker.UUCP> Date: 5 Mar 92 05:12:42 GMT Reply-To: uucpadm@becker.gts.org Followup-To: comp.mail.uucp,alt.sources.d Organization: G. T. S., Toronto, Ontario Lines: 1546