sendmail puzzles
Satz%sri-tsc at sri-unix.UUCP
Satz%sri-tsc at sri-unix.UUCP
Fri Mar 9 18:51:00 AEST 1984
From: Greg Satz <Satz at sri-tsc>
I have just spent the last few days getting to know sendmail on a
pdp-11/44 running 2.9bsd. There were some real fun problems along the
way that some of you may not be interested in discovering yourselves.
I rewrote the 4.1a_daemon.c file that is distributed so it would take
advantage of the 2.9/4.1b library routines (the original was just plain
disgusting). If anyone is interested in a copy, drop me a note.
I found a nasty problem that may plague sites which run out of mbufs:
daemon.c {4.2}
makeconnection(host, port, outfile, infile)
...
s = socket(AF_INET, SOCK_STREAM, 0, 0);
if (s < 0)
{
syserr("makeconnection: no socket");
goto failure;
}
...
/* failure, decide if temporary or not */
failure:
switch (errno)
When the socket call fails (on pdp-11/44s, this happens frequently),
syserr is called to send an error message to syslog. Unfortunately, it
clears errno in the process thus preventing the mail from being requeued.
My fix:
s = socket(AF_INET, SOCK_STREAM, 0, 0);
if (s < 0)
{
int saverr = errno;
syserr("makeconnection: no socket");
errno = saverr;
goto failure;
}
Here are some others that mustn't cause any problems for Vaxen, but
prevent sendmail from being very useful on pdp-11s.
We have some large mailing lists which caused sendmail to dump core.
We tried increasing this even larger, but then sendmail exhausts its
stack space.
*** conf.h_ Sat Nov 19 16:23:35 1983
--- conf.h Tue Mar 6 18:07:00 1984
***************
*** 11,17
** There shouldn't be much need to change these....
*/
! # define MAXLINE 256 /* max line length */
# define MAXNAME 128 /* max length of a name */
# define MAXFIELD 2500 /* max total length of a hdr field */
# define MAXPV 40 /* max # of parms to mailers */
--- 11,17 -----
** There shouldn't be much need to change these....
*/
! # define MAXLINE 512 /* max line length */
# define MAXNAME 128 /* max length of a name */
# define MAXFIELD 2500 /* max total length of a hdr field */
# define MAXPV 40 /* max # of parms to mailers */
This is evidently a bug that never caused anyone any problems. I was
in paranoia mode, so I did this.
*** clock.c_ Sat Nov 19 16:25:30 1983
--- clock.c Tue Feb 28 16:21:37 1984
***************
*** 142,148
while ((ev = EventQueue) != NULL &&
(ev->ev_time <= now || ev->ev_pid != getpid()))
{
! int (*f)(), a;
/* process the event on the top of the queue */
ev = EventQueue;
--- 142,148 -----
while ((ev = EventQueue) != NULL &&
(ev->ev_time <= now || ev->ev_pid != getpid()))
{
! int (*f)(), a, pid;
/* process the event on the top of the queue */
ev = EventQueue;
***************
*** 157,162
(void) signal(SIGALRM, tick);
f = ev->ev_func;
a = ev->ev_arg;
free((char *) ev);
if (ev->ev_pid != getpid())
continue;
--- 157,163 -----
(void) signal(SIGALRM, tick);
f = ev->ev_func;
a = ev->ev_arg;
+ pid = ev->ev_pid;
free((char *) ev);
if (pid != getpid())
continue;
***************
*** 158,164
f = ev->ev_func;
a = ev->ev_arg;
free((char *) ev);
! if (ev->ev_pid != getpid())
continue;
if (EventQueue != NULL)
{
--- 159,165 -----
a = ev->ev_arg;
pid = ev->ev_pid;
free((char *) ev);
! if (pid != getpid())
continue;
if (EventQueue != NULL)
{
Lint found this one.
*** srvrsmtp.c_ Sat Nov 19 16:25:35 1983
--- srvrsmtp.c Wed Feb 29 14:42:58 1984
***************
*** 228,234
p = skipword(p, "to");
if (p == NULL)
break;
! a = parseaddr(p, (ADDRESS *) NULL, 1);
if (a == NULL)
break;
a = recipient(a, &CurEnv->e_sendqueue);
--- 228,234 -----
p = skipword(p, "to");
if (p == NULL)
break;
! a = parseaddr(p, (ADDRESS *) NULL, 1, '\0');
if (a == NULL)
break;
a = recipient(a, &CurEnv->e_sendqueue);
This was a real problem; connections were never timing out. Lint
found the others.
*** usersmtp.c_ Sat Nov 19 16:25:15 1983
--- usersmtp.c Wed Mar 7 22:27:15 1984
***************
*** 99,105
if (setjmp(CtxGreeting) != 0)
goto tempfail;
! gte = setevent(300, greettimeout, 0);
r = reply(m);
clrevent(gte);
if (r < 0 || REPLYTYPE(r) != 2)
--- 99,106 -----
if (setjmp(CtxGreeting) != 0) {
goto tempfail;
! }
! gte = setevent((time_t) 300, greettimeout, 0);
r = reply(m);
clrevent(gte);
if (r < 0 || REPLYTYPE(r) != 2)
***************
*** 169,175
/* signal a temporary failure */
tempfail:
! smtpquit(m);
return (EX_TEMPFAIL);
/* signal service unavailable */
--- 170,176 -----
/* signal a temporary failure */
tempfail:
! smtpquit(pvp[0], m);
return (EX_TEMPFAIL);
/* signal service unavailable */
***************
*** 174,180
/* signal service unavailable */
unavailable:
! smtpquit(m);
return (EX_UNAVAILABLE);
}
--- 175,181 -----
/* signal service unavailable */
unavailable:
! smtpquit(pvp[0], m);
return (EX_UNAVAILABLE);
}
Another timeout problem.
*** util.c_ Sat Nov 19 16:25:44 1983
--- util.c Thu Feb 23 18:03:01 1984
***************
*** 646,652
syserr("sfgets: timeout on read (mailer may be hung)");
return (NULL);
}
! ev = setevent(ReadTimeout, readtimeout, 0);
}
/* try to read */
--- 646,652 -----
syserr("sfgets: timeout on read (mailer may be hung)");
return (NULL);
}
! ev = setevent((time_t) ReadTimeout, readtimeout, 0);
}
/* try to read */
More information about the Comp.unix.wizards
mailing list