2 * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
4 * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
5 * Copyright (c) 1988, 1993
6 * The Regents of the University of California. All rights reserved.
8 * By using this file, you agree to the terms and conditions set
9 * forth in the LICENSE file which can be found at the top level of
10 * the sendmail distribution.
16 SM_RCSID("@(#)$Id: sysexits.c,v 8.34 2002/09/09 02:43:00 gshapiro Exp $")
19 ** DSNTOEXITSTAT -- convert DSN-style error code to EX_ style.
22 ** dsncode -- the text of the DSN-style code.
25 ** The corresponding exit status.
29 dsntoexitstat(dsncode
)
34 /* first the easy cases.... */
40 /* reject other illegal values */
44 /* now decode the other two field parts */
45 if (*++dsncode
== '.')
47 code2
= atoi(dsncode
);
48 while (*dsncode
!= '\0' && *dsncode
!= '.')
52 code3
= atoi(dsncode
);
54 /* and do a nested switch to work them out */
57 case 0: /* Other or Undefined status */
58 return EX_UNAVAILABLE
;
60 case 1: /* Address Status */
63 case 0: /* Other Address Status */
66 case 1: /* Bad destination mailbox address */
67 case 6: /* Mailbox has moved, No forwarding address */
70 case 2: /* Bad destination system address */
71 case 8: /* Bad senders system address */
74 case 3: /* Bad destination mailbox address syntax */
75 case 7: /* Bad senders mailbox address syntax */
78 case 4: /* Destination mailbox address ambiguous */
79 return EX_UNAVAILABLE
;
81 case 5: /* Destination address valid */
82 /* According to RFC1893, this can't happen */
87 case 2: /* Mailbox Status */
90 case 0: /* Other or Undefined mailbox status */
91 case 1: /* Mailbox disabled, not accepting messages */
92 case 2: /* Mailbox full */
93 case 4: /* Mailing list expansion problem */
94 return EX_UNAVAILABLE
;
96 case 3: /* Message length exceeds administrative lim */
101 case 3: /* System Status */
104 case 4: /* Network and Routing Status */
107 case 0: /* Other or undefined network or routing stat */
110 case 1: /* No answer from host */
111 case 3: /* Routing server failure */
112 case 5: /* Network congestion */
115 case 2: /* Bad connection */
118 case 4: /* Unable to route */
121 case 6: /* Routing loop detected */
124 case 7: /* Delivery time expired */
125 return EX_UNAVAILABLE
;
129 case 5: /* Protocol Status */
132 case 6: /* Message Content or Media Status */
133 return EX_UNAVAILABLE
;
135 case 7: /* Security Status */
138 return EX_UNAVAILABLE
;
141 ** EXITSTAT -- convert EX_ value to error text.
144 ** excode -- rstatus which might consists of an EX_* value.
147 ** The corresponding error text or the original string.
158 if (excode
== NULL
|| *excode
== '\0')
160 i
= (int) strtol(excode
, &c
, 10);
163 exitmsg
= sm_sysexitmsg(i
);