xref: /titanic_50/usr/src/cmd/mail/mta_ercode.c (revision 7eea693d6b672899726e75993fddc4e95b52647f)
1 /*
2  * CDDL HEADER START
3  *
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.
8  *
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.
13  *
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]
19  *
20  * CDDL HEADER END
21  */
22 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
23 /*	  All Rights Reserved  	*/
24 
25 
26 #pragma ident	"%Z%%M%	%I%	%E% SMI"
27 	 	/* SVr4.0 2.	*/
28 #include "mail.h"
29 /*
30  * Map mail(1) error into MTA reason-codes for negative delivery notification.
31  */
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"
50 };
51 
52 void mta_ercode(outfile)
53 FILE *outfile;
54 {
55 	register int mtacode;
56 	switch (error) {
57 	case E_FROM:	/* too many From lines */
58 		mtacode = 1;
59 		break;
60 
61 	case E_SNDR:	/* invalid sender */
62 	case E_USER:	/* invalid user */
63 		mtacode = 2;
64 		break;
65 
66 	case E_FRWL:	/* forwarding loop */
67 	case E_UNBND:	/* Unbounded forwarding */
68 		mtacode = 4;
69 		break;
70 
71 	case 23:	/* disallowed from sending binary to remote */
72 		mtacode = 7;
73 		break;
74 
75 	case E_SYNTAX:	/* syntax error */
76 	default:
77 		mtacode = 10;
78 		break;
79 
80 	case E_SURG:	/* surrogate command failed - rc != 0 || 99 */
81 		mtacode = 11;
82 		break;
83 
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;
99 
100 	case E_MBOX:	/* mbox problem */
101 		mtacode = 12;
102 		if (sav_errno != EFBIG) {
103 			break;
104 		}
105 		/* Note drop-thru... */
106 	case E_SPACE:	/* no space */
107 		mtacode = 16;
108 		break;
109 	}
110 	fprintf(outfile, "%.2d  %s\n", mtacode, MTAerrors[mtacode]);
111 }
112