name in Connection timed out message; ANSI C fixes; log message sender on
returned mail during queue run; count recipients properly; fix YP code;
diagnose "message timed out" properly
SCCS-vsn: usr.sbin/sendmail/src/headers.c 6.5
SCCS-vsn: usr.sbin/sendmail/src/usersmtp.c 6.3
SCCS-vsn: usr.sbin/sendmail/src/recipient.c 6.3
SCCS-vsn: usr.sbin/sendmail/src/main.c 6.9
SCCS-vsn: usr.sbin/sendmail/src/conf.h 6.4
SCCS-vsn: usr.sbin/sendmail/src/arpadate.c 6.3
SCCS-vsn: usr.sbin/sendmail/src/err.c 6.2
SCCS-vsn: usr.sbin/sendmail/src/collect.c 6.3
SCCS-vsn: usr.sbin/sendmail/src/version.c 6.12
SCCS-vsn: usr.sbin/sendmail/src/savemail.c 6.3
SCCS-vsn: usr.sbin/sendmail/src/srvrsmtp.c 6.3
SCCS-vsn: usr.sbin/sendmail/src/util.c 6.4
SCCS-vsn: usr.sbin/sendmail/src/deliver.c 6.10
SCCS-vsn: usr.sbin/sendmail/src/queue.c 6.5
SCCS-vsn: usr.sbin/sendmail/src/conf.c 6.10
SCCS-vsn: usr.sbin/sendmail/src/map.c 6.2
SCCS-vsn: usr.sbin/sendmail/src/Makefiles/Makefile.dist 6.3
17 files changed:
#
# This has been tested on Ultrix.
#
#
# This has been tested on Ultrix.
#
-# @(#)Makefile.dist 6.2 (Berkeley) %G%
+# @(#)Makefile.dist 6.3 (Berkeley) %G%
#
# use O=-O (usual) or O=-g (debugging)
#
# use O=-O (usual) or O=-g (debugging)
# -DNDBM -- use new DBM
# -DNEWDB -- use new Berkeley DB
# -DNDBM -DNEWDB -- use both new DBM and new Berkeley DB
# -DNDBM -- use new DBM
# -DNEWDB -- use new Berkeley DB
# -DNDBM -DNEWDB -- use both new DBM and new Berkeley DB
+# -DNDBM -DNEWDB -DYPCOMPAT -- use both plus YP compatility
# The really old (V7) DBM library is no longer supported.
# The really old (V7) DBM library is no longer supported.
+# If YPCOMPAT is defined and /var/yp/Makefile exists, sendmail will build
+# both the NEWDB and DBM libraries (the DBM just for YP).
+#
DBMDEF= -DNDBM -DNEWDB
# define the load average calculation on your system: -DLA_TYPE=LA_INT,
DBMDEF= -DNDBM -DNEWDB
# define the load average calculation on your system: -DLA_TYPE=LA_INT,
-static char sccsid[] = "@(#)arpadate.c 6.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)arpadate.c 6.3 (Berkeley) %G%";
#endif /* not lint */
# include "sendmail.h"
#endif /* not lint */
# include "sendmail.h"
time_t t;
struct tm gmt;
static char b[40];
time_t t;
struct tm gmt;
static char b[40];
- extern struct tm *localtime(), *gmtime();
- extern char *ctime();
- extern time_t time();
-static char sccsid[] = "@(#)collect.c 6.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)collect.c 6.3 (Berkeley) %G%";
#endif /* not lint */
# include <errno.h>
#endif /* not lint */
# include <errno.h>
** Examples are who is the from person & the date.
*/
** Examples are who is the from person & the date.
*/
+ eatheader(e, QueueRun);
/*
** Add an Apparently-To: line if we have no recipient lines.
/*
** Add an Apparently-To: line if we have no recipient lines.
-static char sccsid[] = "@(#)conf.c 6.9 (Berkeley) %G%";
+static char sccsid[] = "@(#)conf.c 6.10 (Berkeley) %G%";
#endif /* not lint */
# include <sys/ioctl.h>
#endif /* not lint */
# include <sys/ioctl.h>
-setproctitle(fmt VA_ARG_FORMAL)
+#ifdef __STDC__
+setproctitle(char *fmt, ...)
+#else
+setproctitle(fmt, va_alist)
{
# ifdef SETPROCTITLE
register char *p;
{
# ifdef SETPROCTITLE
register char *p;
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)conf.h 6.3 (Berkeley) %G%
+ * @(#)conf.h 6.4 (Berkeley) %G%
# define SMTPLINELIM 990 /* maximum SMTP line length */
# define MAXKEY 128 /* maximum size of a database key */
# define MEMCHUNKSIZE 1024 /* chunk size for memory allocation */
# define SMTPLINELIM 990 /* maximum SMTP line length */
# define MAXKEY 128 /* maximum size of a database key */
# define MEMCHUNKSIZE 1024 /* chunk size for memory allocation */
+# define MAXUSERENVIRON 100 /* max envariables saved */
# ifndef QUEUESIZE
# define QUEUESIZE 1000 /* max # of jobs per queue run */
# ifndef QUEUESIZE
# define QUEUESIZE 1000 /* max # of jobs per queue run */
-# define VA_ARG_FORMAL
-# define VA_ARG_DECL
# define VA_LOCAL_DECL va_list ap;
# define VA_START(f) va_start(ap, f)
# define VA_END va_end(ap)
# define VA_LOCAL_DECL va_list ap;
# define VA_START(f) va_start(ap, f)
# define VA_END va_end(ap)
-# define VA_ARG_FORMAL ,va_alist
-# define VA_ARG_DECL va_dcl
# define VA_LOCAL_DECL va_list ap;
# define VA_START(f) va_start(ap)
# define VA_END va_end(ap)
# define VA_LOCAL_DECL va_list ap;
# define VA_START(f) va_start(ap)
# define VA_END va_end(ap)
char nodename[NODE_LENGTH+1];
};
#endif /* UNAME */
char nodename[NODE_LENGTH+1];
};
#endif /* UNAME */
+
+#ifdef sun
+# include <vfork.h>
+#endif
-static char sccsid[] = "@(#)deliver.c 6.9 (Berkeley) %G%";
+static char sccsid[] = "@(#)deliver.c 6.10 (Berkeley) %G%";
#endif /* not lint */
#include "sendmail.h"
#endif /* not lint */
#include "sendmail.h"
}
q->q_flags |= QBADADDR;
e->e_flags |= EF_TIMEOUT;
}
q->q_flags |= QBADADDR;
e->e_flags |= EF_TIMEOUT;
+ fprintf(e->e_xfp, "421 %s... Message timed out\n", q->q_paddr);
}
else
q->q_flags |= QQUEUEUP;
}
else
q->q_flags |= QQUEUEUP;
-static char sccsid[] = "@(#)err.c 6.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)err.c 6.2 (Berkeley) %G%";
#endif /* not lint */
# include "sendmail.h"
#endif /* not lint */
# include "sendmail.h"
static void fmtmsg();
/*VARARGS1*/
static void fmtmsg();
/*VARARGS1*/
-syserr(fmt VA_ARG_FORMAL)
+#ifdef __STDC__
+syserr(char *fmt, ...)
+#else
+syserr(fmt, va_alist)
{
register char *p;
int olderrno = errno;
{
register char *p;
int olderrno = errno;
-usrerr(fmt VA_ARG_FORMAL)
+#ifdef __STDC__
+usrerr(char *fmt, ...)
+#else
+usrerr(fmt, va_alist)
{
VA_LOCAL_DECL
extern char SuprErrs;
{
VA_LOCAL_DECL
extern char SuprErrs;
-message(num, msg VA_ARG_FORMAL)
+#ifdef __STDC__
+message(char *num, char *msg, ...)
+#else
+message(num, msg, va_alist)
-nmessage(num, msg VA_ARG_FORMAL)
+#ifdef __STDC__
+nmessage(char *num, char *msg, ...)
+#else
+nmessage(num, msg, va_alist)
-static char sccsid[] = "@(#)headers.c 6.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)headers.c 6.5 (Berkeley) %G%";
#endif /* not lint */
# include <errno.h>
#endif /* not lint */
# include <errno.h>
**
** Parameters:
** e -- the envelope to process.
**
** Parameters:
** e -- the envelope to process.
+** queuejob -- set if running a queued job.
** Aborts the message if the hop count is exceeded.
*/
** Aborts the message if the hop count is exceeded.
*/
{
register HDR *h;
register char *p;
{
register HDR *h;
register char *p;
}
/* save the message-id for logging */
}
/* save the message-id for logging */
- if (!QueueRun && h->h_value != NULL &&
+ if (!queuejob && h->h_value != NULL &&
strcmp(h->h_field, "message-id") == 0)
{
msgid = h->h_value;
strcmp(h->h_field, "message-id") == 0)
{
msgid = h->h_value;
p = hvalue("precedence", e);
if (p != NULL)
e->e_class = priencode(p);
p = hvalue("precedence", e);
if (p != NULL)
e->e_class = priencode(p);
e->e_msgpriority = e->e_msgsize
- e->e_class * WkClassFact
+ e->e_nrcpts * WkRecipFact;
e->e_msgpriority = e->e_msgsize
- e->e_class * WkClassFact
+ e->e_nrcpts * WkRecipFact;
- if (!QueueRun && LogLevel > 1)
+ if (!queuejob && LogLevel > 1)
{
char *name;
char hbuf[MAXNAME];
{
char *name;
char hbuf[MAXNAME];
{
char buf[MAX(MAXLINE,BUFSIZ)];
register HDR *h;
{
char buf[MAX(MAXLINE,BUFSIZ)];
register HDR *h;
- extern char *arpadate();
- extern char *capitalize();
char obuf[MAXLINE];
for (h = e->e_header; h != NULL; h = h->h_link)
char obuf[MAXLINE];
for (h = e->e_header; h != NULL; h = h->h_link)
{
/* vanilla header line */
register char *nlp;
{
/* vanilla header line */
register char *nlp;
+ extern char *capitalize();
(void) sprintf(obuf, "%s: ", capitalize(h->h_field));
while ((nlp = strchr(p, '\n')) != NULL)
(void) sprintf(obuf, "%s: ", capitalize(h->h_field));
while ((nlp = strchr(p, '\n')) != NULL)
int opos;
bool firstone = TRUE;
char obuf[MAXLINE + 3];
int opos;
bool firstone = TRUE;
char obuf[MAXLINE + 3];
+ extern char *capitalize();
/*
** Output the address list translated by the
/*
** Output the address list translated by the
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)main.c 6.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c 6.9 (Berkeley) %G%";
#endif /* not lint */
#define _DEFINE
#endif /* not lint */
#define _DEFINE
ENVELOPE MainEnvelope; /* the envelope around the basic letter */
ADDRESS NullAddress = /* a null address */
{ "", "", NULL, "" };
ENVELOPE MainEnvelope; /* the envelope around the basic letter */
ADDRESS NullAddress = /* a null address */
{ "", "", NULL, "" };
+char *UserEnviron[MAXUSERENVIRON + 1];
+ /* saved user environment */
/*
** Pointers for setproctitle.
/*
** Pointers for setproctitle.
extern char **myhostname();
extern char *arpadate();
extern char *optarg;
extern char **myhostname();
extern char *arpadate();
extern char *optarg;
/*
** Check to see if we reentered.
/*
** Check to see if we reentered.
readconfig = !thaw(FreezeFile, argv0);
# ifdef SETPROCTITLE
readconfig = !thaw(FreezeFile, argv0);
# ifdef SETPROCTITLE
+ /*
+ ** Move the environment so setproctitle can use the space at
+ ** the top of memory.
+ */
+
+ for (i = j = 0; j < MAXUSERENVIRON && (p = envp[i]) != NULL; i++)
+ {
+ if (strncmp(p, "FS=", 3) == 0 || strncmp(p, "LD_", 3) == 0)
+ continue;
+ UserEnviron[j++] = newstr(p);
+ }
+ UserEnviron[j] = NULL;
+ environ = UserEnviron;
+
/*
** Save start and extent of argv for setproctitle.
*/
Argv = argv;
/*
** Save start and extent of argv for setproctitle.
*/
Argv = argv;
LastArgv = envp[i - 1] + strlen(envp[i - 1]);
else
LastArgv = argv[argc - 1] + strlen(argv[argc - 1]);
LastArgv = envp[i - 1] + strlen(envp[i - 1]);
else
LastArgv = argv[argc - 1] + strlen(argv[argc - 1]);
-static char sccsid[] = "@(#)map.c 6.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)map.c 6.2 (Berkeley) %G%";
#endif /* not lint */
#include "sendmail.h"
#endif /* not lint */
#include "sendmail.h"
if (!bitset(MF_NOFOLDCASE, map->map_flags))
{
if (!bitset(MF_NOFOLDCASE, map->map_flags))
{
if (isupper(*p))
*p = tolower(*p);
}
if (isupper(*p))
*p = tolower(*p);
}
- if (yp_match(map->map_domain, map->map_file, buf, bufsiz, &vp, &vsize) != 0)
+ if (yp_match(map->map_domain, map->map_file, buf, strlen(buf) + 1,
+ &vp, &vsize) != 0)
return NULL;
if (!bitset(MF_MATCHONLY, map->map_flags))
map_rewrite(vp, vsize, buf, bufsiz, av);
return NULL;
if (!bitset(MF_MATCHONLY, map->map_flags))
map_rewrite(vp, vsize, buf, bufsiz, av);
#ifndef lint
#ifdef QUEUE
#ifndef lint
#ifdef QUEUE
-static char sccsid[] = "@(#)queue.c 6.4 (Berkeley) %G% (with queueing)";
+static char sccsid[] = "@(#)queue.c 6.5 (Berkeley) %G% (with queueing)";
-static char sccsid[] = "@(#)queue.c 6.4 (Berkeley) %G% (without queueing)";
+static char sccsid[] = "@(#)queue.c 6.5 (Berkeley) %G% (without queueing)";
#endif
#endif /* not lint */
#endif
#endif /* not lint */
{
FILE *cf;
char lbuf[MAXNAME];
{
FILE *cf;
char lbuf[MAXNAME];
+ extern bool shouldqueue();
/* is this an interesting entry? */
if (d->d_ino == 0)
/* is this an interesting entry? */
if (d->d_ino == 0)
}
e->e_flags |= EF_INQUEUE;
}
e->e_flags |= EF_INQUEUE;
/* do the delivery */
if (!bitset(EF_FATALERRS, e->e_flags))
/* do the delivery */
if (!bitset(EF_FATALERRS, e->e_flags))
a->q_home = newstr(pw->pw_dir);
a->q_uid = pw->pw_uid;
a->q_gid = pw->pw_gid;
a->q_home = newstr(pw->pw_dir);
a->q_uid = pw->pw_uid;
a->q_gid = pw->pw_gid;
- a->q_ruser = newstr(user);
+ a->q_user = newstr(user);
}
else
{
a->q_uid = DefUid;
a->q_gid = DefGid;
}
else
{
a->q_uid = DefUid;
a->q_gid = DefGid;
- a->q_ruser = newstr(DefUser);
+ a->q_user = newstr(DefUser);
- a->q_user = a->q_ruser;
a->q_flags |= QGOODUID; /* flag as a "ctladdr" */
a->q_mailer = LocalMailer;
return a;
a->q_flags |= QGOODUID; /* flag as a "ctladdr" */
a->q_mailer = LocalMailer;
return a;
-static char sccsid[] = "@(#)recipient.c 6.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)recipient.c 6.3 (Berkeley) %G%";
#endif /* not lint */
# include <sys/types.h>
#endif /* not lint */
# include <sys/types.h>
/* add address on list */
*pq = a;
a->q_next = NULL;
/* add address on list */
*pq = a;
a->q_next = NULL;
if (a->q_alias == NULL && RcptLogFile != NULL &&
!bitset(QDONTSEND, a->q_flags))
if (a->q_alias == NULL && RcptLogFile != NULL &&
!bitset(QDONTSEND, a->q_flags))
message(Arpa_Info, "including file %s", &a->q_user[9]);
(void) include(&a->q_user[9], FALSE, a, sendq, e);
}
message(Arpa_Info, "including file %s", &a->q_user[9]);
(void) include(&a->q_user[9], FALSE, a, sendq, e);
}
+ else if (m == FileMailer)
{
struct stat stb;
extern bool writable();
{
struct stat stb;
extern bool writable();
a->q_flags |= QBADADDR;
giveresponse(EX_CANTCREAT, m, e);
}
a->q_flags |= QBADADDR;
giveresponse(EX_CANTCREAT, m, e);
}
+ {
+ if (!bitset(QDONTSEND, a->q_flags))
+ e->e_nrcpts++;
/* try aliasing */
alias(a, sendq, e);
/* try aliasing */
alias(a, sendq, e);
e->e_id);
# endif
message(Arpa_Info, "queued (user database error)");
e->e_id);
# endif
message(Arpa_Info, "queued (user database error)");
forward(a, sendq, e);
}
}
forward(a, sendq, e);
}
}
+ if (!bitset(QDONTSEND, a->q_flags))
+ e->e_nrcpts++;
-static char sccsid[] = "@(#)savemail.c 6.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)savemail.c 6.3 (Berkeley) %G%";
#endif /* not lint */
# include <sys/types.h>
#endif /* not lint */
# include <sys/types.h>
addheader("to", q->q_paddr, ee);
}
addheader("to", q->q_paddr, ee);
}
+# ifdef LOG
+ if (LogLevel >= 3)
+ syslog(LOG_INFO, "%s: %s: return to sender: %s",
+ e->e_id, ee->e_id, msg);
+# endif
+
(void) sprintf(buf, "Returned mail: %s", msg);
addheader("subject", buf, ee);
(void) sprintf(buf, "Returned mail: %s", msg);
addheader("subject", buf, ee);
CurEnv = ee;
define('f', "\001n", ee);
define('x', "Mail Delivery Subsystem", ee);
CurEnv = ee;
define('f', "\001n", ee);
define('x', "Mail Delivery Subsystem", ee);
/* actually deliver the error message */
sendall(ee, SM_DEFAULT);
/* actually deliver the error message */
sendall(ee, SM_DEFAULT);
-static char sccsid[] = "@(#)srvrsmtp.c 6.2 (Berkeley) %G% (with SMTP)";
+static char sccsid[] = "@(#)srvrsmtp.c 6.3 (Berkeley) %G% (with SMTP)";
-static char sccsid[] = "@(#)srvrsmtp.c 6.2 (Berkeley) %G% (without SMTP)";
+static char sccsid[] = "@(#)srvrsmtp.c 6.3 (Berkeley) %G% (without SMTP)";
#endif
#endif /* not lint */
#endif
#endif /* not lint */
(void) dup(fileno(OutChannel));
}
settime(e);
(void) dup(fileno(OutChannel));
}
settime(e);
- if (RealHostName != NULL)
- {
- CurHostName = RealHostName;
- setproctitle("srvrsmtp %s", CurHostName);
- }
- else
- {
- /* this must be us!! */
- CurHostName = MyHostName;
- }
+ if (RealHostName == NULL)
+ RealHostName = MyHostName;
+ CurHostName = RealHostName;
+ setproctitle("srvrsmtp %s", CurHostName);
expand("\001e", inp, &inp[sizeof inp], e);
message("220", "%s", inp);
SmtpPhase = "startup";
expand("\001e", inp, &inp[sizeof inp], e);
message("220", "%s", inp);
SmtpPhase = "startup";
-static char sccsid[] = "@(#)usersmtp.c 6.2 (Berkeley) %G% (with SMTP)";
+static char sccsid[] = "@(#)usersmtp.c 6.3 (Berkeley) %G% (with SMTP)";
-static char sccsid[] = "@(#)usersmtp.c 6.2 (Berkeley) %G% (without SMTP)";
+static char sccsid[] = "@(#)usersmtp.c 6.3 (Berkeley) %G% (without SMTP)";
#endif
#endif /* not lint */
#endif
#endif /* not lint */
# endif /* ECONNRESET */
mci->mci_errno = errno;
# endif /* ECONNRESET */
mci->mci_errno = errno;
- message(Arpa_TSyserr, "reply: read error from %s",
+ mci->mci_exitstat = EX_TEMPFAIL;
+ message(Arpa_TSyserr, "%s: reply: read error from %s",
+ e->e_id == NULL ? "NOQUEUE" : e->e_id,
mci->mci_host);
/* if debugging, pause so we can see state */
if (tTd(18, 100))
mci->mci_host);
/* if debugging, pause so we can see state */
if (tTd(18, 100))
-smtpmessage(f, m, mci VA_ARG_FORMAL)
+#ifdef __STDC__
+smtpmessage(char *f, MAILER *m, MCI *mci, ...)
+#else
+smtpmessage(f, m, mci, va_alist)
char *f;
MAILER *m;
MCI *mci;
char *f;
MAILER *m;
MCI *mci;
-static char sccsid[] = "@(#)util.c 6.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)util.c 6.4 (Berkeley) %G%";
#endif /* not lint */
# include <stdio.h>
#endif /* not lint */
# include <stdio.h>
putchar('$');
continue;
}
putchar('$');
continue;
}
- for (mp = MetaMacros; mp->metaname != NULL; mp++)
+ for (mp = MetaMacros; mp->metaname != '\0'; mp++)
{
if (mp->metaval == c)
{
{
if (mp->metaval == c)
{
# ifdef LOG
syslog(LOG_NOTICE,
"timeout waiting for input from %s\n",
# ifdef LOG
syslog(LOG_NOTICE,
"timeout waiting for input from %s\n",
- RealHostName? RealHostName: "local");
+ CurHostName? CurHostName: "local");
# endif
errno = 0;
usrerr("451 timeout waiting for input");
# endif
errno = 0;
usrerr("451 timeout waiting for input");
-static char sccsid[] = "@(#)version.c 6.11 (Berkeley) %G%";
+static char sccsid[] = "@(#)version.c 6.12 (Berkeley) %G%";
-char Version[] = "ALPHA-6.11";
+char Version[] = "ALPHA-6.12";