SCCS-vsn: usr.sbin/sendmail/src/recipient.c 6.29
SCCS-vsn: usr.sbin/sendmail/src/main.c 6.39
SCCS-vsn: usr.sbin/sendmail/src/err.c 6.8
SCCS-vsn: usr.sbin/sendmail/src/collect.c 6.10
SCCS-vsn: usr.sbin/sendmail/src/queue.c 6.28
-static char sccsid[] = "@(#)collect.c 6.9 (Berkeley) %G%";
+static char sccsid[] = "@(#)collect.c 6.10 (Berkeley) %G%";
#endif /* not lint */
# include <errno.h>
#endif /* not lint */
# include <errno.h>
}
if ((e->e_dfp = fopen(e->e_df, "r")) == NULL)
}
if ((e->e_dfp = fopen(e->e_df, "r")) == NULL)
+ {
+ /* we haven't acked receipt yet, so just chuck this */
syserr("Cannot reopen %s", e->e_df);
syserr("Cannot reopen %s", e->e_df);
}
\f/*
** FLUSHEOL -- if not at EOL, throw away rest of input line.
}
\f/*
** FLUSHEOL -- if not at EOL, throw away rest of input line.
-static char sccsid[] = "@(#)err.c 6.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)err.c 6.8 (Berkeley) %G%";
#endif /* not lint */
# include "sendmail.h"
#endif /* not lint */
# include "sendmail.h"
** Prints an error message via printf to the diagnostic
** output. If LOG is defined, it logs it also.
**
** Prints an error message via printf to the diagnostic
** output. If LOG is defined, it logs it also.
**
+** If the first character of the syserr message is `!' it will
+** log this as an ALERT message and exit immediately. This can
+** leave queue files in an indeterminate state, so it should not
+** be used lightly.
+**
** Parameters:
** f -- the format string
** a, b, c, d, e -- parameters
** Parameters:
** f -- the format string
** a, b, c, d, e -- parameters
{
register char *p;
int olderrno = errno;
{
register char *p;
int olderrno = errno;
+ panic = *fmt == '!';
+ if (panic)
+ fmt++;
+
/* format and output the error message */
if (olderrno == 0)
p = "554";
/* format and output the error message */
if (olderrno == 0)
p = "554";
# ifdef LOG
if (LogLevel > 0)
# ifdef LOG
if (LogLevel > 0)
- syslog(LOG_CRIT, "%s: SYSERR: %s",
+ syslog(panic ? LOG_ALERT : LOG_CRIT, "%s: SYSERR: %s",
CurEnv->e_id == NULL ? "NOQUEUE" : CurEnv->e_id,
&MsgBuf[4]);
# endif /* LOG */
CurEnv->e_id == NULL ? "NOQUEUE" : CurEnv->e_id,
&MsgBuf[4]);
# endif /* LOG */
+ if (panic)
+ exit(EX_OSERR);
errno = 0;
if (QuickAbort)
longjmp(TopFrame, 2);
errno = 0;
if (QuickAbort)
longjmp(TopFrame, 2);
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)main.c 6.38 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c 6.39 (Berkeley) %G%";
#endif /* not lint */
#define _DEFINE
#endif /* not lint */
#define _DEFINE
bool safecf = TRUE;
static bool reenter = FALSE;
char *argv0 = argv[0];
bool safecf = TRUE;
static bool reenter = FALSE;
char *argv0 = argv[0];
char jbuf[MAXHOSTNAMELEN]; /* holds MyHostName */
extern int DtableSize;
extern int optind;
char jbuf[MAXHOSTNAMELEN]; /* holds MyHostName */
extern int DtableSize;
extern int optind;
*/
i = open("/dev/null", O_RDWR);
*/
i = open("/dev/null", O_RDWR);
- while (i >= 0 && i < 2)
- i = dup(i);
+ if (fstat(STDIN_FILENO, &stb) < 0)
+ (void) dup2(i, STDIN_FILENO);
+ if (fstat(STDOUT_FILENO, &stb) < 0)
+ (void) dup2(i, STDOUT_FILENO);
+ if (fstat(STDERR_FILENO, &stb) < 0)
+ (void) dup2(i, STDERR_FILENO);
+ (void) close(i);
i = DtableSize;
while (--i > 0)
i = DtableSize;
while (--i > 0)
#ifndef lint
#ifdef QUEUE
#ifndef lint
#ifdef QUEUE
-static char sccsid[] = "@(#)queue.c 6.27 (Berkeley) %G% (with queueing)";
+static char sccsid[] = "@(#)queue.c 6.28 (Berkeley) %G% (with queueing)";
-static char sccsid[] = "@(#)queue.c 6.27 (Berkeley) %G% (without queueing)";
+static char sccsid[] = "@(#)queue.c 6.28 (Berkeley) %G% (without queueing)";
#endif
#endif /* not lint */
#endif
#endif /* not lint */
{
if (errno == EEXIST)
continue;
{
if (errno == EEXIST)
continue;
- syserr("queueup: cannot create temp file %s", tf);
- return;
+ syserr("!queueup: cannot create temp file %s", tf);
}
if (lockfile(fd, tf, LOCK_EX|LOCK_NB))
}
if (lockfile(fd, tf, LOCK_EX|LOCK_NB))
e->e_df = newstr(queuename(e, 'd'));
fd = open(e->e_df, O_WRONLY|O_CREAT, FileMode);
if (fd < 0)
e->e_df = newstr(queuename(e, 'd'));
fd = open(e->e_df, O_WRONLY|O_CREAT, FileMode);
if (fd < 0)
- {
- syserr("queueup: cannot create %s", e->e_df);
- if (!newid)
- (void) xfclose(tfp, "queueup tfp", e->e_id);
- return;
- }
+ syserr("!queueup: cannot create %s", e->e_df);
dfp = fdopen(fd, "w");
(*e->e_putbody)(dfp, ProgMailer, e);
(void) xfclose(dfp, "queueup dfp", e->e_id);
dfp = fdopen(fd, "w");
(*e->e_putbody)(dfp, ProgMailer, e);
(void) xfclose(dfp, "queueup dfp", e->e_id);
-static char sccsid[] = "@(#)recipient.c 6.28 (Berkeley) %G%";
+static char sccsid[] = "@(#)recipient.c 6.29 (Berkeley) %G%";
#endif /* not lint */
# include "sendmail.h"
#endif /* not lint */
# include "sendmail.h"
int ret = errno;
clrevent(ev);
int ret = errno;
clrevent(ev);
- usrerr("550 Cannot open %s: %s", fname, errstring(ret));
+ if (transienterror(ret))
+ {
+ ctladdr->q_flags |= QQUEUEUP|QDONTSEND;
+ errno = 0;
+ usrerr("451 Cannot open %s: %s", fname, errstring(ret));
+ }
+ else
+ {
+ usrerr("550 Cannot open %s: %s", fname, errstring(ret));
+ }