2 * Copyright (c) 2001, 2003 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.
14 SM_RCSID("@(#)$Id: errstring.c,v 1.12.2.4 2003/06/24 17:16:09 ca Exp $")
17 #include <stdio.h> /* sys_errlist, on some platforms */
19 #include <sm/io.h> /* sm_snprintf */
20 #include <sm/string.h>
21 #include <sm/errstring.h>
29 # include <ldap.h> /* for LDAP error codes */
33 ** Notice: this file is used by libmilter. Please try to avoid
34 ** using libsm specific functions.
38 ** SM_ERRSTRING -- return string description of error code
41 ** errnum -- the error number to translate
44 ** A string description of errnum.
46 ** Note: this may point to a local (static) buffer.
59 /* SunOS gives "Not owner" -- this is the POSIX message */
60 return "Operation not permitted";
63 ** Error messages used internally in sendmail.
66 case E_SM_OPENTIMEOUT:
67 return "Timeout on file open";
70 return "Symbolic links not allowed";
73 return "Hard links not allowed";
76 return "Regular files only";
79 return "Executable files not allowed";
82 return "World writable directory";
85 return "Group writable directory";
88 return "File changed after open";
91 return "World writable file";
94 return "Group writable file";
97 return "Group readable file";
100 return "World readable file";
103 ** DNS error messages.
107 case HOST_NOT_FOUND + E_DNSBASE:
108 return "Name server: host not found";
110 case TRY_AGAIN + E_DNSBASE:
111 return "Name server: host name lookup failure";
113 case NO_RECOVERY + E_DNSBASE:
114 return "Name server: non-recoverable error";
116 case NO_DATA + E_DNSBASE:
117 return "Name server: no data known";
118 #endif /* NAMED_BIND */
121 ** libsmdb error messages.
125 return "Memory allocation failed";
127 case SMDBE_GDBM_IS_BAD:
128 return "GDBM is not supported";
130 case SMDBE_UNSUPPORTED:
131 return "Unsupported action";
133 case SMDBE_DUPLICATE:
134 return "Key already exists";
137 return "Database open failed";
139 case SMDBE_NOT_FOUND:
140 return "Key not found";
142 case SMDBE_UNKNOWN_DB_TYPE:
143 return "Unknown database type";
145 case SMDBE_UNSUPPORTED_DB_TYPE:
146 return "Support for database type not compiled into this program";
148 case SMDBE_INCOMPLETE:
149 return "DB sync did not finish";
151 case SMDBE_KEY_EMPTY:
152 return "Key is empty";
154 case SMDBE_KEY_EXIST:
155 return "Key already exists";
157 case SMDBE_LOCK_DEADLOCK:
158 return "Locker killed to resolve deadlock";
160 case SMDBE_LOCK_NOT_GRANTED:
161 return "Lock unavailable";
163 case SMDBE_LOCK_NOT_HELD:
164 return "Lock not held by locker";
166 case SMDBE_RUN_RECOVERY:
167 return "Database panic, run recovery";
172 case SMDBE_READ_ONLY:
173 return "Database opened read-only";
175 case SMDBE_DB_NAME_TOO_LONG:
176 return "Name too long";
178 case SMDBE_INVALID_PARAMETER:
179 return "Invalid parameter";
181 case SMDBE_ONLY_SUPPORTS_ONE_CURSOR:
182 return "Only one cursor allowed";
184 case SMDBE_NOT_A_VALID_CURSOR:
185 return "Invalid cursor";
187 case SMDBE_OLD_VERSION:
188 return "Berkeley DB file is an old version, recreate it";
190 case SMDBE_VERSION_MISMATCH:
191 return "Berkeley DB version mismatch between include file and library";
195 ** LDAP error messages.
199 if (errnum >= E_LDAPBASE)
200 return ldap_err2string(errnum - E_LDAPBASE);
203 ret = strerror(errnum);
208 (void) sm_snprintf(buf, sizeof buf, "Error %d", errnum);