SCCS-vsn: usr.sbin/sendmail/src/recipient.c 6.22
SCCS-vsn: usr.sbin/sendmail/src/deliver.c 6.33
SCCS-vsn: usr.sbin/sendmail/src/queue.c 6.23
-static char sccsid[] = "@(#)deliver.c 6.32 (Berkeley) %G%";
+static char sccsid[] = "@(#)deliver.c 6.33 (Berkeley) %G%";
#endif /* not lint */
#include "sendmail.h"
#endif /* not lint */
#include "sendmail.h"
e->e_to = to->q_paddr;
message("queued");
if (LogLevel > 8)
e->e_to = to->q_paddr;
message("queued");
if (LogLevel > 8)
- logdelivery("queued", e);
+ logdelivery(m, NULL, "queued", e);
}
e->e_to = NULL;
return (0);
}
e->e_to = NULL;
return (0);
{
NoReturn = TRUE;
usrerr("552 Message is too large; %ld bytes max", m->m_maxsize);
{
NoReturn = TRUE;
usrerr("552 Message is too large; %ld bytes max", m->m_maxsize);
- giveresponse(EX_UNAVAILABLE, m, e);
+ giveresponse(EX_UNAVAILABLE, m, NULL, e);
continue;
}
rcode = checkcompat(to, e);
if (rcode != EX_OK)
{
continue;
}
rcode = checkcompat(to, e);
if (rcode != EX_OK)
{
- giveresponse(rcode, m, e);
+ giveresponse(rcode, m, NULL, e);
if (m == FileMailer)
{
rcode = mailfile(user, getctladdr(to), e);
if (m == FileMailer)
{
rcode = mailfile(user, getctladdr(to), e);
- giveresponse(rcode, m, e);
+ giveresponse(rcode, m, NULL, e);
if (rcode == EX_OK)
to->q_flags |= QSENT;
continue;
if (rcode == EX_OK)
to->q_flags |= QSENT;
continue;
if ((i = smtprcpt(to, m, mci, e)) != EX_OK)
{
markfailure(e, to, i);
if ((i = smtprcpt(to, m, mci, e)) != EX_OK)
{
markfailure(e, to, i);
+ giveresponse(i, m, mci, e);
give_up:
if (tobuf[0] != '\0')
give_up:
if (tobuf[0] != '\0')
- giveresponse(rcode, m, e);
+ giveresponse(rcode, m, mci, e);
for (to = tochain; to != NULL; to = to->q_tchain)
{
if (rcode != EX_OK)
for (to = tochain; to != NULL; to = to->q_tchain)
{
if (rcode != EX_OK)
** stat -- the status code from the mailer (high byte
** only; core dumps must have been taken care of
** already).
** stat -- the status code from the mailer (high byte
** only; core dumps must have been taken care of
** already).
-** m -- the mailer descriptor for this mailer.
+** m -- the mailer info for this mailer.
+** mci -- the mailer connection info -- can be NULL if the
+** response is given before the connection is made.
+** e -- the current envelope.
** ExitStat may be set.
*/
** ExitStat may be set.
*/
-giveresponse(stat, m, e)
+giveresponse(stat, m, mci, e)
int stat;
register MAILER *m;
int stat;
register MAILER *m;
ENVELOPE *e;
{
register char *statmsg;
ENVELOPE *e;
{
register char *statmsg;
#endif
char buf[MAXLINE];
#endif
char buf[MAXLINE];
-#ifdef lint
- if (m == NULL)
- return;
-#endif lint
-
/*
** Compute status message from code.
*/
/*
** Compute status message from code.
*/
*/
if (LogLevel > ((stat == EX_TEMPFAIL) ? 8 : (stat == EX_OK) ? 7 : 6))
*/
if (LogLevel > ((stat == EX_TEMPFAIL) ? 8 : (stat == EX_OK) ? 7 : 6))
- logdelivery(&statmsg[4], e);
+ logdelivery(m, mci, &statmsg[4], e);
if (stat != EX_TEMPFAIL)
setstat(stat);
if (stat != EX_TEMPFAIL)
setstat(stat);
** LOGDELIVERY -- log the delivery in the system log
**
** Parameters:
** LOGDELIVERY -- log the delivery in the system log
**
** Parameters:
-** stat -- the message to print for the status
+** m -- the mailer info. Can be NULL for initial queue.
+** mci -- the mailer connection info -- can be NULL if the
+** log is occuring when no connection is active.
+** stat -- the message to print for the status.
+** e -- the current envelope.
+logdelivery(m, mci, stat, e)
+ MAILER *m;
+ register MCI *mci;
char *stat;
register ENVELOPE *e;
{
char *delay;
char *stat;
register ENVELOPE *e;
{
char *delay;
extern char *pintvl();
# ifdef LOG
extern char *pintvl();
# ifdef LOG
+ if (mci != NULL && mci->mci_host != NULL)
+ curhost = mci->mci_host;
+ else
+ curhost = CurHostName;
+
delay = pintvl(curtime() - e->e_ctime, TRUE);
delay = pintvl(curtime() - e->e_ctime, TRUE);
- if (strcmp(stat, "Sent") != 0 || CurHostName == NULL ||
- strcmp(CurHostName, "localhost") == 0)
+ if (strcmp(stat, "Sent") != 0 || m == NULL || curhost == NULL ||
+ strcmp(curhost, "localhost") == 0)
{
syslog(LOG_INFO, "%s: to=%s, delay=%s, stat=%s",
e->e_id, e->e_to, delay, stat);
{
syslog(LOG_INFO, "%s: to=%s, delay=%s, stat=%s",
e->e_id, e->e_to, delay, stat);
char *p1, *p2;
extern char *macvalue();
char *p1, *p2;
extern char *macvalue();
- if (CurHostName[0] == '/')
{
p1 = macvalue('h', e);
if (p1 == NULL || p1[0] == '\0')
p1 = "local";
{
p1 = macvalue('h', e);
if (p1 == NULL || p1[0] == '\0')
p1 = "local";
extern struct sockaddr_in CurHostAddr;
extern char *inet_ntoa();
extern struct sockaddr_in CurHostAddr;
extern char *inet_ntoa();
p2 = inet_ntoa(CurHostAddr.sin_addr);
}
# endif
p2 = inet_ntoa(CurHostAddr.sin_addr);
}
# endif
- syslog(LOG_INFO, "%s: to=%s, delay=%s, stat=Sent to %s (%s)",
- e->e_id, e->e_to, delay, p1, p2);
+ syslog(LOG_INFO, "%s: to=%s, delay=%s, mailer=%s, stat=Sent to %s (%s)",
+ e->e_id, e->e_to, delay, m->m_name, p1, p2);
#ifndef lint
#ifdef QUEUE
#ifndef lint
#ifdef QUEUE
-static char sccsid[] = "@(#)queue.c 6.22 (Berkeley) %G% (with queueing)";
+static char sccsid[] = "@(#)queue.c 6.23 (Berkeley) %G% (with queueing)";
-static char sccsid[] = "@(#)queue.c 6.22 (Berkeley) %G% (without queueing)";
+static char sccsid[] = "@(#)queue.c 6.23 (Berkeley) %G% (without queueing)";
#endif
#endif /* not lint */
#endif
#endif /* not lint */
e->e_to = q->q_paddr;
message("queued");
if (LogLevel > 8)
e->e_to = q->q_paddr;
message("queued");
if (LogLevel > 8)
- logdelivery("queued", e);
+ logdelivery(NULL, NULL, "queued", e);
e->e_to = NULL;
}
if (tTd(40, 1))
e->e_to = NULL;
}
if (tTd(40, 1))
-static char sccsid[] = "@(#)recipient.c 6.21 (Berkeley) %G%";
+static char sccsid[] = "@(#)recipient.c 6.22 (Berkeley) %G%";
#endif /* not lint */
# include "sendmail.h"
#endif /* not lint */
# include "sendmail.h"
(*p = '\0', safefile(buf, getruid(), S_IWRITE|S_IEXEC) != 0))
{
a->q_flags |= QBADADDR;
(*p = '\0', safefile(buf, getruid(), S_IWRITE|S_IEXEC) != 0))
{
a->q_flags |= QBADADDR;
- giveresponse(EX_CANTCREAT, m, e);
+ giveresponse(EX_CANTCREAT, m, NULL, e);
if (pw == NULL)
{
a->q_flags |= QBADADDR;
if (pw == NULL)
{
a->q_flags |= QBADADDR;
- giveresponse(EX_NOUSER, m, e);
+ giveresponse(EX_NOUSER, m, NULL, e);