1 /*
2  * Copyright (c) 1998-2001, 2003 Proofpoint, Inc. and its suppliers.
3  *	All rights reserved.
4  *
5  * By using this file, you agree to the terms and conditions set
6  * forth in the LICENSE file which can be found at the top level of
7  * the sendmail distribution.
8  *
9  *	$Id: errstring.h,v 1.11 2013-11-22 20:51:31 ca Exp $
10  */
11 
12 /*
13 **  Error codes.
14 */
15 
16 #ifndef SM_ERRSTRING_H
17 # define SM_ERRSTRING_H
18 
19 #if defined(__QNX__)
20 # define E_PSEUDOBASE	512
21 #endif
22 
23 #include <errno.h>
24 #if NEEDINTERRNO
25 extern int errno;
26 #endif
27 
28 /*
29 **  These are used in a few cases where we need some special
30 **  error codes, but where the system doesn't provide something
31 **  reasonable.  They are printed in sm_errstring.
32 */
33 
34 #ifndef E_PSEUDOBASE
35 # define E_PSEUDOBASE	256
36 #endif
37 
38 #define E_SM_OPENTIMEOUT (E_PSEUDOBASE + 0)	/* Timeout on file open */
39 #define E_SM_NOSLINK	(E_PSEUDOBASE + 1)	/* Symbolic links not allowed */
40 #define E_SM_NOHLINK	(E_PSEUDOBASE + 2)	/* Hard links not allowed */
41 #define E_SM_REGONLY	(E_PSEUDOBASE + 3)	/* Regular files only */
42 #define E_SM_ISEXEC	(E_PSEUDOBASE + 4)	/* Executable files not allowed */
43 #define E_SM_WWDIR	(E_PSEUDOBASE + 5)	/* World writable directory */
44 #define E_SM_GWDIR	(E_PSEUDOBASE + 6)	/* Group writable directory */
45 #define E_SM_FILECHANGE (E_PSEUDOBASE + 7)	/* File changed after open */
46 #define E_SM_WWFILE	(E_PSEUDOBASE + 8)	/* World writable file */
47 #define E_SM_GWFILE	(E_PSEUDOBASE + 9)	/* Group writable file */
48 #define E_SM_GRFILE	(E_PSEUDOBASE + 10)	/* g readable file */
49 #define E_SM_WRFILE	(E_PSEUDOBASE + 11)	/* o readable file */
50 #define E_DNSBASE	(E_PSEUDOBASE + 20)	/* base for DNS h_errno */
51 #define E_SMDBBASE	(E_PSEUDOBASE + 40)	/* base for libsmdb errors */
52 #define E_LDAPREALBASE	(E_PSEUDOBASE + 70)	/* start of range for LDAP */
53 #define E_LDAPBASE	(E_LDAPREALBASE + E_LDAP_SHIM)	/* LDAP error zero */
54 #define E_LDAPURLBASE	(E_PSEUDOBASE + 230)	/* base for LDAP URL errors */
55 
56 /*
57 **  OpenLDAP uses small negative errors for internal (non-protocol)
58 **  errors.  We expect them to be between zero and -E_LDAP_SHIM
59 **  (and then offset by E_LDAPBASE).
60 */
61 
62 #define E_LDAP_SHIM	30
63 
64 /* libsmdb */
65 #define SMDBE_OK			0
66 #define SMDBE_MALLOC			(E_SMDBBASE + 1)
67 #define SMDBE_GDBM_IS_BAD		(E_SMDBBASE + 2)
68 #define SMDBE_UNSUPPORTED		(E_SMDBBASE + 3)
69 #define SMDBE_DUPLICATE			(E_SMDBBASE + 4)
70 #define SMDBE_BAD_OPEN			(E_SMDBBASE + 5)
71 #define SMDBE_NOT_FOUND			(E_SMDBBASE + 6)
72 #define SMDBE_UNKNOWN_DB_TYPE		(E_SMDBBASE + 7)
73 #define SMDBE_UNSUPPORTED_DB_TYPE	(E_SMDBBASE + 8)
74 #define SMDBE_INCOMPLETE		(E_SMDBBASE + 9)
75 #define SMDBE_KEY_EMPTY			(E_SMDBBASE + 10)
76 #define SMDBE_KEY_EXIST			(E_SMDBBASE + 11)
77 #define SMDBE_LOCK_DEADLOCK		(E_SMDBBASE + 12)
78 #define SMDBE_LOCK_NOT_GRANTED		(E_SMDBBASE + 13)
79 #define SMDBE_LOCK_NOT_HELD		(E_SMDBBASE + 14)
80 #define SMDBE_RUN_RECOVERY		(E_SMDBBASE + 15)
81 #define SMDBE_IO_ERROR			(E_SMDBBASE + 16)
82 #define SMDBE_READ_ONLY			(E_SMDBBASE + 17)
83 #define SMDBE_DB_NAME_TOO_LONG		(E_SMDBBASE + 18)
84 #define SMDBE_INVALID_PARAMETER		(E_SMDBBASE + 19)
85 #define SMDBE_ONLY_SUPPORTS_ONE_CURSOR	(E_SMDBBASE + 20)
86 #define SMDBE_NOT_A_VALID_CURSOR	(E_SMDBBASE + 21)
87 #define SMDBE_LAST_ENTRY		(E_SMDBBASE + 22)
88 #define SMDBE_OLD_VERSION		(E_SMDBBASE + 23)
89 #define SMDBE_VERSION_MISMATCH		(E_SMDBBASE + 24)
90 
91 extern const char *sm_errstring __P((int _errnum));
92 
93 #endif /* SM_ERRSTRING_H */
94