File indexing completed on 2024-12-15 04:50:15

0001 /*
0002   This file is part of libkldap.
0003   SPDX-FileCopyrightText: 2004-2006 Szombathelyi György <gyurco@freemail.hu>
0004 
0005   SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #pragma once
0009 
0010 /**
0011  * LDAP Error codes.
0012  * These codes taken from openldap's ldap.h, and prefixed with KLDAP_
0013  * instead of LDAP_, just for applications which uses the kldap library
0014  * doesn't need to include openldap headers
0015  */
0016 
0017 #define KLDAP_SUCCESS 0x00
0018 
0019 #define KLDAP_RANGE(n, x, y) (((x) <= (n)) && ((n) <= (y)))
0020 
0021 #define KLDAP_OPERATIONS_ERROR 0x01
0022 #define KLDAP_PROTOCOL_ERROR 0x02
0023 #define KLDAP_TIMELIMIT_EXCEEDED 0x03
0024 #define KLDAP_SIZELIMIT_EXCEEDED 0x04
0025 #define KLDAP_COMPARE_FALSE 0x05
0026 #define KLDAP_COMPARE_TRUE 0x06
0027 #define KLDAP_AUTH_METHOD_NOT_SUPPORTED 0x07
0028 #define KLDAP_STRONG_AUTH_NOT_SUPPORTED KLDAP_AUTH_METHOD_NOT_SUPPORTED
0029 #define KLDAP_STRONG_AUTH_REQUIRED 0x08
0030 #define KLDAP_STRONGER_AUTH_REQUIRED KLDAP_STRONG_AUTH_REQUIRED
0031 #define KLDAP_PARTIAL_RESULTS 0x09 /* LDAPv2+ (not LDAPv3) */
0032 
0033 #define KLDAP_REFERRAL 0x0a /* LDAPv3 */
0034 #define KLDAP_ADMINLIMIT_EXCEEDED 0x0b /* LDAPv3 */
0035 #define KLDAP_UNAVAILABLE_CRITICAL_EXTENSION 0x0c /* LDAPv3 */
0036 #define KLDAP_CONFIDENTIALITY_REQUIRED 0x0d /* LDAPv3 */
0037 #define KLDAP_SASL_BIND_IN_PROGRESS 0x0e /* LDAPv3 */
0038 
0039 #define KLDAP_ATTR_ERROR(n) KLDAP_RANGE((n), 0x10, 0x15) /* 16-21 */
0040 
0041 #define KLDAP_NO_SUCH_ATTRIBUTE 0x10
0042 #define KLDAP_UNDEFINED_TYPE 0x11
0043 #define KLDAP_INAPPROPRIATE_MATCHING 0x12
0044 #define KLDAP_CONSTRAINT_VIOLATION 0x13
0045 #define KLDAP_TYPE_OR_VALUE_EXISTS 0x14
0046 #define KLDAP_INVALID_SYNTAX 0x15
0047 
0048 #define KLDAP_NAME_ERROR(n) KLDAP_RANGE((n), 0x20, 0x24) /* 32-34,36 */
0049 
0050 #define KLDAP_NO_SUCH_OBJECT 0x20
0051 #define KLDAP_ALIAS_PROBLEM 0x21
0052 #define KLDAP_INVALID_DN_SYNTAX 0x22
0053 #define KLDAP_IS_LEAF 0x23 /* not LDAPv3 */
0054 #define KLDAP_ALIAS_DEREF_PROBLEM 0x24
0055 
0056 #define KLDAP_SECURITY_ERROR(n) KLDAP_RANGE((n), 0x2F, 0x32) /* 47-50 */
0057 
0058 #define KLDAP_PROXY_AUTHZ_FAILURE 0x2F /* LDAPv3 proxy authorization */
0059 #define KLDAP_INAPPROPRIATE_AUTH 0x30
0060 #define KLDAP_INVALID_CREDENTIALS 0x31
0061 #define KLDAP_INSUFFICIENT_ACCESS 0x32
0062 
0063 #define KLDAP_SERVICE_ERROR(n) KLDAP_RANGE((n), 0x33, 0x36) /* 51-54 */
0064 
0065 #define KLDAP_BUSY 0x33
0066 #define KLDAP_UNAVAILABLE 0x34
0067 #define KLDAP_UNWILLING_TO_PERFORM 0x35
0068 #define KLDAP_LOOP_DETECT 0x36
0069 
0070 #define KLDAP_UPDATE_ERROR(n) KLDAP_RANGE((n), 0x40, 0x47) /* 64-69,71 */
0071 
0072 #define KLDAP_NAMING_VIOLATION 0x40
0073 #define KLDAP_OBJECT_CLASS_VIOLATION 0x41
0074 #define KLDAP_NOT_ALLOWED_ON_NONLEAF 0x42
0075 #define KLDAP_NOT_ALLOWED_ON_RDN 0x43
0076 #define KLDAP_ALREADY_EXISTS 0x44
0077 #define KLDAP_NO_OBJECT_CLASS_MODS 0x45
0078 #define KLDAP_RESULTS_TOO_LARGE 0x46 /* CLDAP */
0079 #define KLDAP_AFFECTS_MULTIPLE_DSAS 0x47
0080 
0081 #define KLDAP_OTHER 0x50
0082 
0083 /* LCUP operation codes (113-117) - not implemented */
0084 #define KLDAP_CUP_RESOURCES_EXHAUSTED 0x71
0085 #define KLDAP_CUP_SECURITY_VIOLATION 0x72
0086 #define KLDAP_CUP_INVALID_DATA 0x73
0087 #define KLDAP_CUP_UNSUPPORTED_SCHEME 0x74
0088 #define KLDAP_CUP_RELOAD_REQUIRED 0x75
0089 
0090 /* Cancel operation codes (118-121) */
0091 #define KLDAP_CANCELLED 0x76
0092 #define KLDAP_NO_SUCH_OPERATION 0x77
0093 #define KLDAP_TOO_LATE 0x78
0094 
0095 #define KLDAP_CANNOT_CANCEL 0x79
0096 
0097 /* Assertion control (122) */
0098 #define KLDAP_ASSERTION_FAILED 0x7A
0099 
0100 /* Experimental result codes */
0101 #define KLDAP_E_ERROR(n) KLDAP_RANGE((n), 0x1000, 0x3FFF)
0102 
0103 /* LDAP Sync (4096) */
0104 #define KLDAP_SYNC_REFRESH_REQUIRED 0x1000
0105 
0106 /* Private Use result codes */
0107 #define KLDAP_X_ERROR(n) KLDAP_RANGE((n), 0x4000, 0xFFFF)
0108 
0109 #define KLDAP_X_SYNC_REFRESH_REQUIRED 0x4100 /* defunct */
0110 #define KLDAP_X_ASSERTION_FAILED 0x410f /* defunct */
0111 
0112 /* for the LDAP No-Op control */
0113 #define KLDAP_X_NO_OPERATION 0x410e
0114 
0115 /** API Error Codes
0116  *
0117  * Based on draft-ietf-ldap-c-api-xx
0118  * but with new negative code values
0119  */
0120 #define KLDAP_API_ERROR(n) ((n) < 0)
0121 #define KLDAP_API_RESULT(n) ((n) <= 0)
0122 
0123 #define KLDAP_SERVER_DOWN (-1)
0124 #define KLDAP_LOCAL_ERROR (-2)
0125 #define KLDAP_ENCODING_ERROR (-3)
0126 #define KLDAP_DECODING_ERROR (-4)
0127 #define KLDAP_TIMEOUT (-5)
0128 #define KLDAP_AUTH_UNKNOWN (-6)
0129 #define KLDAP_FILTER_ERROR (-7)
0130 #define KLDAP_USER_CANCELLED (-8)
0131 #define KLDAP_PARAM_ERROR (-9)
0132 #define KLDAP_NO_MEMORY (-10)
0133 #define KLDAP_CONNECT_ERROR (-11)
0134 #define KLDAP_NOT_SUPPORTED (-12)
0135 #define KLDAP_CONTROL_NOT_FOUND (-13)
0136 #define KLDAP_NO_RESULTS_RETURNED (-14)
0137 #define KLDAP_MORE_RESULTS_TO_RETURN (-15) /* Obsolete */
0138 #define KLDAP_CLIENT_LOOP (-16)
0139 #define KLDAP_REFERRAL_LIMIT_EXCEEDED (-17)
0140 
0141 /*
0142  * KLDAP Specific
0143  */
0144 
0145 #define KLDAP_SASL_ERROR -0xff