1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate * CDDL HEADER START
3*0Sstevel@tonic-gate *
4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance
7*0Sstevel@tonic-gate * with the License.
8*0Sstevel@tonic-gate *
9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate * and limitations under the License.
13*0Sstevel@tonic-gate *
14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate *
20*0Sstevel@tonic-gate * CDDL HEADER END
21*0Sstevel@tonic-gate */
22*0Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
23*0Sstevel@tonic-gate /* All Rights Reserved */
24*0Sstevel@tonic-gate
25*0Sstevel@tonic-gate
26*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI"
27*0Sstevel@tonic-gate /* SVr4.0 2. */
28*0Sstevel@tonic-gate #include "mail.h"
29*0Sstevel@tonic-gate /*
30*0Sstevel@tonic-gate * Map mail(1) error into MTA reason-codes for negative delivery notification.
31*0Sstevel@tonic-gate */
32*0Sstevel@tonic-gate static char *MTAerrors[] = {
33*0Sstevel@tonic-gate "",
34*0Sstevel@tonic-gate /* 1 */ "Invalid Address Specification",
35*0Sstevel@tonic-gate /* 2 */ "Ambiguous Originator/Recipient Name",
36*0Sstevel@tonic-gate /* 3 */ "Message Transfer Agent Congestion",
37*0Sstevel@tonic-gate /* 4 */ "Loop Detection",
38*0Sstevel@tonic-gate /* 5 */ "Unavailable User Agent",
39*0Sstevel@tonic-gate /* 6 */ "Expired Maximum Time",
40*0Sstevel@tonic-gate /* 7 */ "Unsupported Encoded Information Types",
41*0Sstevel@tonic-gate /* 8 */ "Prohibited Conversion",
42*0Sstevel@tonic-gate /* 9 */ "Impractical Conversion",
43*0Sstevel@tonic-gate /* 10 */ "Invalid Parameters",
44*0Sstevel@tonic-gate /* 11 */ "Transfer Failure",
45*0Sstevel@tonic-gate /* 12 */ "Inability To Transfer",
46*0Sstevel@tonic-gate /* 13 */ "Conversion Not Performed",
47*0Sstevel@tonic-gate /* 14 */ "Deferred Delivery Not Available",
48*0Sstevel@tonic-gate /* 15 */ "Too many Recipients",
49*0Sstevel@tonic-gate /* 16 */ "Mail Too Large For Destination To Receive"
50*0Sstevel@tonic-gate };
51*0Sstevel@tonic-gate
mta_ercode(outfile)52*0Sstevel@tonic-gate void mta_ercode(outfile)
53*0Sstevel@tonic-gate FILE *outfile;
54*0Sstevel@tonic-gate {
55*0Sstevel@tonic-gate register int mtacode;
56*0Sstevel@tonic-gate switch (error) {
57*0Sstevel@tonic-gate case E_FROM: /* too many From lines */
58*0Sstevel@tonic-gate mtacode = 1;
59*0Sstevel@tonic-gate break;
60*0Sstevel@tonic-gate
61*0Sstevel@tonic-gate case E_SNDR: /* invalid sender */
62*0Sstevel@tonic-gate case E_USER: /* invalid user */
63*0Sstevel@tonic-gate mtacode = 2;
64*0Sstevel@tonic-gate break;
65*0Sstevel@tonic-gate
66*0Sstevel@tonic-gate case E_FRWL: /* forwarding loop */
67*0Sstevel@tonic-gate case E_UNBND: /* Unbounded forwarding */
68*0Sstevel@tonic-gate mtacode = 4;
69*0Sstevel@tonic-gate break;
70*0Sstevel@tonic-gate
71*0Sstevel@tonic-gate case 23: /* disallowed from sending binary to remote */
72*0Sstevel@tonic-gate mtacode = 7;
73*0Sstevel@tonic-gate break;
74*0Sstevel@tonic-gate
75*0Sstevel@tonic-gate case E_SYNTAX: /* syntax error */
76*0Sstevel@tonic-gate default:
77*0Sstevel@tonic-gate mtacode = 10;
78*0Sstevel@tonic-gate break;
79*0Sstevel@tonic-gate
80*0Sstevel@tonic-gate case E_SURG: /* surrogate command failed - rc != 0 || 99 */
81*0Sstevel@tonic-gate mtacode = 11;
82*0Sstevel@tonic-gate break;
83*0Sstevel@tonic-gate
84*0Sstevel@tonic-gate case E_REMOTE: /* unknown remote */
85*0Sstevel@tonic-gate case E_FILE: /* file error */
86*0Sstevel@tonic-gate case E_FRWD: /* cannot forward */
87*0Sstevel@tonic-gate case E_PERM: /* bad permissions */
88*0Sstevel@tonic-gate case E_TMP: /* temporary file problem */
89*0Sstevel@tonic-gate case E_DEAD: /* Cannot create dead.letter */
90*0Sstevel@tonic-gate case E_LOCK: /* cannot create lock file */
91*0Sstevel@tonic-gate case E_GROUP: /* no group id of 'mail' */
92*0Sstevel@tonic-gate case E_MEM: /* malloc failure */
93*0Sstevel@tonic-gate case E_FORK: /* could not fork */
94*0Sstevel@tonic-gate case E_PIPE: /* could not pipe */
95*0Sstevel@tonic-gate case E_OWNR: /* invoker does not own mailfile */
96*0Sstevel@tonic-gate case E_DENY: /* permission denied by mailsurr file */
97*0Sstevel@tonic-gate mtacode = 12;
98*0Sstevel@tonic-gate break;
99*0Sstevel@tonic-gate
100*0Sstevel@tonic-gate case E_MBOX: /* mbox problem */
101*0Sstevel@tonic-gate mtacode = 12;
102*0Sstevel@tonic-gate if (sav_errno != EFBIG) {
103*0Sstevel@tonic-gate break;
104*0Sstevel@tonic-gate }
105*0Sstevel@tonic-gate /* Note drop-thru... */
106*0Sstevel@tonic-gate case E_SPACE: /* no space */
107*0Sstevel@tonic-gate mtacode = 16;
108*0Sstevel@tonic-gate break;
109*0Sstevel@tonic-gate }
110*0Sstevel@tonic-gate fprintf(outfile, "%.2d %s\n", mtacode, MTAerrors[mtacode]);
111*0Sstevel@tonic-gate }
112