1/*
2 This file is part of libkldap.
3 Copyright (c) 2004-2006 Szombathelyi György <gyurco@freemail.hu>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KLDAP_DEFS_H
22#define KLDAP_DEFS_H
23
24/**
25 * LDAP Error codes.
26 * These codes taken from openldap's ldap.h, and prefixed with KLDAP_
27 * instead of LDAP_, just for applications which uses the kldap library
28 * doesn't need to include openldap headers
29 */
30
31#define KLDAP_SUCCESS 0x00
32
33#define KLDAP_RANGE(n,x,y) (((x) <= (n)) && ((n) <= (y)))
34
35#define KLDAP_OPERATIONS_ERROR 0x01
36#define KLDAP_PROTOCOL_ERROR 0x02
37#define KLDAP_TIMELIMIT_EXCEEDED 0x03
38#define KLDAP_SIZELIMIT_EXCEEDED 0x04
39#define KLDAP_COMPARE_FALSE 0x05
40#define KLDAP_COMPARE_TRUE 0x06
41#define KLDAP_AUTH_METHOD_NOT_SUPPORTED 0x07
42#define KLDAP_STRONG_AUTH_NOT_SUPPORTED KLDAP_AUTH_METHOD_NOT_SUPPORTED
43#define KLDAP_STRONG_AUTH_REQUIRED 0x08
44#define KLDAP_STRONGER_AUTH_REQUIRED KLDAP_STRONG_AUTH_REQUIRED
45#define KLDAP_PARTIAL_RESULTS 0x09 /* LDAPv2+ (not LDAPv3) */
46
47#define KLDAP_REFERRAL 0x0a /* LDAPv3 */
48#define KLDAP_ADMINLIMIT_EXCEEDED 0x0b /* LDAPv3 */
49#define KLDAP_UNAVAILABLE_CRITICAL_EXTENSION 0x0c /* LDAPv3 */
50#define KLDAP_CONFIDENTIALITY_REQUIRED 0x0d /* LDAPv3 */
51#define KLDAP_SASL_BIND_IN_PROGRESS 0x0e /* LDAPv3 */
52
53#define KLDAP_ATTR_ERROR(n) KLDAP_RANGE((n),0x10,0x15) /* 16-21 */
54
55#define KLDAP_NO_SUCH_ATTRIBUTE 0x10
56#define KLDAP_UNDEFINED_TYPE 0x11
57#define KLDAP_INAPPROPRIATE_MATCHING 0x12
58#define KLDAP_CONSTRAINT_VIOLATION 0x13
59#define KLDAP_TYPE_OR_VALUE_EXISTS 0x14
60#define KLDAP_INVALID_SYNTAX 0x15
61
62#define KLDAP_NAME_ERROR(n) KLDAP_RANGE((n),0x20,0x24) /* 32-34,36 */
63
64#define KLDAP_NO_SUCH_OBJECT 0x20
65#define KLDAP_ALIAS_PROBLEM 0x21
66#define KLDAP_INVALID_DN_SYNTAX 0x22
67#define KLDAP_IS_LEAF 0x23 /* not LDAPv3 */
68#define KLDAP_ALIAS_DEREF_PROBLEM 0x24
69
70#define KLDAP_SECURITY_ERROR(n) KLDAP_RANGE((n),0x2F,0x32) /* 47-50 */
71
72#define KLDAP_PROXY_AUTHZ_FAILURE 0x2F /* LDAPv3 proxy authorization */
73#define KLDAP_INAPPROPRIATE_AUTH 0x30
74#define KLDAP_INVALID_CREDENTIALS 0x31
75#define KLDAP_INSUFFICIENT_ACCESS 0x32
76
77#define KLDAP_SERVICE_ERROR(n) KLDAP_RANGE((n),0x33,0x36) /* 51-54 */
78
79#define KLDAP_BUSY 0x33
80#define KLDAP_UNAVAILABLE 0x34
81#define KLDAP_UNWILLING_TO_PERFORM 0x35
82#define KLDAP_LOOP_DETECT 0x36
83
84#define KLDAP_UPDATE_ERROR(n) KLDAP_RANGE((n),0x40,0x47) /* 64-69,71 */
85
86#define KLDAP_NAMING_VIOLATION 0x40
87#define KLDAP_OBJECT_CLASS_VIOLATION 0x41
88#define KLDAP_NOT_ALLOWED_ON_NONLEAF 0x42
89#define KLDAP_NOT_ALLOWED_ON_RDN 0x43
90#define KLDAP_ALREADY_EXISTS 0x44
91#define KLDAP_NO_OBJECT_CLASS_MODS 0x45
92#define KLDAP_RESULTS_TOO_LARGE 0x46 /* CLDAP */
93#define KLDAP_AFFECTS_MULTIPLE_DSAS 0x47
94
95#define KLDAP_OTHER 0x50
96
97/* LCUP operation codes (113-117) - not implemented */
98#define KLDAP_CUP_RESOURCES_EXHAUSTED 0x71
99#define KLDAP_CUP_SECURITY_VIOLATION 0x72
100#define KLDAP_CUP_INVALID_DATA 0x73
101#define KLDAP_CUP_UNSUPPORTED_SCHEME 0x74
102#define KLDAP_CUP_RELOAD_REQUIRED 0x75
103
104/* Cancel operation codes (118-121) */
105#define KLDAP_CANCELLED 0x76
106#define KLDAP_NO_SUCH_OPERATION 0x77
107#define KLDAP_TOO_LATE 0x78
108
109#define KLDAP_CANNOT_CANCEL 0x79
110
111/* Assertion control (122) */
112#define KLDAP_ASSERTION_FAILED 0x7A
113
114/* Experimental result codes */
115#define KLDAP_E_ERROR(n) KLDAP_RANGE((n),0x1000,0x3FFF)
116
117/* LDAP Sync (4096) */
118#define KLDAP_SYNC_REFRESH_REQUIRED 0x1000
119
120/* Private Use result codes */
121#define KLDAP_X_ERROR(n) KLDAP_RANGE((n),0x4000,0xFFFF)
122
123#define KLDAP_X_SYNC_REFRESH_REQUIRED 0x4100 /* defunct */
124#define KLDAP_X_ASSERTION_FAILED 0x410f /* defunct */
125
126/* for the LDAP No-Op control */
127#define KLDAP_X_NO_OPERATION 0x410e
128
129/** API Error Codes
130 *
131 * Based on draft-ietf-ldap-c-api-xx
132 * but with new negative code values
133 */
134#define KLDAP_API_ERROR(n) ((n)<0)
135#define KLDAP_API_RESULT(n) ((n)<=0)
136
137#define KLDAP_SERVER_DOWN (-1)
138#define KLDAP_LOCAL_ERROR (-2)
139#define KLDAP_ENCODING_ERROR (-3)
140#define KLDAP_DECODING_ERROR (-4)
141#define KLDAP_TIMEOUT (-5)
142#define KLDAP_AUTH_UNKNOWN (-6)
143#define KLDAP_FILTER_ERROR (-7)
144#define KLDAP_USER_CANCELLED (-8)
145#define KLDAP_PARAM_ERROR (-9)
146#define KLDAP_NO_MEMORY (-10)
147#define KLDAP_CONNECT_ERROR (-11)
148#define KLDAP_NOT_SUPPORTED (-12)
149#define KLDAP_CONTROL_NOT_FOUND (-13)
150#define KLDAP_NO_RESULTS_RETURNED (-14)
151#define KLDAP_MORE_RESULTS_TO_RETURN (-15) /* Obsolete */
152#define KLDAP_CLIENT_LOOP (-16)
153#define KLDAP_REFERRAL_LIMIT_EXCEEDED (-17)
154
155/*
156 * KLDAP Specific
157 */
158
159#define KLDAP_SASL_ERROR -0xff
160
161#endif //KLDAP_DEFS_H
162