🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.mail.sendmail
3 messages
3 total messages Started by Bill Wisner Sun, 02 Oct 1988 03:59
sendmail generates bogus error messages
#2843
Author: Bill Wisner
Date: Sun, 02 Oct 1988 03:59
12 lines
876 bytes
When sending mail to a host that isn't currently reachable, I should
be seeing error messages like

  Deferred: Connection timed out during user open with basel.ai.mit.edu

Instead, I get this:

  Deferred: Not a typewriter

I think that somewhere between the time the connection actually times
out and the time the error message is generated, something happens to
change errno to ENOTTY. But what? Anyone know how to fix this?
Re: sendmail generates bogus error messages
#2845
Author: card carrying aclu member
Date: Mon, 03 Oct 1988 19:18
25 lines
1546 bytes
In article <3153@hermes.ai.mit.edu> wisner@zug.AI.MIT.EDU (Bill Wisner) writes:
>When sending mail to a host that isn't currently reachable, I should
>be seeing error messages like
>  Deferred: Connection timed out during user open with basel.ai.mit.edu
>Instead, I get this:
>  Deferred: Not a typewriter
>I think that somewhere between the time the connection actually times
>out and the time the error message is generated, something happens to
>change errno to ENOTTY. But what? Anyone know how to fix this?

i believe the problem you are seeing is that errno gets clobbered
during a fprintf() call in usersmtp.c.  look in smtpinit() for the
fprintf() call where one of the arguments is errstring(errno) and add
two assignments to save & restore errno before calling fprintf, ala

				r = errno;
  				fprintf(CurEnv->e_xfp,
  					"421 %s.%s... Deferred: %s\n",
  					pvp[1], m->m_name, errstring(errno));
				errno = r;

of course, why errno is getting set to ENOTTY or some other value by
fprintf is in itself an interesting question ...

dsc
Re: sendmail generates bogus error messages
#2851
Author: Chris Torek
Date: Tue, 04 Oct 1988 19:41
36 lines
2116 bytes
-In article <3153@hermes.ai.mit.edu> wisner@zug.AI.MIT.EDU (Bill Wisner) writes:
->... I should be seeing error messages like
->  Deferred: Connection timed out during user open with basel.ai.mit.edu
->Instead, I get this:
->  Deferred: Not a typewriter

In article <30999@uunet.UU.NET> dsc@izimbra.CSS.GOV
(card carrying aclu member) writes:
-i believe the problem you are seeing is that errno gets clobbered
-during a fprintf() call in usersmtp.c.  look in smtpinit() for the
-fprintf() call where one of the arguments is errstring(errno) and add
-two assignments to save & restore errno before calling fprintf, ala
-
-				r = errno;
-  				fprintf(CurEnv->e_xfp,
-  					"421 %s.%s... Deferred: %s\n",
-  					pvp[1], m->m_name, errstring(errno));
-				errno = r;

This will work, but there are other fixes.

-of course, why errno is getting set to ENOTTY or some other value by
-fprintf is in itself an interesting question ...

fprintf calls isatty when printing the first character to a FILE.
isatty calls ioctl(fd, TIOCGETP) and checks for errors.  TIOCGETP
succeeds only on terminals.  The error, of course, is ENOTTY.

I fixed(?) this by changing the C library routine isatty() to itself
save and restore errno; but a proper program should never check errno
except immediately after a failing system call.  A better fix to
sendmail itself (with or without the change in the C library) is to
have it retain the error number (or string) in the envelope structure.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads