2 Unix SMB/CIFS Implementation.
3 LDAP protocol helper functions for SAMBA
4 Copyright (C) Volker Lendecke 2004
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #include "lib/ldb/include/ldb.h"
26 enum ldap_request_tag {
27 LDAP_TAG_BindRequest = 0,
28 LDAP_TAG_BindResponse = 1,
29 LDAP_TAG_UnbindRequest = 2,
30 LDAP_TAG_SearchRequest = 3,
31 LDAP_TAG_SearchResultEntry = 4,
32 LDAP_TAG_SearchResultDone = 5,
33 LDAP_TAG_ModifyRequest = 6,
34 LDAP_TAG_ModifyResponse = 7,
35 LDAP_TAG_AddRequest = 8,
36 LDAP_TAG_AddResponse = 9,
37 LDAP_TAG_DelRequest = 10,
38 LDAP_TAG_DelResponse = 11,
39 LDAP_TAG_ModifyDNRequest = 12,
40 LDAP_TAG_ModifyDNResponse = 13,
41 LDAP_TAG_CompareRequest = 14,
42 LDAP_TAG_CompareResponse = 15,
43 LDAP_TAG_AbandonRequest = 16,
44 LDAP_TAG_SearchResultReference = 19,
45 LDAP_TAG_ExtendedRequest = 23,
46 LDAP_TAG_ExtendedResponse = 24
49 enum ldap_auth_mechanism {
50 LDAP_AUTH_MECH_SIMPLE = 0,
51 LDAP_AUTH_MECH_SASL = 3
54 enum ldap_result_code {
56 LDAP_OPERATIONS_ERROR = 1,
57 LDAP_PROTOCOL_ERROR = 2,
58 LDAP_TIME_LIMIT_EXCEEDED = 3,
59 LDAP_SIZE_LIMIT_EXCEEDED = 4,
60 LDAP_COMPARE_FALSE = 5,
61 LDAP_COMPARE_TRUE = 6,
62 LDAP_AUTH_METHOD_NOT_SUPPORTED = 7,
63 LDAP_STRONG_AUTH_REQUIRED = 8,
65 LDAP_ADMIN_LIMIT_EXCEEDED = 11,
66 LDAP_UNAVAILABLE_CRITICAL_EXTENSION = 12,
67 LDAP_CONFIDENTIALITY_REQUIRED = 13,
68 LDAP_SASL_BIND_IN_PROGRESS = 14,
69 LDAP_NO_SUCH_ATTRIBUTE = 16,
70 LDAP_UNDEFINED_ATTRIBUTE_TYPE = 17,
71 LDAP_INAPPROPRIATE_MATCHING = 18,
72 LDAP_CONSTRAINT_VIOLATION = 19,
73 LDAP_ATTRIBUTE_OR_VALUE_EXISTS = 20,
74 LDAP_INVALID_ATTRIBUTE_SYNTAX = 21,
75 LDAP_NO_SUCH_OBJECT = 32,
76 LDAP_ALIAS_PROBLEM = 33,
77 LDAP_INVALID_DN_SYNTAX = 34,
78 LDAP_ALIAS_DEREFERENCING_PROBLEM = 36,
79 LDAP_INAPPROPRIATE_AUTHENTICATION = 48,
80 LDAP_INVALID_CREDENTIALS = 49,
81 LDAP_INSUFFICIENT_ACCESS_RIGHTS = 50,
83 LDAP_UNAVAILABLE = 52,
84 LDAP_UNWILLING_TO_PERFORM = 53,
85 LDAP_LOOP_DETECT = 54,
86 LDAP_NAMING_VIOLATION = 64,
87 LDAP_OBJECT_CLASS_VIOLATION = 65,
88 LDAP_NOT_ALLOWED_ON_NON_LEAF = 66,
89 LDAP_NOT_ALLOWED_ON_RDN = 67,
90 LDAP_ENTRY_ALREADY_EXISTS = 68,
91 LDAP_OBJECT_CLASS_MODS_PROHIBITED = 69,
92 LDAP_AFFECTS_MULTIPLE_DSAS = 71,
99 const char *errormessage;
100 const char *referral;
103 struct ldap_BindRequest {
106 enum ldap_auth_mechanism mechanism;
108 const char *password;
110 const char *mechanism;
111 DATA_BLOB *secblob;/* optional */
116 struct ldap_BindResponse {
117 struct ldap_Result response;
119 DATA_BLOB *secblob;/* optional */
123 struct ldap_UnbindRequest {
128 LDAP_SEARCH_SCOPE_BASE = 0,
129 LDAP_SEARCH_SCOPE_SINGLE = 1,
130 LDAP_SEARCH_SCOPE_SUB = 2
134 LDAP_DEREFERENCE_NEVER = 0,
135 LDAP_DEREFERENCE_IN_SEARCHING = 1,
136 LDAP_DEREFERENCE_FINDING_BASE = 2,
137 LDAP_DEREFERENCE_ALWAYS
140 struct ldap_SearchRequest {
142 enum ldap_scope scope;
143 enum ldap_deref deref;
147 struct ldb_parse_tree *tree;
149 const char **attributes;
152 struct ldap_SearchResEntry {
155 struct ldb_message_element *attributes;
158 struct ldap_SearchResRef {
159 const char *referral;
162 enum ldap_modify_type {
163 LDAP_MODIFY_NONE = -1,
165 LDAP_MODIFY_DELETE = 1,
166 LDAP_MODIFY_REPLACE = 2
170 enum ldap_modify_type type;
171 struct ldb_message_element attrib;
174 struct ldap_ModifyRequest {
177 struct ldap_mod *mods;
180 struct ldap_AddRequest {
183 struct ldb_message_element *attributes;
186 struct ldap_DelRequest {
190 struct ldap_ModifyDNRequest {
194 const char *newsuperior;/* optional */
197 struct ldap_CompareRequest {
199 const char *attribute;
203 struct ldap_AbandonRequest {
207 struct ldap_ExtendedRequest {
209 DATA_BLOB *value;/* optional */
212 struct ldap_ExtendedResponse {
213 struct ldap_Result response;
214 const char *oid;/* optional */
215 DATA_BLOB *value;/* optional */
219 struct ldap_Result GeneralResult;
220 struct ldap_BindRequest BindRequest;
221 struct ldap_BindResponse BindResponse;
222 struct ldap_UnbindRequest UnbindRequest;
223 struct ldap_SearchRequest SearchRequest;
224 struct ldap_SearchResEntry SearchResultEntry;
225 struct ldap_Result SearchResultDone;
226 struct ldap_SearchResRef SearchResultReference;
227 struct ldap_ModifyRequest ModifyRequest;
228 struct ldap_Result ModifyResponse;
229 struct ldap_AddRequest AddRequest;
230 struct ldap_Result AddResponse;
231 struct ldap_DelRequest DelRequest;
232 struct ldap_Result DelResponse;
233 struct ldap_ModifyDNRequest ModifyDNRequest;
234 struct ldap_Result ModifyDNResponse;
235 struct ldap_CompareRequest CompareRequest;
236 struct ldap_Result CompareResponse;
237 struct ldap_AbandonRequest AbandonRequest;
238 struct ldap_ExtendedRequest ExtendedRequest;
239 struct ldap_ExtendedResponse ExtendedResponse;
242 struct ldap_message {
244 enum ldap_request_tag type;
245 union ldap_Request r;
246 struct ldb_control **controls;
249 struct event_context;
250 struct cli_credentials;
254 #include "libcli/ldap/ldap_proto.h"