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