[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: DSN problem?
> I don't think Zmailer is translating the result codes of transport
> agents started via sm, into DSN status messages correctly.
>
> For example, the following shows a user unknown error message, but the
> DSN contains "530 Unknown error". That doesn't seem right.
Right. It isn't -- at all.
A fix for it (135 lines) at the end.
(if the TABs have not been corrupted to render it unusable..)
> Tom
/Matti Aarnio <mea@nic.funet.fi>
--- transports/sm/sm.c~ Thu Nov 14 22:43:19 1996
+++ transports/sm/sm.c Wed Nov 20 20:16:53 1996
@@ -115,22 +115,24 @@
int origstatus;
char *statusmsg;
int newstatus;
+ char *dsnstatus;
+ char *dsndiags;
} exmap[] = {
-{ EX_USAGE, "command line usage error", EX_TEMPFAIL },
-{ EX_DATAERR, "data format error", EX_DATAERR },
-{ EX_NOINPUT, "cannot open input", EX_TEMPFAIL },
-{ EX_NOUSER, "addressee unknown", EX_NOUSER },
-{ EX_NOHOST, "host name unknown", EX_NOHOST },
-{ EX_UNAVAILABLE, "service unavailable", EX_UNAVAILABLE },
-{ EX_SOFTWARE, "internal software error", EX_TEMPFAIL },
-{ EX_OSERR, "system error", EX_TEMPFAIL },
-{ EX_OSFILE, "critical OS file missing", EX_TEMPFAIL },
-{ EX_CANTCREAT, "can't create output file", EX_TEMPFAIL },
-{ EX_IOERR, "input/output error", EX_TEMPFAIL },
-{ EX_TEMPFAIL, "temporary failure", EX_TEMPFAIL },
-{ EX_PROTOCOL, "remote error in protocol", EX_TEMPFAIL },
-{ EX_NOPERM, "permission denied", EX_NOPERM },
-{ 0, NULL, EX_TEMPFAIL }
+ { EX_USAGE, "command line usage error", EX_TEMPFAIL, "5.3.0", "x-local; 500 (Command line usage error)" },
+ { EX_DATAERR, "data format error", EX_DATAERR, "5.3.0", "x-local; 500 (Data format error)" },
+ { EX_NOINPUT, "cannot open input", EX_TEMPFAIL, "5.3.0", "x-local; 530 (Cannot open input)" },
+ { EX_NOUSER, "addressee unknown", EX_NOUSER, "5.1.1", "x-local; 521 (No such target user)" },
+ { EX_NOHOST, "host name unknown", EX_NOHOST, "5.3.0", "x-local; 500 (Target host unknown)" },
+ { EX_UNAVAILABLE, "service unavailable", EX_UNAVAILABLE, "5.3.0", "x-local; 500 (Service unavailable)" },
+ { EX_SOFTWARE, "internal software error", EX_TEMPFAIL, "5.3.0", "x-local; 500 (Internal software error)" },
+ { EX_OSERR, "system error", EX_TEMPFAIL, "5.3.0", "x-local; 500 (System error)" },
+ { EX_OSFILE, "critical OS file missing", EX_TEMPFAIL, "5.3.0", "x-local; 500 (Critical OS file missing)" },
+ { EX_CANTCREAT, "can't create output file", EX_TEMPFAIL, "5.2.1", "x-local; 500 (Can't create output file)" },
+ { EX_IOERR, "input/output error", EX_TEMPFAIL, "5.2.2", "x-local; 500 (Input/Output error)" },
+ { EX_TEMPFAIL, "temporary failure", EX_TEMPFAIL, "5.3.0", "x-local; 500 (Temporary failure)" },
+ { EX_PROTOCOL, "remote error in protocol", EX_TEMPFAIL, "5.3.0", "x-local; 500 (Remote error in protocol)" },
+ { EX_NOPERM, "permission denied", EX_NOPERM, "5.2.0", "x-local; 520 (Permission denied)" },
+ { 0, NULL, EX_TEMPFAIL, NULL, NULL }
};
char myhostname[MAXHOSTNAMELEN+1];
@@ -316,6 +318,7 @@
{
struct rcpt *rp;
struct exmapinfo *exp;
+ char *exs, *exd;
int i, j, pid, in[2], out[2];
unsigned int avsize;
FILE *tafp, *errfp;
@@ -412,8 +415,8 @@
if (pipe(out) < 0) {
for (rp = startrp; rp != endrp; rp = rp->next) {
notaryreport(rp->addr->user,"failed",
- "4.3.0 (Out of system resources, pipe creation failed)",
- "x-local; 400 (pipe creation error, out of system resources ?)");
+ "5.3.0 (Out of system resources, pipe creation failed)",
+ "x-local; 500 (pipe creation error, out of system resources ?)");
diagnostic(rp, EX_OSERR, 0,
"cannot create pipe from \"%s\"",
mp->command);
@@ -423,8 +426,8 @@
if (pipe(in) < 0) {
for (rp = startrp; rp != endrp; rp = rp->next) {
notaryreport(rp->addr->user,"failed",
- "4.3.0 (Out of system resources, pipe creation failed)",
- "x-local; 400 (pipe creation error, out of system resources ?)");
+ "5.3.0 (Out of system resources, pipe creation failed)",
+ "x-local; 500 (pipe creation error, out of system resources ?)");
diagnostic(rp, EX_OSERR, 0,
"cannot create pipe to \"%s\"",
mp->command);
@@ -461,8 +464,8 @@
} else if (pid < 0) { /* couldn't fork, complain */
for (rp = startrp; rp != endrp; rp = rp->next) {
notaryreport(rp->addr->user,"failed",
- "4.3.0 (Out of system resources, fork failed)",
- "x-local; 400 (fork failure, out of system resources ?)");
+ "5.3.0 (Out of system resources, fork failed)",
+ "x-local; 500 (fork failure, out of system resources ?)");
diagnostic(rp, EX_OSERR, 0, "cannot fork");
}
return;
@@ -628,8 +631,8 @@
for (rp = startrp; rp != endrp; rp = rp->next) {
notaryreport(rp->addr->user,"failed",
/* Could indicate: 4.3.1 - mail system full ?? */
- "4.3.0 (Write to target failed for some reason)",
- "x-local; 400 (Write to target failed for some reason)");
+ "5.3.0 (Write to target failed for some reason)",
+ "x-local; 500 (Write to target failed for some reason)");
diagnostic(rp, i, 0, "write error");
}
/* just to make sure nothing will get delivered */
@@ -657,6 +660,7 @@
close(in[0]); /* more paranoia */
cp = buf + strlen(buf);
+ exd = exs = NULL;
pid = wait(&status);
if (WSIGNALSTATUS(status) != 0) {
if (cp != buf)
@@ -666,6 +670,8 @@
strcat(cp, " (Core dumped)");
strcat(cp, "]");
i = EX_TEMPFAIL;
+ exd = "x-local; 500 (failed on signal)";
+ exs = "5.3.0";
} else if (WEXITSTATUS(status) == 0
#if EX_OK != 0
|| WEXITSTATUS(status) == EX_OK
@@ -679,6 +685,8 @@
if (exp->origstatus == i) {
s = exp->statusmsg;
i = exp->newstatus;
+ exs = exp->dsnstatus;
+ exd = exp->dsndiags;
break;
}
sprintf(cp, "[exit status %d", WEXITSTATUS(status));
@@ -692,12 +700,9 @@
for (rp = startrp; rp != endrp; rp = rp->next) {
if (i == EX_OK)
notaryreport(rp->addr->user, "relayed",
- "2.2.0",
- "x-local; 250 Delivered");
+ "2.5.0", "smtp;250 (Delivered)");
else
- notaryreport(rp->addr->user, "failed",
- "5.3.0",
- "x-local; 530 Unknown error");
+ notaryreport(rp->addr->user, "failed", exs, exd);
diagnostic(rp, i, 0, "%s", buf);
}
/* XX: still need to deal with MO_STRIPQUOTES */
- Follow-Ups:
- Re: DSN problem?
- From: Tom Samplonius <tom@sdf.com> (Sun, 24 Nov 1996 03:23:16 +0200)