1 /* Do not modify this file. */
2 /* It is created automatically by the ASN.1 to Wireshark dissector compiler */
4 /* ../../tools/asn2wrs.py -b -p ldap -c ldap.cnf -s packet-ldap-template Lightweight-Directory-Access-Protocol-V3.asn */
6 /* Input file: packet-ldap-template.c */
8 #line 1 "packet-ldap-template.c"
10 * Routines for ldap packet dissection
12 * See RFC 1777 (LDAP v2), RFC 2251 (LDAP v3), and RFC 2222 (SASL).
16 * Wireshark - Network traffic analyzer
17 * By Gerald Combs <gerald@wireshark.org>
18 * Copyright 1998 Gerald Combs
20 * This program is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU General Public License
22 * as published by the Free Software Foundation; either version 2
23 * of the License, or (at your option) any later version.
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
30 * You should have received a copy of the GNU General Public License
31 * along with this program; if not, write to the Free Software
32 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
36 * This is not a complete implementation. It doesn't handle the full version 3, more specifically,
37 * it handles only the commands of version 2, but any additional characteristics of the ver3 command are supported.
38 * It's also missing extensible search filters.
40 * There should probably be alot more error checking, I simply assume that if we have a full packet, it will be a complete
43 * AFAIK, it will handle all messages used by the OpenLDAP 1.2.9 server and libraries which was my goal. I do plan to add
44 * the remaining commands as time permits but this is not a priority to me. Send me an email if you need it and I'll see what
48 * nazard@dragoninc.on.ca
52 * 11/11/2002 - Fixed problem when decoding LDAP with desegmentation enabled and the
53 * ASN.1 BER Universal Class Tag: "Sequence Of" header is encapsulated across 2
57 * ronald.henderson@cognicaseusa.com
61 * 20-JAN-2004 - added decoding of MS-CLDAP netlogon RPC
62 * using information from the SNIA 2003 conference paper :
63 * Active Directory Domain Controller Location Service
69 * 17-DEC-2004 - added basic decoding for LDAP Controls
70 * 20-DEC-2004 - added handling for GSS-API encrypted blobs
72 * Stefan Metzmacher <metze@samba.org>
74 * 15-NOV-2005 - Changed to use the asn2wrs compiler
75 * Anders Broman <anders.broman@ericsson.com>
79 * 3-AUG-2008 - Extended the cldap support to include all netlogon data types.
80 * Updated cldap_netlogon_flags to include Windows 2008 flags
81 * Expanded the ntver ldap option with bit field
83 * Gary Reynolds <gazzadownunder@yahoo.co.uk>
96 #include <epan/packet.h>
97 #include <epan/conversation.h>
98 #include <epan/prefs.h>
100 #include <epan/emem.h>
101 #include <epan/oids.h>
102 #include <epan/strutil.h>
103 #include <epan/dissectors/packet-tcp.h>
104 #include <epan/dissectors/packet-windows-common.h>
105 #include <epan/dissectors/packet-dcerpc.h>
106 #include <epan/asn1.h>
108 #include "packet-frame.h"
109 #include "packet-ldap.h"
110 #include "packet-ntlmssp.h"
111 #include "packet-ssl.h"
112 #include "packet-smb-common.h"
114 #include "packet-ber.h"
115 #include "packet-per.h"
117 #define PNAME "Lightweight-Directory-Access-Protocol"
118 #define PSNAME "LDAP"
119 #define PFNAME "ldap"
121 /* Initialize the protocol and registered fields */
122 static int ldap_tap = -1;
123 static int proto_ldap = -1;
124 static int proto_cldap = -1;
126 static int hf_ldap_sasl_buffer_length = -1;
127 static int hf_ldap_response_in = -1;
128 static int hf_ldap_response_to = -1;
129 static int hf_ldap_time = -1;
130 static int hf_ldap_guid = -1;
132 static int hf_mscldap_ntver_flags = -1;
133 static int hf_mscldap_ntver_flags_v1 = -1;
134 static int hf_mscldap_ntver_flags_v5 = -1;
135 static int hf_mscldap_ntver_flags_v5ex = -1;
136 static int hf_mscldap_ntver_flags_v5ip = -1;
137 static int hf_mscldap_ntver_flags_v5cs = -1;
138 static int hf_mscldap_ntver_flags_nt4 = -1;
139 static int hf_mscldap_ntver_flags_pdc = -1;
140 static int hf_mscldap_ntver_flags_local = -1;
141 static int hf_mscldap_ntver_flags_ip = -1;
142 static int hf_mscldap_ntver_flags_gc = -1;
143 static int hf_mscldap_netlogon_ipaddress_family = -1;
144 static int hf_mscldap_netlogon_ipaddress_port = -1;
145 static int hf_mscldap_netlogon_ipaddress = -1;
146 static int hf_mscldap_netlogon_ipaddress_ipv4 = -1;
147 static int hf_mscldap_netlogon_type = -1;
148 static int hf_mscldap_netlogon_length = -1;
149 static int hf_mscldap_netlogon_flags = -1;
150 static int hf_mscldap_netlogon_flags_pdc = -1;
151 static int hf_mscldap_netlogon_flags_gc = -1;
152 static int hf_mscldap_netlogon_flags_ldap = -1;
153 static int hf_mscldap_netlogon_flags_ds = -1;
154 static int hf_mscldap_netlogon_flags_kdc = -1;
155 static int hf_mscldap_netlogon_flags_timeserv = -1;
156 static int hf_mscldap_netlogon_flags_closest = -1;
157 static int hf_mscldap_netlogon_flags_writable = -1;
158 static int hf_mscldap_netlogon_flags_good_timeserv = -1;
159 static int hf_mscldap_netlogon_flags_ndnc = -1;
160 static int hf_mscldap_netlogon_flags_fnc = -1;
161 static int hf_mscldap_netlogon_flags_dnc = -1;
162 static int hf_mscldap_netlogon_flags_dns = -1;
163 static int hf_mscldap_netlogon_flags_wdc = -1;
164 static int hf_mscldap_netlogon_flags_rodc = -1;
165 static int hf_mscldap_domain_guid = -1;
166 static int hf_mscldap_forest = -1;
167 static int hf_mscldap_domain = -1;
168 static int hf_mscldap_hostname = -1;
169 static int hf_mscldap_nb_domain = -1;
170 static int hf_mscldap_nb_hostname = -1;
171 static int hf_mscldap_username = -1;
172 static int hf_mscldap_sitename = -1;
173 static int hf_mscldap_clientsitename = -1;
174 static int hf_mscldap_netlogon_version = -1;
175 static int hf_mscldap_netlogon_lm_token = -1;
176 static int hf_mscldap_netlogon_nt_token = -1;
177 static int hf_ldap_sid = -1;
178 static int hf_ldap_AccessMask_ADS_CREATE_CHILD = -1;
179 static int hf_ldap_AccessMask_ADS_DELETE_CHILD = -1;
180 static int hf_ldap_AccessMask_ADS_LIST = -1;
181 static int hf_ldap_AccessMask_ADS_SELF_WRITE = -1;
182 static int hf_ldap_AccessMask_ADS_READ_PROP = -1;
183 static int hf_ldap_AccessMask_ADS_WRITE_PROP = -1;
184 static int hf_ldap_AccessMask_ADS_DELETE_TREE = -1;
185 static int hf_ldap_AccessMask_ADS_LIST_OBJECT = -1;
186 static int hf_ldap_AccessMask_ADS_CONTROL_ACCESS = -1;
189 /*--- Included file: packet-ldap-hf.c ---*/
190 #line 1 "packet-ldap-hf.c"
191 static int hf_ldap_LDAPMessage_PDU = -1; /* LDAPMessage */
192 static int hf_ldap_SearchControlValue_PDU = -1; /* SearchControlValue */
193 static int hf_ldap_SortKeyList_PDU = -1; /* SortKeyList */
194 static int hf_ldap_SortResult_PDU = -1; /* SortResult */
195 static int hf_ldap_ReplControlValue_PDU = -1; /* ReplControlValue */
196 static int hf_ldap_PasswdModifyRequestValue_PDU = -1; /* PasswdModifyRequestValue */
197 static int hf_ldap_CancelRequestValue_PDU = -1; /* CancelRequestValue */
198 static int hf_ldap_messageID = -1; /* MessageID */
199 static int hf_ldap_protocolOp = -1; /* ProtocolOp */
200 static int hf_ldap_controls = -1; /* Controls */
201 static int hf_ldap_bindRequest = -1; /* BindRequest */
202 static int hf_ldap_bindResponse = -1; /* BindResponse */
203 static int hf_ldap_unbindRequest = -1; /* UnbindRequest */
204 static int hf_ldap_searchRequest = -1; /* SearchRequest */
205 static int hf_ldap_searchResEntry = -1; /* SearchResultEntry */
206 static int hf_ldap_searchResDone = -1; /* SearchResultDone */
207 static int hf_ldap_searchResRef = -1; /* SearchResultReference */
208 static int hf_ldap_modifyRequest = -1; /* ModifyRequest */
209 static int hf_ldap_modifyResponse = -1; /* ModifyResponse */
210 static int hf_ldap_addRequest = -1; /* AddRequest */
211 static int hf_ldap_addResponse = -1; /* AddResponse */
212 static int hf_ldap_delRequest = -1; /* DelRequest */
213 static int hf_ldap_delResponse = -1; /* DelResponse */
214 static int hf_ldap_modDNRequest = -1; /* ModifyDNRequest */
215 static int hf_ldap_modDNResponse = -1; /* ModifyDNResponse */
216 static int hf_ldap_compareRequest = -1; /* CompareRequest */
217 static int hf_ldap_compareResponse = -1; /* CompareResponse */
218 static int hf_ldap_abandonRequest = -1; /* AbandonRequest */
219 static int hf_ldap_extendedReq = -1; /* ExtendedRequest */
220 static int hf_ldap_extendedResp = -1; /* ExtendedResponse */
221 static int hf_ldap_AttributeDescriptionList_item = -1; /* AttributeDescription */
222 static int hf_ldap_attributeDesc = -1; /* AttributeDescription */
223 static int hf_ldap_assertionValue = -1; /* AssertionValue */
224 static int hf_ldap_type = -1; /* AttributeDescription */
225 static int hf_ldap_vals = -1; /* SET_OF_AttributeValue */
226 static int hf_ldap_vals_item = -1; /* AttributeValue */
227 static int hf_ldap_resultCode = -1; /* T_resultCode */
228 static int hf_ldap_matchedDN = -1; /* LDAPDN */
229 static int hf_ldap_errorMessage = -1; /* ErrorMessage */
230 static int hf_ldap_referral = -1; /* Referral */
231 static int hf_ldap_Referral_item = -1; /* LDAPURL */
232 static int hf_ldap_Controls_item = -1; /* Control */
233 static int hf_ldap_controlType = -1; /* ControlType */
234 static int hf_ldap_criticality = -1; /* BOOLEAN */
235 static int hf_ldap_controlValue = -1; /* T_controlValue */
236 static int hf_ldap_version = -1; /* INTEGER_1_127 */
237 static int hf_ldap_name = -1; /* LDAPDN */
238 static int hf_ldap_authentication = -1; /* AuthenticationChoice */
239 static int hf_ldap_simple = -1; /* Simple */
240 static int hf_ldap_sasl = -1; /* SaslCredentials */
241 static int hf_ldap_ntlmsspNegotiate = -1; /* T_ntlmsspNegotiate */
242 static int hf_ldap_ntlmsspAuth = -1; /* T_ntlmsspAuth */
243 static int hf_ldap_mechanism = -1; /* Mechanism */
244 static int hf_ldap_credentials = -1; /* Credentials */
245 static int hf_ldap_bindResponse_resultCode = -1; /* BindResponse_resultCode */
246 static int hf_ldap_bindResponse_matchedDN = -1; /* T_bindResponse_matchedDN */
247 static int hf_ldap_serverSaslCreds = -1; /* ServerSaslCreds */
248 static int hf_ldap_baseObject = -1; /* LDAPDN */
249 static int hf_ldap_scope = -1; /* T_scope */
250 static int hf_ldap_derefAliases = -1; /* T_derefAliases */
251 static int hf_ldap_sizeLimit = -1; /* INTEGER_0_maxInt */
252 static int hf_ldap_timeLimit = -1; /* INTEGER_0_maxInt */
253 static int hf_ldap_typesOnly = -1; /* BOOLEAN */
254 static int hf_ldap_filter = -1; /* T_filter */
255 static int hf_ldap_searchRequest_attributes = -1; /* AttributeDescriptionList */
256 static int hf_ldap_and = -1; /* T_and */
257 static int hf_ldap_and_item = -1; /* T_and_item */
258 static int hf_ldap_or = -1; /* T_or */
259 static int hf_ldap_or_item = -1; /* T_or_item */
260 static int hf_ldap_not = -1; /* T_not */
261 static int hf_ldap_equalityMatch = -1; /* T_equalityMatch */
262 static int hf_ldap_substrings = -1; /* SubstringFilter */
263 static int hf_ldap_greaterOrEqual = -1; /* T_greaterOrEqual */
264 static int hf_ldap_lessOrEqual = -1; /* T_lessOrEqual */
265 static int hf_ldap_present = -1; /* T_present */
266 static int hf_ldap_approxMatch = -1; /* T_approxMatch */
267 static int hf_ldap_extensibleMatch = -1; /* T_extensibleMatch */
268 static int hf_ldap_substringFilter_substrings = -1; /* T_substringFilter_substrings */
269 static int hf_ldap_substringFilter_substrings_item = -1; /* T_substringFilter_substrings_item */
270 static int hf_ldap_initial = -1; /* LDAPString */
271 static int hf_ldap_any = -1; /* LDAPString */
272 static int hf_ldap_final = -1; /* LDAPString */
273 static int hf_ldap_matchingRule = -1; /* MatchingRuleId */
274 static int hf_ldap_matchValue = -1; /* AssertionValue */
275 static int hf_ldap_dnAttributes = -1; /* T_dnAttributes */
276 static int hf_ldap_objectName = -1; /* LDAPDN */
277 static int hf_ldap_searchResultEntry_attributes = -1; /* PartialAttributeList */
278 static int hf_ldap_PartialAttributeList_item = -1; /* PartialAttributeList_item */
279 static int hf_ldap__untag_item = -1; /* LDAPURL */
280 static int hf_ldap_object = -1; /* LDAPDN */
281 static int hf_ldap_modifyRequest_modification = -1; /* ModifyRequest_modification */
282 static int hf_ldap_modifyRequest_modification_item = -1; /* T_modifyRequest_modification_item */
283 static int hf_ldap_operation = -1; /* T_operation */
284 static int hf_ldap_modification = -1; /* AttributeTypeAndValues */
285 static int hf_ldap_entry = -1; /* LDAPDN */
286 static int hf_ldap_attributes = -1; /* AttributeList */
287 static int hf_ldap_AttributeList_item = -1; /* AttributeList_item */
288 static int hf_ldap_newrdn = -1; /* RelativeLDAPDN */
289 static int hf_ldap_deleteoldrdn = -1; /* BOOLEAN */
290 static int hf_ldap_newSuperior = -1; /* LDAPDN */
291 static int hf_ldap_ava = -1; /* AttributeValueAssertion */
292 static int hf_ldap_requestName = -1; /* LDAPOID */
293 static int hf_ldap_requestValue = -1; /* T_requestValue */
294 static int hf_ldap_extendedResponse_resultCode = -1; /* ExtendedResponse_resultCode */
295 static int hf_ldap_responseName = -1; /* ResponseName */
296 static int hf_ldap_response = -1; /* OCTET_STRING */
297 static int hf_ldap_size = -1; /* INTEGER */
298 static int hf_ldap_cookie = -1; /* OCTET_STRING */
299 static int hf_ldap_SortKeyList_item = -1; /* SortKeyList_item */
300 static int hf_ldap_attributeType = -1; /* AttributeDescription */
301 static int hf_ldap_orderingRule = -1; /* MatchingRuleId */
302 static int hf_ldap_reverseOrder = -1; /* BOOLEAN */
303 static int hf_ldap_sortResult = -1; /* T_sortResult */
304 static int hf_ldap_parentsFirst = -1; /* INTEGER */
305 static int hf_ldap_maxReturnLength = -1; /* INTEGER */
306 static int hf_ldap_userIdentity = -1; /* OCTET_STRING */
307 static int hf_ldap_oldPasswd = -1; /* OCTET_STRING */
308 static int hf_ldap_newPasswd = -1; /* OCTET_STRING */
309 static int hf_ldap_genPasswd = -1; /* OCTET_STRING */
310 static int hf_ldap_cancelID = -1; /* MessageID */
312 /*--- End of included file: packet-ldap-hf.c ---*/
313 #line 181 "packet-ldap-template.c"
315 /* Initialize the subtree pointers */
316 static gint ett_ldap = -1;
317 static gint ett_ldap_msg = -1;
318 static gint ett_ldap_sasl_blob = -1;
319 static guint ett_ldap_payload = -1;
320 static gint ett_mscldap_netlogon_flags = -1;
321 static gint ett_mscldap_ntver_flags = -1;
322 static gint ett_mscldap_ipdetails = -1;
325 /*--- Included file: packet-ldap-ett.c ---*/
326 #line 1 "packet-ldap-ett.c"
327 static gint ett_ldap_LDAPMessage = -1;
328 static gint ett_ldap_ProtocolOp = -1;
329 static gint ett_ldap_AttributeDescriptionList = -1;
330 static gint ett_ldap_AttributeValueAssertion = -1;
331 static gint ett_ldap_Attribute = -1;
332 static gint ett_ldap_SET_OF_AttributeValue = -1;
333 static gint ett_ldap_LDAPResult = -1;
334 static gint ett_ldap_Referral = -1;
335 static gint ett_ldap_Controls = -1;
336 static gint ett_ldap_Control = -1;
337 static gint ett_ldap_BindRequest_U = -1;
338 static gint ett_ldap_AuthenticationChoice = -1;
339 static gint ett_ldap_SaslCredentials = -1;
340 static gint ett_ldap_BindResponse_U = -1;
341 static gint ett_ldap_SearchRequest_U = -1;
342 static gint ett_ldap_Filter = -1;
343 static gint ett_ldap_T_and = -1;
344 static gint ett_ldap_T_or = -1;
345 static gint ett_ldap_SubstringFilter = -1;
346 static gint ett_ldap_T_substringFilter_substrings = -1;
347 static gint ett_ldap_T_substringFilter_substrings_item = -1;
348 static gint ett_ldap_MatchingRuleAssertion = -1;
349 static gint ett_ldap_SearchResultEntry_U = -1;
350 static gint ett_ldap_PartialAttributeList = -1;
351 static gint ett_ldap_PartialAttributeList_item = -1;
352 static gint ett_ldap_SEQUENCE_OF_LDAPURL = -1;
353 static gint ett_ldap_ModifyRequest_U = -1;
354 static gint ett_ldap_ModifyRequest_modification = -1;
355 static gint ett_ldap_T_modifyRequest_modification_item = -1;
356 static gint ett_ldap_AttributeTypeAndValues = -1;
357 static gint ett_ldap_AddRequest_U = -1;
358 static gint ett_ldap_AttributeList = -1;
359 static gint ett_ldap_AttributeList_item = -1;
360 static gint ett_ldap_ModifyDNRequest_U = -1;
361 static gint ett_ldap_CompareRequest_U = -1;
362 static gint ett_ldap_ExtendedRequest_U = -1;
363 static gint ett_ldap_ExtendedResponse_U = -1;
364 static gint ett_ldap_SearchControlValue = -1;
365 static gint ett_ldap_SortKeyList = -1;
366 static gint ett_ldap_SortKeyList_item = -1;
367 static gint ett_ldap_SortResult = -1;
368 static gint ett_ldap_ReplControlValue = -1;
369 static gint ett_ldap_PasswdModifyRequestValue = -1;
370 static gint ett_ldap_PasswdModifyResponseValue = -1;
371 static gint ett_ldap_CancelRequestValue = -1;
373 /*--- End of included file: packet-ldap-ett.c ---*/
374 #line 192 "packet-ldap-template.c"
376 static dissector_table_t ldap_name_dissector_table=NULL;
377 static const char *object_identifier_id = NULL; /* LDAP OID */
379 static gboolean do_protocolop = FALSE;
380 static gchar *attr_type = NULL;
381 static gboolean is_binary_attr_type = FALSE;
382 static guint32 last_frame_seen = 0;
384 #define TCP_PORT_LDAP 389
385 #define TCP_PORT_LDAPS 636
386 #define UDP_PORT_CLDAP 389
387 #define TCP_PORT_GLOBALCAT_LDAP 3268 /* Windows 2000 Global Catalog */
389 /* desegmentation of LDAP */
390 static gboolean ldap_desegment = TRUE;
391 static guint global_ldap_tcp_port = TCP_PORT_LDAP;
392 static guint global_ldaps_tcp_port = TCP_PORT_LDAPS;
393 static guint tcp_port = 0;
394 static guint ssl_port = 0;
396 static dissector_handle_t gssapi_handle = NULL;
397 static dissector_handle_t gssapi_wrap_handle = NULL;
398 static dissector_handle_t ntlmssp_handle = NULL;
399 static dissector_handle_t spnego_handle = NULL;
400 static dissector_handle_t ssl_handle = NULL;
401 static dissector_handle_t ldap_handle = NULL;
403 void prefs_register_ldap(void); /* forward declaration for use in preferences registration */
406 /* different types of rpc calls ontop of ms cldap */
407 #define MSCLDAP_RPC_NETLOGON 1
409 /* Message type Choice values */
410 static const value_string ldap_ProtocolOp_choice_vals[] = {
411 { 0, "bindRequest" },
412 { 1, "bindResponse" },
413 { 2, "unbindRequest" },
414 { 3, "searchRequest" },
415 { 4, "searchResEntry" },
416 { 5, "searchResDone" },
417 { 6, "searchResRef" },
418 { 7, "modifyRequest" },
419 { 8, "modifyResponse" },
421 { 10, "addResponse" },
422 { 11, "delRequest" },
423 { 12, "delResponse" },
424 { 13, "modDNRequest" },
425 { 14, "modDNResponse" },
426 { 15, "compareRequest" },
427 { 16, "compareResponse" },
428 { 17, "abandonRequest" },
429 { 18, "extendedReq" },
430 { 19, "extendedResp" },
434 * Data structure attached to a conversation, giving authentication
435 * information from a bind request.
436 * We keep a linked list of them, so that we can free up all the
437 * authentication mechanism strings.
439 typedef struct ldap_conv_info_t {
440 struct ldap_conv_info_t *next;
441 guint auth_type; /* authentication type */
442 char *auth_mech; /* authentication mechanism */
443 guint32 first_auth_frame; /* first frame that would use a security layer */
444 GHashTable *unmatched;
448 gboolean start_tls_pending;
449 guint32 start_tls_frame;
451 static ldap_conv_info_t *ldap_info_items;
454 ldap_info_hash_matched(gconstpointer k)
456 const ldap_call_response_t *key = k;
458 return key->messageId;
462 ldap_info_equal_matched(gconstpointer k1, gconstpointer k2)
464 const ldap_call_response_t *key1 = k1;
465 const ldap_call_response_t *key2 = k2;
467 if( key1->req_frame && key2->req_frame && (key1->req_frame!=key2->req_frame) ){
470 /* a response may span multiple frames
471 if( key1->rep_frame && key2->rep_frame && (key1->rep_frame!=key2->rep_frame) ){
476 return key1->messageId==key2->messageId;
480 ldap_info_hash_unmatched(gconstpointer k)
482 const ldap_call_response_t *key = k;
484 return key->messageId;
488 ldap_info_equal_unmatched(gconstpointer k1, gconstpointer k2)
490 const ldap_call_response_t *key1 = k1;
491 const ldap_call_response_t *key2 = k2;
493 return key1->messageId==key2->messageId;
497 /* These are the NtVer flags
498 http://msdn.microsoft.com/en-us/library/cc201035.aspx
501 static const true_false_string tfs_ntver_v1 = {
502 "Client requested V1 netlogon response",
503 "V1 netlogon response not requested"
506 static const true_false_string tfs_ntver_v5 = {
507 "Client requested V5 netlogon response",
508 "V5 netlogon response not requested"
510 static const true_false_string tfs_ntver_v5ex = {
511 "Client requested V5 extended netlogon response",
512 "V5 extended response not requested"
514 static const true_false_string tfs_ntver_v5ip = {
515 "Client has requested IP information of the DC",
516 "IP information not requested"
518 static const true_false_string tfs_ntver_v5cs = {
519 "Client has asked for the closest site information",
520 "Closest site information not requested"
522 static const true_false_string tfs_ntver_nt4 = {
523 "Client has set Neutralize NT4 emulation",
524 "Only full AD DS requested"
526 static const true_false_string tfs_ntver_pdc = {
527 "Client has requested the PDC server",
528 "PDC server not requested"
530 static const true_false_string tfs_ntver_local = {
531 "Client indicated that it is the local machine",
532 "Client is not local"
534 static const true_false_string tfs_ntver_ip = {
535 "Client has requested IP details (obsolete)",
536 "IP details not requested"
537 };static const true_false_string tfs_ntver_gc = {
538 "Client has requested a Global Catalog server",
539 "Global Catalog not requested"
543 static int dissect_mscldap_ntver_flags(proto_tree *parent_tree, tvbuff_t *tvb, int offset)
547 proto_tree *tree=NULL;
549 hf_mscldap_ntver_flags_v1,
550 hf_mscldap_ntver_flags_v5,
551 hf_mscldap_ntver_flags_v5ex,
552 hf_mscldap_ntver_flags_v5ip,
553 hf_mscldap_ntver_flags_v5cs,
554 hf_mscldap_ntver_flags_nt4,
555 hf_mscldap_ntver_flags_pdc,
556 hf_mscldap_ntver_flags_ip,
557 hf_mscldap_ntver_flags_local,
558 hf_mscldap_ntver_flags_gc,
562 header_field_info *hfi;
563 gboolean one_bit_set = FALSE;
565 flags=tvb_get_letohl(tvb, offset);
566 item=proto_tree_add_item(parent_tree, hf_mscldap_ntver_flags, tvb, offset, 4, TRUE);
568 tree = proto_item_add_subtree(item, ett_mscldap_ntver_flags);
571 proto_item_append_text(item, " (");
573 for(field = fields; *field; field++) {
574 proto_tree_add_boolean(tree, *field, tvb, offset, 4, flags);
575 hfi = proto_registrar_get_nth(*field);
577 if(flags & hfi->bitmask) {
580 proto_item_append_text(item, ", ");
584 proto_item_append_text(item, hfi->name);
589 proto_item_append_text(item, ")");
596 /* This string contains the last LDAPString that was decoded */
597 static char *attributedesc_string=NULL;
599 /* This string contains the last AssertionValue that was decoded */
600 static char *ldapvalue_string=NULL;
602 /* if the octet string contain all printable ASCII characters, then
603 * display it as a string, othervise just display it in hex.
606 dissect_ldap_AssertionValue(gboolean implicit_tag, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_, proto_tree *tree, int hf_index)
609 gboolean pc, ind, is_ascii;
615 offset=get_ber_identifier(tvb, offset, &class, &pc, &tag);
616 offset=get_ber_length(tvb, offset, &len, &ind);
618 len=tvb_length_remaining(tvb,offset);
627 * Some special/wellknown attributes in common LDAP (read AD)
628 * are neither ascii strings nor blobs of hex data.
629 * Special case these attributes and decode them more nicely.
631 * Add more special cases as required to prettify further
632 * (there cant be that many ones that are truly interesting)
634 if(attributedesc_string && !strncmp("DomainSid", attributedesc_string, 9)){
638 /* this octet string contains an NT SID */
639 sid_tvb=tvb_new_subset(tvb, offset, len, len);
640 dissect_nt_sid(sid_tvb, 0, tree, "SID", &tmpstr, hf_index);
641 ldapvalue_string=tmpstr;
644 } else if ( (len==16) /* GUIDs are always 16 bytes */
645 && (attributedesc_string && !strncmp("DomainGuid", attributedesc_string, 10))) {
646 guint8 drep[4] = { 0x10, 0x00, 0x00, 0x00}; /* fake DREP struct */
649 /* This octet string contained a GUID */
650 dissect_dcerpc_uuid_t(tvb, offset, actx->pinfo, tree, drep, hf_ldap_guid, &uuid);
652 ldapvalue_string=ep_alloc(1024);
653 g_snprintf(ldapvalue_string, 1023, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
654 uuid.Data1, uuid.Data2, uuid.Data3,
655 uuid.Data4[0], uuid.Data4[1],
656 uuid.Data4[2], uuid.Data4[3],
657 uuid.Data4[4], uuid.Data4[5],
658 uuid.Data4[6], uuid.Data4[7]);
661 } else if (attributedesc_string && !strncmp("NtVer", attributedesc_string, 5)){
665 /* get flag value to populate ldapvalue_string */
666 flags=tvb_get_letohl(tvb, offset);
668 ldapvalue_string=ep_alloc(1024);
669 g_snprintf(ldapvalue_string, 1023, "0x%08x",flags);
671 /* populate bitmask subtree */
672 offset = dissect_mscldap_ntver_flags(tree, tvb, offset);
680 * It was not one of our "wellknown" attributes so make the best
681 * we can and just try to see if it is an ascii string or if it
684 * XXX - should we support reading RFC 2252-style schemas
685 * for LDAP, and using that to determine how to display
686 * attribute values and assertion values?
688 * -- I dont think there are full schemas available that describe the
689 * interesting cases i.e. AD -- ronnie
691 str=tvb_get_ptr(tvb, offset, len);
694 if(!isascii(str[i]) || !isprint(str[i])){
700 /* convert the string into a printable string */
702 ldapvalue_string=ep_alloc(len+1);
703 memcpy(ldapvalue_string,str,len);
704 ldapvalue_string[i]=0;
706 ldapvalue_string=ep_alloc(3*len);
708 g_snprintf(ldapvalue_string+i*3,3,"%02x",str[i]&0xff);
709 ldapvalue_string[3*i+2]=':';
711 ldapvalue_string[3*len-1]=0;
714 proto_tree_add_string(tree, hf_index, tvb, offset, len, ldapvalue_string);
722 /* This string contains the last Filter item that was decoded */
723 static char *Filter_string=NULL;
724 static char *and_filter_string=NULL;
725 static char *or_filter_string=NULL;
726 static char *substring_value=NULL;
727 static char *substring_item_init=NULL;
728 static char *substring_item_any=NULL;
729 static char *substring_item_final=NULL;
730 static char *matching_rule_string=NULL;
731 static gboolean matching_rule_dnattr=FALSE;
733 /* Global variables */
734 char *mechanism = NULL;
735 static gint MessageID =-1;
736 static gint ProtocolOp = -1;
737 static gint result = 0;
738 static proto_item *ldm_tree = NULL; /* item to add text to */
740 static void ldap_do_protocolop(packet_info *pinfo)
746 valstr = val_to_str(ProtocolOp, ldap_ProtocolOp_choice_vals, "Unknown (%%u)");
748 if(check_col(pinfo->cinfo, COL_INFO))
749 col_append_fstr(pinfo->cinfo, COL_INFO, "%s(%u) ", valstr, MessageID);
752 proto_item_append_text(ldm_tree, " %s(%d)", valstr, MessageID);
754 do_protocolop = FALSE;
759 static ldap_call_response_t *
760 ldap_match_call_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint messageId, guint protocolOpTag)
762 ldap_call_response_t lcr, *lcrp=NULL;
763 ldap_conv_info_t *ldap_info = (ldap_conv_info_t *)pinfo->private_data;
765 /* first see if we have already matched this */
767 lcr.messageId=messageId;
768 switch(protocolOpTag){
770 case LDAP_REQ_SEARCH:
771 case LDAP_REQ_MODIFY:
773 case LDAP_REQ_DELETE:
774 case LDAP_REQ_MODRDN:
775 case LDAP_REQ_COMPARE:
776 case LDAP_REQ_EXTENDED:
778 lcr.req_frame=pinfo->fd->num;
782 case LDAP_RES_SEARCH_ENTRY:
783 case LDAP_RES_SEARCH_REF:
784 case LDAP_RES_SEARCH_RESULT:
785 case LDAP_RES_MODIFY:
787 case LDAP_RES_DELETE:
788 case LDAP_RES_MODRDN:
789 case LDAP_RES_COMPARE:
790 case LDAP_RES_EXTENDED:
791 lcr.is_request=FALSE;
793 lcr.rep_frame=pinfo->fd->num;
796 lcrp=g_hash_table_lookup(ldap_info->matched, &lcr);
800 lcrp->is_request=lcr.is_request;
804 /* we haven't found a match - try and match it up */
806 switch(protocolOpTag){
808 case LDAP_REQ_SEARCH:
809 case LDAP_REQ_MODIFY:
811 case LDAP_REQ_DELETE:
812 case LDAP_REQ_MODRDN:
813 case LDAP_REQ_COMPARE:
814 case LDAP_REQ_EXTENDED:
816 /* this a a request - add it to the unmatched list */
818 /* check that we dont already have one of those in the
819 unmatched list and if so remove it */
821 lcr.messageId=messageId;
822 lcrp=g_hash_table_lookup(ldap_info->unmatched, &lcr);
824 g_hash_table_remove(ldap_info->unmatched, lcrp);
826 /* if we cant reuse the old one, grab a new chunk */
828 lcrp=se_alloc(sizeof(ldap_call_response_t));
830 lcrp->messageId=messageId;
831 lcrp->req_frame=pinfo->fd->num;
832 lcrp->req_time=pinfo->fd->abs_ts;
834 lcrp->protocolOpTag=protocolOpTag;
835 lcrp->is_request=TRUE;
836 g_hash_table_insert(ldap_info->unmatched, lcrp, lcrp);
840 case LDAP_RES_SEARCH_ENTRY:
841 case LDAP_RES_SEARCH_REF:
842 case LDAP_RES_SEARCH_RESULT:
843 case LDAP_RES_MODIFY:
845 case LDAP_RES_DELETE:
846 case LDAP_RES_MODRDN:
847 case LDAP_RES_COMPARE:
848 case LDAP_RES_EXTENDED:
850 /* this is a result - it should be in our unmatched list */
852 lcr.messageId=messageId;
853 lcrp=g_hash_table_lookup(ldap_info->unmatched, &lcr);
857 if(!lcrp->rep_frame){
858 g_hash_table_remove(ldap_info->unmatched, lcrp);
859 lcrp->rep_frame=pinfo->fd->num;
860 lcrp->is_request=FALSE;
861 g_hash_table_insert(ldap_info->matched, lcrp, lcrp);
869 /* we have found a match */
874 if(lcrp->is_request){
875 it=proto_tree_add_uint(tree, hf_ldap_response_in, tvb, 0, 0, lcrp->rep_frame);
876 PROTO_ITEM_SET_GENERATED(it);
879 it=proto_tree_add_uint(tree, hf_ldap_response_to, tvb, 0, 0, lcrp->req_frame);
880 PROTO_ITEM_SET_GENERATED(it);
881 nstime_delta(&ns, &pinfo->fd->abs_ts, &lcrp->req_time);
882 it=proto_tree_add_time(tree, hf_ldap_time, tvb, 0, 0, &ns);
883 PROTO_ITEM_SET_GENERATED(it);
891 /*--- Included file: packet-ldap-fn.c ---*/
892 #line 1 "packet-ldap-fn.c"
893 /*--- Cyclic dependencies ---*/
895 /* Filter -> Filter/and -> Filter/and/_item -> Filter */
896 /* Filter -> Filter/or -> Filter/or/_item -> Filter */
897 /* Filter -> Filter/not -> Filter */
898 static int dissect_ldap_Filter(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
904 dissect_ldap_MessageID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
907 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
921 dissect_ldap_INTEGER_1_127(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
922 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
931 dissect_ldap_LDAPString(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
933 tvbuff_t *parameter_tvb = NULL;
934 char *ldapstring = NULL;
935 gchar *sc = NULL; /* semi-colon pointer */
937 offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
941 if (parameter_tvb || (hf_index == hf_ldap_baseObject)) {
943 ldap_do_protocolop(actx->pinfo);
946 ldapstring = tvb_get_ephemeral_string(parameter_tvb, 0, tvb_length_remaining(parameter_tvb, 0));
948 if(hf_index == hf_ldap_baseObject) {
949 /* this is search - put it on the scanline */
950 if(!ldapstring || !*ldapstring)
951 ldapstring = "<ROOT>";
953 if(check_col(actx->pinfo->cinfo, COL_INFO))
954 col_append_fstr(actx->pinfo->cinfo, COL_INFO, "\"%s\" ", ldapstring);
957 proto_item_append_text(ldm_tree, " \"%s\"", ldapstring);
962 proto_item_append_text(actx->created_item, " (%s)", ldapstring);
965 } else if ((hf_index == hf_ldap_errorMessage) && ldapstring && *ldapstring) { /* only show message if not success */
966 if(check_col(actx->pinfo->cinfo, COL_INFO))
967 col_append_fstr(actx->pinfo->cinfo, COL_INFO, "(%s) ", ldapstring);
970 proto_item_append_text(ldm_tree, " (%s)", ldapstring);
972 } else if ((hf_index == hf_ldap_objectName) ||
973 (hf_index == hf_ldap_name) ||
974 (hf_index == hf_ldap_entry) ||
975 (hf_index == hf_ldap_object) ||
976 (hf_index == hf_ldap_delRequest) ) {
978 if(!ldapstring || !*ldapstring)
979 ldapstring = "<ROOT>";
981 if(check_col(actx->pinfo->cinfo, COL_INFO))
982 col_append_fstr(actx->pinfo->cinfo, COL_INFO, "\"%s\" ", ldapstring);
985 proto_item_append_text(ldm_tree, " \"%s\"", ldapstring);
986 } else if (hf_index == hf_ldap_attributeDesc){
987 /* remember the attribute description */
988 attributedesc_string=ldapstring;
989 } else if (hf_index == hf_ldap_initial){
990 /* remember the substring item */
991 substring_item_init=ldapstring;
992 } else if (hf_index == hf_ldap_any){
993 /* remember the substring item */
994 substring_item_any=ldapstring;
995 } else if (hf_index == hf_ldap_final){
996 /* remember the substring item */
997 substring_item_final=ldapstring;
998 } else if (hf_index == hf_ldap_matchingRule){
999 /* remember the matching rule */
1000 matching_rule_string=ldapstring;
1001 } else if (hf_index == hf_ldap_present){
1002 /* remember the present name */
1003 Filter_string=ldapstring;
1004 } else if (hf_index == hf_ldap_type) {
1005 /* remember attribute type name */
1006 attr_type = ep_strdup(ldapstring);
1008 /* append it to the parent entry */
1009 proto_item_append_text(tree, " %s", attr_type);
1011 /* remove the ";binary" component if present */
1012 if((sc = strchr(attr_type, ';')) != NULL) {
1013 if(!strcmp(sc, ";binary")) {
1014 *sc = '\0'; /* terminate the string */
1015 is_binary_attr_type = TRUE;
1018 is_binary_attr_type = FALSE;
1033 dissect_ldap_LDAPDN(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1034 offset = dissect_ldap_LDAPString(implicit_tag, tvb, offset, actx, tree, hf_index);
1042 dissect_ldap_Simple(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1043 #line 163 "ldap.cnf"
1044 ldap_conv_info_t *ldap_info;
1046 offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
1050 ldap_info = actx->pinfo->private_data;
1051 ldap_info->auth_type = LDAP_AUTH_SIMPLE;
1053 actx->pinfo->private_data = ldap_info;
1063 dissect_ldap_Mechanism(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1064 #line 173 "ldap.cnf"
1066 ldap_conv_info_t *ldap_info;
1067 tvbuff_t *parameter_tvb;
1068 char *mechanism = NULL;
1069 offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
1072 ldap_info = actx->pinfo->private_data;
1073 ldap_info->auth_type = LDAP_AUTH_SASL;
1079 * We need to remember the authentication type and mechanism for this
1082 * XXX - actually, we might need to remember more than one
1083 * type and mechanism, if you can unbind and rebind with a
1084 * different type and/or mechanism.
1086 if(!actx->pinfo->fd->flags.visited) {
1087 mechanism = tvb_get_string(parameter_tvb, 0, tvb_length_remaining(parameter_tvb,0));
1088 ldap_info->first_auth_frame = 0; /* not known until we see the bind reply */
1090 * If the mechanism in this request is an empty string (which is
1091 * returned as a null pointer), use the saved mechanism instead.
1092 * Otherwise, if the saved mechanism is an empty string (null),
1093 * save this mechanism.
1095 if (mechanism == NULL) {
1096 mechanism = ldap_info->auth_mech;
1098 if (ldap_info->auth_mech != NULL) {
1099 g_free(ldap_info->auth_mech);
1101 ldap_info->auth_mech = mechanism;
1103 actx->pinfo->private_data = ldap_info;
1113 dissect_ldap_Credentials(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1114 #line 212 "ldap.cnf"
1116 tvbuff_t *parameter_tvb;
1117 ldap_conv_info_t *ldap_info;
1122 offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
1129 ldap_info = actx->pinfo->private_data;
1130 get_ber_identifier(parameter_tvb, 0, &class, &pc, &tag);
1132 /*if ((ldap_info->auth_mech != NULL) && (strcmp(ldap_info->auth_mech, "GSS-SPNEGO") == 0) && (class==BER_CLASS_CON)) {*/
1133 if ((ldap_info->auth_mech != NULL) && (class==BER_CLASS_CON)) {
1135 * This is a GSS-API token ancapsulated within GSS-SPNEGO.
1136 * We need to check the first byte to check whether the blob
1137 * contains SPNEGO or GSSAPI.
1138 * All SPNEGO PDUs are of class CONSTRUCTED while
1139 * GSS PDUs are class APPLICATION
1141 if (parameter_tvb && (tvb_length(parameter_tvb) > 0))
1142 call_dissector(spnego_handle, parameter_tvb, actx->pinfo, tree);
1144 /*if ((ldap_info->auth_mech != NULL) && ((strcmp(ldap_info->auth_mech, "GSSAPI") == 0) || (class==BER_CLASS_APP))) {*/
1145 if ((ldap_info->auth_mech != NULL) && (class==BER_CLASS_APP)) {
1147 * This is a raw GSS-API token.
1149 if (parameter_tvb && (tvb_length(parameter_tvb) > 0)) {
1150 call_dissector(gssapi_handle, parameter_tvb, actx->pinfo, tree);
1153 actx->pinfo->private_data = ldap_info;
1162 static const ber_sequence_t SaslCredentials_sequence[] = {
1163 { &hf_ldap_mechanism , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_Mechanism },
1164 { &hf_ldap_credentials , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ldap_Credentials },
1165 { NULL, 0, 0, 0, NULL }
1169 dissect_ldap_SaslCredentials(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1170 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
1171 SaslCredentials_sequence, hf_index, ett_ldap_SaslCredentials);
1179 dissect_ldap_T_ntlmsspNegotiate(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1180 #line 697 "ldap.cnf"
1181 /* make sure the protocol op comes first */
1182 ldap_do_protocolop(actx->pinfo);
1184 call_dissector(ntlmssp_handle, tvb, actx->pinfo, tree);
1185 offset+=tvb_length_remaining(tvb, offset);
1195 dissect_ldap_T_ntlmsspAuth(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1196 #line 704 "ldap.cnf"
1197 /* make sure the protocol op comes first */
1198 ldap_do_protocolop(actx->pinfo);
1200 call_dissector(ntlmssp_handle, tvb, actx->pinfo, tree);
1201 offset+=tvb_length_remaining(tvb, offset);
1209 static const value_string ldap_AuthenticationChoice_vals[] = {
1212 { 10, "ntlmsspNegotiate" },
1213 { 11, "ntlmsspAuth" },
1217 static const ber_choice_t AuthenticationChoice_choice[] = {
1218 { 0, &hf_ldap_simple , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_ldap_Simple },
1219 { 3, &hf_ldap_sasl , BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_ldap_SaslCredentials },
1220 { 10, &hf_ldap_ntlmsspNegotiate, BER_CLASS_CON, 10, BER_FLAGS_IMPLTAG, dissect_ldap_T_ntlmsspNegotiate },
1221 { 11, &hf_ldap_ntlmsspAuth , BER_CLASS_CON, 11, BER_FLAGS_IMPLTAG, dissect_ldap_T_ntlmsspAuth },
1222 { 0, NULL, 0, 0, 0, NULL }
1226 dissect_ldap_AuthenticationChoice(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1227 #line 497 "ldap.cnf"
1230 const gchar *valstr;
1232 offset = dissect_ber_choice(actx, tree, tvb, offset,
1233 AuthenticationChoice_choice, hf_index, ett_ldap_AuthenticationChoice,
1237 ldap_do_protocolop(actx->pinfo);
1239 if((branch > -1) && (branch < (gint)(sizeof AuthenticationChoice_choice/sizeof AuthenticationChoice_choice[0])))
1240 auth = AuthenticationChoice_choice[branch].value;
1242 valstr = val_to_str(auth, ldap_AuthenticationChoice_vals, "Unknown auth(%u)");
1244 /* If auth is NTLM (10 or 11) don't add to column as the NTLM dissection will do this */
1245 if (check_col(actx->pinfo->cinfo, COL_INFO) && (auth != 10) && (auth != 11))
1246 col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%s ", valstr);
1249 proto_item_append_text(ldm_tree, " %s", valstr);
1258 static const ber_sequence_t BindRequest_U_sequence[] = {
1259 { &hf_ldap_version , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_ldap_INTEGER_1_127 },
1260 { &hf_ldap_name , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_LDAPDN },
1261 { &hf_ldap_authentication , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_ldap_AuthenticationChoice },
1262 { NULL, 0, 0, 0, NULL }
1266 dissect_ldap_BindRequest_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1267 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
1268 BindRequest_U_sequence, hf_index, ett_ldap_BindRequest_U);
1276 dissect_ldap_BindRequest(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1277 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
1278 hf_index, BER_CLASS_APP, 0, TRUE, dissect_ldap_BindRequest_U);
1284 static const value_string ldap_BindResponse_resultCode_vals[] = {
1286 { 1, "operationsError" },
1287 { 2, "protocolError" },
1288 { 3, "timeLimitExceeded" },
1289 { 4, "sizeLimitExceeded" },
1290 { 5, "compareFalse" },
1291 { 6, "compareTrue" },
1292 { 7, "authMethodNotSupported" },
1293 { 8, "strongAuthRequired" },
1295 { 11, "adminLimitExceeded" },
1296 { 12, "unavailableCriticalExtension" },
1297 { 13, "confidentialityRequired" },
1298 { 14, "saslBindInProgress" },
1299 { 16, "noSuchAttribute" },
1300 { 17, "undefinedAttributeType" },
1301 { 18, "inappropriateMatching" },
1302 { 19, "constraintViolation" },
1303 { 20, "attributeOrValueExists" },
1304 { 21, "invalidAttributeSyntax" },
1305 { 32, "noSuchObject" },
1306 { 33, "aliasProblem" },
1307 { 34, "invalidDNSyntax" },
1308 { 36, "aliasDereferencingProblem" },
1309 { 48, "inappropriateAuthentication" },
1310 { 49, "invalidCredentials" },
1311 { 50, "insufficientAccessRights" },
1313 { 52, "unavailable" },
1314 { 53, "unwillingToPerform" },
1315 { 54, "loopDetect" },
1316 { 64, "namingViolation" },
1317 { 65, "objectClassViolation" },
1318 { 66, "notAllowedOnNonLeaf" },
1319 { 67, "notAllowedOnRDN" },
1320 { 68, "entryAlreadyExists" },
1321 { 69, "objectClassModsProhibited" },
1322 { 71, "affectsMultipleDSAs" },
1324 { 118, "canceled" },
1325 { 119, "noSuchOperation" },
1327 { 121, "cannotCancel" },
1333 dissect_ldap_BindResponse_resultCode(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1334 #line 447 "ldap.cnf"
1336 const gchar *valstr;
1338 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
1342 ldap_do_protocolop(actx->pinfo);
1344 valstr = val_to_str(result, ldap_BindResponse_resultCode_vals, "Unknown result(%u)");
1346 if (check_col(actx->pinfo->cinfo, COL_INFO))
1347 col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%s ", valstr);
1350 proto_item_append_text(ldm_tree, " %s", valstr);
1361 dissect_ldap_T_bindResponse_matchedDN(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1362 #line 711 "ldap.cnf"
1363 tvbuff_t *new_tvb=NULL;
1365 offset = dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_ldap_matchedDN, &new_tvb);
1368 && (tvb_length(new_tvb)>=7)
1369 && (!tvb_memeql(new_tvb, 0, "NTLMSSP", 7))){
1371 /* make sure the protocol op comes first */
1372 ldap_do_protocolop(actx->pinfo);
1374 call_dissector(ntlmssp_handle, new_tvb, actx->pinfo, tree);
1386 dissect_ldap_ErrorMessage(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1387 offset = dissect_ldap_LDAPString(implicit_tag, tvb, offset, actx, tree, hf_index);
1395 dissect_ldap_LDAPURL(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1396 offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
1400 PROTO_ITEM_SET_URL(actx->created_item);
1407 static const ber_sequence_t Referral_sequence_of[1] = {
1408 { &hf_ldap_Referral_item , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_LDAPURL },
1412 dissect_ldap_Referral(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1413 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
1414 Referral_sequence_of, hf_index, ett_ldap_Referral);
1422 dissect_ldap_ServerSaslCreds(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1423 #line 252 "ldap.cnf"
1425 tvbuff_t *parameter_tvb;
1426 ldap_conv_info_t *ldap_info;
1428 offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
1433 ldap_info = actx->pinfo->private_data;
1434 switch (ldap_info->auth_type) {
1436 /* For Kerberos V4, dissect it as a ticket. */
1437 /* XXX - what about LDAP_AUTH_SIMPLE? */
1439 case LDAP_AUTH_SASL:
1441 * All frames after this are assumed to use a security layer.
1443 * XXX - won't work if there's another reply, with the security
1444 * layer, starting in the same TCP segment that ends this
1445 * reply, but as LDAP is a request/response protocol, and
1446 * as the client probably can't start using authentication until
1447 * it gets the bind reply and the server won't send a reply until
1448 * it gets a request, that probably won't happen.
1450 * XXX - that assumption is invalid; it's not clear where the
1451 * hell you find out whether there's any security layer. In
1452 * one capture, we have two GSS-SPNEGO negotiations, both of
1453 * which select MS KRB5, and the only differences in the tokens
1454 * is in the RC4-HMAC ciphertext. The various
1455 * draft-ietf--cat-sasl-gssapi-NN.txt drafts seem to imply
1456 * that the RFC 2222 spoo with the bitmask and maximum
1457 * output message size stuff is done - but where does that
1458 * stuff show up? Is it in the ciphertext, which means it's
1459 * presumably encrypted?
1461 * Grrr. We have to do a gross heuristic, checking whether the
1462 * putative LDAP message begins with 0x00 or not, making the
1463 * assumption that we won't have more than 2^24 bytes of
1464 * encapsulated stuff.
1466 ldap_info->first_auth_frame = actx->pinfo->fd->num + 1;
1467 if (ldap_info->auth_mech != NULL &&
1468 strcmp(ldap_info->auth_mech, "GSS-SPNEGO") == 0) {
1469 /* It could be the second leg of GSS-SPNEGO wrapping NTLMSSP
1470 * which might not be wrapped in GSS-SPNEGO but be a raw
1473 if ( (tvb_length(parameter_tvb)>=7)
1474 && (!tvb_memeql(parameter_tvb, 0, "NTLMSSP", 7))){
1475 call_dissector(ntlmssp_handle, parameter_tvb, actx->pinfo, tree);
1479 * This is a GSS-API token.
1481 if(parameter_tvb && (tvb_length(parameter_tvb) > 0))
1482 call_dissector(spnego_handle, parameter_tvb, actx->pinfo, tree);
1483 } else if (ldap_info->auth_mech != NULL &&
1484 strcmp(ldap_info->auth_mech, "GSSAPI") == 0) {
1486 * This is a GSS-API token.
1488 if(parameter_tvb && (tvb_length(parameter_tvb) > 0))
1489 call_dissector(gssapi_handle, parameter_tvb, actx->pinfo, tree);
1493 actx->pinfo->private_data = ldap_info;
1501 static const ber_sequence_t BindResponse_U_sequence[] = {
1502 { &hf_ldap_bindResponse_resultCode, BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_ldap_BindResponse_resultCode },
1503 { &hf_ldap_bindResponse_matchedDN, BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_T_bindResponse_matchedDN },
1504 { &hf_ldap_errorMessage , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_ErrorMessage },
1505 { &hf_ldap_referral , BER_CLASS_CON, 3, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_Referral },
1506 { &hf_ldap_serverSaslCreds, BER_CLASS_CON, 7, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_ServerSaslCreds },
1507 { NULL, 0, 0, 0, NULL }
1511 dissect_ldap_BindResponse_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1512 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
1513 BindResponse_U_sequence, hf_index, ett_ldap_BindResponse_U);
1521 dissect_ldap_BindResponse(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1522 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
1523 hf_index, BER_CLASS_APP, 1, TRUE, dissect_ldap_BindResponse_U);
1531 dissect_ldap_NULL(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1532 offset = dissect_ber_null(implicit_tag, actx, tree, tvb, offset, hf_index);
1540 dissect_ldap_UnbindRequest(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1541 #line 519 "ldap.cnf"
1543 implicit_tag = TRUE; /* correct problem with asn2wrs */
1545 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
1546 hf_index, BER_CLASS_APP, 2, TRUE, dissect_ldap_NULL);
1549 ldap_do_protocolop(actx->pinfo);
1561 static const value_string ldap_T_scope_vals[] = {
1562 { 0, "baseObject" },
1563 { 1, "singleLevel" },
1564 { 2, "wholeSubtree" },
1570 dissect_ldap_T_scope(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1571 #line 413 "ldap.cnf"
1574 const gchar *valstr;
1576 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
1580 ldap_do_protocolop(actx->pinfo);
1582 valstr = val_to_str(scope, ldap_T_scope_vals, "Unknown scope(%u)");
1584 if (check_col(actx->pinfo->cinfo, COL_INFO))
1585 col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%s ", valstr);
1588 proto_item_append_text(ldm_tree, " %s", valstr);
1596 static const value_string ldap_T_derefAliases_vals[] = {
1597 { 0, "neverDerefAliases" },
1598 { 1, "derefInSearching" },
1599 { 2, "derefFindingBaseObj" },
1600 { 3, "derefAlways" },
1606 dissect_ldap_T_derefAliases(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1607 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
1616 dissect_ldap_INTEGER_0_maxInt(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1617 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
1626 dissect_ldap_BOOLEAN(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1627 offset = dissect_ber_boolean(implicit_tag, actx, tree, tvb, offset, hf_index, NULL);
1635 dissect_ldap_T_and_item(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1636 offset = dissect_ldap_Filter(implicit_tag, tvb, offset, actx, tree, hf_index);
1638 #line 569 "ldap.cnf"
1639 if(and_filter_string){
1640 and_filter_string=ep_strdup_printf("(&%s%s)",and_filter_string,Filter_string);
1642 and_filter_string=Filter_string;
1650 static const ber_sequence_t T_and_set_of[1] = {
1651 { &hf_ldap_and_item , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_ldap_T_and_item },
1655 dissect_ldap_T_and(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1656 #line 576 "ldap.cnf"
1657 proto_tree *tr=NULL;
1658 proto_item *it=NULL;
1659 char *old_and_filter_string=and_filter_string;
1661 and_filter_string=NULL;
1663 it=proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), "and: ");
1664 tr=proto_item_add_subtree(it, ett_ldap_T_and);
1668 offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset,
1669 T_and_set_of, hf_index, ett_ldap_T_and);
1672 if(and_filter_string) {
1673 proto_item_append_text(it, "%s", and_filter_string);
1674 Filter_string=ep_strdup_printf("%s",and_filter_string);
1676 and_filter_string=old_and_filter_string;
1686 dissect_ldap_T_or_item(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1687 offset = dissect_ldap_Filter(implicit_tag, tvb, offset, actx, tree, hf_index);
1689 #line 596 "ldap.cnf"
1690 if(or_filter_string){
1691 or_filter_string=ep_strdup_printf("(|%s%s)",or_filter_string,Filter_string);
1693 or_filter_string=Filter_string;
1702 static const ber_sequence_t T_or_set_of[1] = {
1703 { &hf_ldap_or_item , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_ldap_T_or_item },
1707 dissect_ldap_T_or(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1708 #line 604 "ldap.cnf"
1709 proto_tree *tr=NULL;
1710 proto_item *it=NULL;
1711 char *old_or_filter_string=or_filter_string;
1713 or_filter_string=NULL;
1715 it=proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), "or: ");
1716 tr=proto_item_add_subtree(it, ett_ldap_T_or);
1719 offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset,
1720 T_or_set_of, hf_index, ett_ldap_T_or);
1722 if(or_filter_string) {
1723 proto_item_append_text(it, "%s", or_filter_string);
1724 Filter_string=ep_strdup_printf("%s",or_filter_string);
1726 or_filter_string=old_or_filter_string;
1736 dissect_ldap_T_not(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1737 offset = dissect_ldap_Filter(implicit_tag, tvb, offset, actx, tree, hf_index);
1739 #line 625 "ldap.cnf"
1740 Filter_string=ep_strdup_printf("(!%s)",Filter_string);
1749 dissect_ldap_AttributeDescription(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1750 offset = dissect_ldap_LDAPString(implicit_tag, tvb, offset, actx, tree, hf_index);
1757 static const ber_sequence_t AttributeValueAssertion_sequence[] = {
1758 { &hf_ldap_attributeDesc , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_AttributeDescription },
1759 { &hf_ldap_assertionValue , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_AssertionValue },
1760 { NULL, 0, 0, 0, NULL }
1764 dissect_ldap_AttributeValueAssertion(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1765 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
1766 AttributeValueAssertion_sequence, hf_index, ett_ldap_AttributeValueAssertion);
1774 dissect_ldap_T_equalityMatch(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1775 offset = dissect_ldap_AttributeValueAssertion(implicit_tag, tvb, offset, actx, tree, hf_index);
1777 #line 538 "ldap.cnf"
1778 Filter_string=ep_strdup_printf("(%s=%s)",
1779 attributedesc_string ?
1780 attributedesc_string : "(null)",
1782 ldapvalue_string : "(null)");
1790 static const value_string ldap_T_substringFilter_substrings_item_vals[] = {
1797 static const ber_choice_t T_substringFilter_substrings_item_choice[] = {
1798 { 0, &hf_ldap_initial , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_ldap_LDAPString },
1799 { 1, &hf_ldap_any , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_ldap_LDAPString },
1800 { 2, &hf_ldap_final , BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_ldap_LDAPString },
1801 { 0, NULL, 0, 0, 0, NULL }
1805 dissect_ldap_T_substringFilter_substrings_item(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1806 offset = dissect_ber_choice(actx, tree, tvb, offset,
1807 T_substringFilter_substrings_item_choice, hf_index, ett_ldap_T_substringFilter_substrings_item,
1810 #line 651 "ldap.cnf"
1811 if (substring_item_final) {
1812 substring_value=ep_strdup_printf("%s%s",
1813 (substring_value?substring_value:"*"),
1814 substring_item_final);
1815 } else if (substring_item_any) {
1816 substring_value=ep_strdup_printf("%s%s*",
1817 (substring_value?substring_value:"*"),
1818 substring_item_any);
1819 } else if (substring_item_init) {
1820 substring_value=ep_strdup_printf("%s*",
1821 substring_item_init);
1829 static const ber_sequence_t T_substringFilter_substrings_sequence_of[1] = {
1830 { &hf_ldap_substringFilter_substrings_item, BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_ldap_T_substringFilter_substrings_item },
1834 dissect_ldap_T_substringFilter_substrings(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1835 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
1836 T_substringFilter_substrings_sequence_of, hf_index, ett_ldap_T_substringFilter_substrings);
1842 static const ber_sequence_t SubstringFilter_sequence[] = {
1843 { &hf_ldap_type , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_AttributeDescription },
1844 { &hf_ldap_substringFilter_substrings, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ldap_T_substringFilter_substrings },
1845 { NULL, 0, 0, 0, NULL }
1849 dissect_ldap_SubstringFilter(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1850 #line 665 "ldap.cnf"
1851 proto_tree *tr=NULL;
1852 proto_item *it=NULL;
1853 char *old_substring_value=substring_value;
1855 substring_value=NULL;
1856 substring_item_init=NULL;
1857 substring_item_any=NULL;
1858 substring_item_final=NULL;
1860 it=proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), "substring: ");
1861 tr=proto_item_add_subtree(it, ett_ldap_SubstringFilter);
1864 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
1865 SubstringFilter_sequence, hf_index, ett_ldap_SubstringFilter);
1867 Filter_string=ep_strdup_printf("(%s=%s)",attr_type,substring_value);
1868 proto_item_append_text(it, "%s", Filter_string);
1869 substring_value=old_substring_value;
1879 dissect_ldap_T_greaterOrEqual(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1880 offset = dissect_ldap_AttributeValueAssertion(implicit_tag, tvb, offset, actx, tree, hf_index);
1882 #line 546 "ldap.cnf"
1883 Filter_string=ep_strdup_printf("(%s>=%s)",
1884 attributedesc_string ?
1885 attributedesc_string : "(null)",
1887 ldapvalue_string : "(null)");
1897 dissect_ldap_T_lessOrEqual(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1898 offset = dissect_ldap_AttributeValueAssertion(implicit_tag, tvb, offset, actx, tree, hf_index);
1900 #line 554 "ldap.cnf"
1901 Filter_string=ep_strdup_printf("(%s<=%s)",
1902 attributedesc_string ?
1903 attributedesc_string : "(null)",
1905 ldapvalue_string : "(null)");
1915 dissect_ldap_T_present(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1916 offset = dissect_ldap_AttributeDescription(implicit_tag, tvb, offset, actx, tree, hf_index);
1918 #line 622 "ldap.cnf"
1919 Filter_string=ep_strdup_printf("(%s=*)",Filter_string);
1928 dissect_ldap_T_approxMatch(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1929 offset = dissect_ldap_AttributeValueAssertion(implicit_tag, tvb, offset, actx, tree, hf_index);
1931 #line 562 "ldap.cnf"
1932 Filter_string=ep_strdup_printf("(%s~=%s)",
1933 attributedesc_string ?
1934 attributedesc_string : "(null)",
1936 ldapvalue_string : "(null)");
1945 dissect_ldap_MatchingRuleId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1946 offset = dissect_ldap_LDAPString(implicit_tag, tvb, offset, actx, tree, hf_index);
1954 dissect_ldap_T_dnAttributes(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1955 #line 628 "ldap.cnf"
1958 offset = dissect_ber_boolean(implicit_tag, actx, tree, tvb, offset, hf_index, &val);
1961 matching_rule_dnattr = val;
1970 static const ber_sequence_t MatchingRuleAssertion_sequence[] = {
1971 { &hf_ldap_matchingRule , BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_MatchingRuleId },
1972 { &hf_ldap_type , BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_AttributeDescription },
1973 { &hf_ldap_matchValue , BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_ldap_AssertionValue },
1974 { &hf_ldap_dnAttributes , BER_CLASS_CON, 4, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_T_dnAttributes },
1975 { NULL, 0, 0, 0, NULL }
1979 dissect_ldap_MatchingRuleAssertion(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1980 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
1981 MatchingRuleAssertion_sequence, hf_index, ett_ldap_MatchingRuleAssertion);
1989 dissect_ldap_T_extensibleMatch(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
1990 #line 637 "ldap.cnf"
1992 matching_rule_string=NULL;
1993 ldapvalue_string=NULL;
1994 matching_rule_dnattr=FALSE;
1997 offset = dissect_ldap_MatchingRuleAssertion(implicit_tag, tvb, offset, actx, tree, hf_index);
1999 #line 643 "ldap.cnf"
2000 Filter_string=ep_strdup_printf("(%s:%s%s%s=%s)",
2001 (attr_type?attr_type:""),
2002 (matching_rule_dnattr?"dn:":""),
2003 (matching_rule_string?matching_rule_string:""),
2004 (matching_rule_string?":":""),
2012 static const value_string ldap_Filter_vals[] = {
2016 { 3, "equalityMatch" },
2017 { 4, "substrings" },
2018 { 5, "greaterOrEqual" },
2019 { 6, "lessOrEqual" },
2021 { 8, "approxMatch" },
2022 { 9, "extensibleMatch" },
2026 static const ber_choice_t Filter_choice[] = {
2027 { 0, &hf_ldap_and , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_ldap_T_and },
2028 { 1, &hf_ldap_or , BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_ldap_T_or },
2029 { 2, &hf_ldap_not , BER_CLASS_CON, 2, BER_FLAGS_IMPLTAG, dissect_ldap_T_not },
2030 { 3, &hf_ldap_equalityMatch , BER_CLASS_CON, 3, BER_FLAGS_IMPLTAG, dissect_ldap_T_equalityMatch },
2031 { 4, &hf_ldap_substrings , BER_CLASS_CON, 4, BER_FLAGS_IMPLTAG, dissect_ldap_SubstringFilter },
2032 { 5, &hf_ldap_greaterOrEqual , BER_CLASS_CON, 5, BER_FLAGS_IMPLTAG, dissect_ldap_T_greaterOrEqual },
2033 { 6, &hf_ldap_lessOrEqual , BER_CLASS_CON, 6, BER_FLAGS_IMPLTAG, dissect_ldap_T_lessOrEqual },
2034 { 7, &hf_ldap_present , BER_CLASS_CON, 7, BER_FLAGS_IMPLTAG, dissect_ldap_T_present },
2035 { 8, &hf_ldap_approxMatch , BER_CLASS_CON, 8, BER_FLAGS_IMPLTAG, dissect_ldap_T_approxMatch },
2036 { 9, &hf_ldap_extensibleMatch, BER_CLASS_CON, 9, BER_FLAGS_IMPLTAG, dissect_ldap_T_extensibleMatch },
2037 { 0, NULL, 0, 0, 0, NULL }
2041 dissect_ldap_Filter(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2042 #line 684 "ldap.cnf"
2043 proto_tree *tr=NULL;
2044 proto_item *it=NULL;
2047 it=proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), "Filter: ");
2048 tr=proto_item_add_subtree(it, ett_ldap_Filter);
2051 offset = dissect_ber_choice(actx, tree, tvb, offset,
2052 Filter_choice, hf_index, ett_ldap_Filter,
2056 proto_item_append_text(it, "%s", Filter_string);
2066 dissect_ldap_T_filter(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2067 #line 531 "ldap.cnf"
2071 offset = dissect_ldap_Filter(implicit_tag, tvb, offset, actx, tree, hf_index);
2073 #line 534 "ldap.cnf"
2075 and_filter_string=NULL;
2082 static const ber_sequence_t AttributeDescriptionList_sequence_of[1] = {
2083 { &hf_ldap_AttributeDescriptionList_item, BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_AttributeDescription },
2087 dissect_ldap_AttributeDescriptionList(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2088 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
2089 AttributeDescriptionList_sequence_of, hf_index, ett_ldap_AttributeDescriptionList);
2095 static const ber_sequence_t SearchRequest_U_sequence[] = {
2096 { &hf_ldap_baseObject , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_LDAPDN },
2097 { &hf_ldap_scope , BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_ldap_T_scope },
2098 { &hf_ldap_derefAliases , BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_ldap_T_derefAliases },
2099 { &hf_ldap_sizeLimit , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_ldap_INTEGER_0_maxInt },
2100 { &hf_ldap_timeLimit , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_ldap_INTEGER_0_maxInt },
2101 { &hf_ldap_typesOnly , BER_CLASS_UNI, BER_UNI_TAG_BOOLEAN, BER_FLAGS_NOOWNTAG, dissect_ldap_BOOLEAN },
2102 { &hf_ldap_filter , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_ldap_T_filter },
2103 { &hf_ldap_searchRequest_attributes, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ldap_AttributeDescriptionList },
2104 { NULL, 0, 0, 0, NULL }
2108 dissect_ldap_SearchRequest_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2109 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
2110 SearchRequest_U_sequence, hf_index, ett_ldap_SearchRequest_U);
2118 dissect_ldap_SearchRequest(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2119 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
2120 hf_index, BER_CLASS_APP, 3, TRUE, dissect_ldap_SearchRequest_U);
2128 dissect_ldap_AttributeValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2129 #line 464 "ldap.cnf"
2134 int old_offset = offset;
2136 /* extract the value of the octetstring */
2137 offset = dissect_ber_octet_string(FALSE, actx, NULL, tvb, offset, hf_index, &next_tvb);
2139 /* if we have an attribute type that isn't binary see if there is a better dissector */
2140 if(!attr_type || !dissector_try_string(ldap_name_dissector_table, attr_type, next_tvb, actx->pinfo, tree)) {
2141 offset = old_offset;
2143 /* do the default thing */
2144 offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
2150 len = tvb_length_remaining(next_tvb, 0);
2152 for(i = 0; i < len; i++)
2153 if(!g_ascii_isprint(tvb_get_guint8(next_tvb, i)))
2157 string = tvb_get_ephemeral_string(next_tvb, 0, tvb_length_remaining(next_tvb, 0));
2160 proto_item_set_text(actx->created_item, "%s", string);
2170 static const ber_sequence_t SET_OF_AttributeValue_set_of[1] = {
2171 { &hf_ldap_vals_item , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_AttributeValue },
2175 dissect_ldap_SET_OF_AttributeValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2176 offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset,
2177 SET_OF_AttributeValue_set_of, hf_index, ett_ldap_SET_OF_AttributeValue);
2183 static const ber_sequence_t PartialAttributeList_item_sequence[] = {
2184 { &hf_ldap_type , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_AttributeDescription },
2185 { &hf_ldap_vals , BER_CLASS_UNI, BER_UNI_TAG_SET, BER_FLAGS_NOOWNTAG, dissect_ldap_SET_OF_AttributeValue },
2186 { NULL, 0, 0, 0, NULL }
2190 dissect_ldap_PartialAttributeList_item(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2191 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
2192 PartialAttributeList_item_sequence, hf_index, ett_ldap_PartialAttributeList_item);
2198 static const ber_sequence_t PartialAttributeList_sequence_of[1] = {
2199 { &hf_ldap_PartialAttributeList_item, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ldap_PartialAttributeList_item },
2203 dissect_ldap_PartialAttributeList(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2204 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
2205 PartialAttributeList_sequence_of, hf_index, ett_ldap_PartialAttributeList);
2211 static const ber_sequence_t SearchResultEntry_U_sequence[] = {
2212 { &hf_ldap_objectName , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_LDAPDN },
2213 { &hf_ldap_searchResultEntry_attributes, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ldap_PartialAttributeList },
2214 { NULL, 0, 0, 0, NULL }
2218 dissect_ldap_SearchResultEntry_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2219 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
2220 SearchResultEntry_U_sequence, hf_index, ett_ldap_SearchResultEntry_U);
2228 dissect_ldap_SearchResultEntry(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2229 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
2230 hf_index, BER_CLASS_APP, 4, TRUE, dissect_ldap_SearchResultEntry_U);
2236 static const value_string ldap_T_resultCode_vals[] = {
2238 { 1, "operationsError" },
2239 { 2, "protocolError" },
2240 { 3, "timeLimitExceeded" },
2241 { 4, "sizeLimitExceeded" },
2242 { 5, "compareFalse" },
2243 { 6, "compareTrue" },
2244 { 7, "authMethodNotSupported" },
2245 { 8, "strongAuthRequired" },
2247 { 11, "adminLimitExceeded" },
2248 { 12, "unavailableCriticalExtension" },
2249 { 13, "confidentialityRequired" },
2250 { 14, "saslBindInProgress" },
2251 { 16, "noSuchAttribute" },
2252 { 17, "undefinedAttributeType" },
2253 { 18, "inappropriateMatching" },
2254 { 19, "constraintViolation" },
2255 { 20, "attributeOrValueExists" },
2256 { 21, "invalidAttributeSyntax" },
2257 { 32, "noSuchObject" },
2258 { 33, "aliasProblem" },
2259 { 34, "invalidDNSyntax" },
2260 { 36, "aliasDereferencingProblem" },
2261 { 48, "inappropriateAuthentication" },
2262 { 49, "invalidCredentials" },
2263 { 50, "insufficientAccessRights" },
2265 { 52, "unavailable" },
2266 { 53, "unwillingToPerform" },
2267 { 54, "loopDetect" },
2268 { 64, "namingViolation" },
2269 { 65, "objectClassViolation" },
2270 { 66, "notAllowedOnNonLeaf" },
2271 { 67, "notAllowedOnRDN" },
2272 { 68, "entryAlreadyExists" },
2273 { 69, "objectClassModsProhibited" },
2274 { 71, "affectsMultipleDSAs" },
2276 { 118, "canceled" },
2277 { 119, "noSuchOperation" },
2279 { 121, "cannotCancel" },
2285 dissect_ldap_T_resultCode(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2286 #line 430 "ldap.cnf"
2288 const gchar *valstr;
2290 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
2294 ldap_do_protocolop(actx->pinfo);
2296 valstr = val_to_str(result, ldap_T_resultCode_vals, "Unknown result(%u)");
2298 if (check_col(actx->pinfo->cinfo, COL_INFO))
2299 col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%s ", valstr);
2302 proto_item_append_text(ldm_tree, " %s", valstr);
2311 static const ber_sequence_t LDAPResult_sequence[] = {
2312 { &hf_ldap_resultCode , BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_ldap_T_resultCode },
2313 { &hf_ldap_matchedDN , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_LDAPDN },
2314 { &hf_ldap_errorMessage , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_ErrorMessage },
2315 { &hf_ldap_referral , BER_CLASS_CON, 3, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_Referral },
2316 { NULL, 0, 0, 0, NULL }
2320 dissect_ldap_LDAPResult(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2321 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
2322 LDAPResult_sequence, hf_index, ett_ldap_LDAPResult);
2330 dissect_ldap_SearchResultDone(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2331 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
2332 hf_index, BER_CLASS_APP, 5, TRUE, dissect_ldap_LDAPResult);
2338 static const ber_sequence_t SEQUENCE_OF_LDAPURL_sequence_of[1] = {
2339 { &hf_ldap__untag_item , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_LDAPURL },
2343 dissect_ldap_SEQUENCE_OF_LDAPURL(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2344 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
2345 SEQUENCE_OF_LDAPURL_sequence_of, hf_index, ett_ldap_SEQUENCE_OF_LDAPURL);
2353 dissect_ldap_SearchResultReference(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2354 #line 754 "ldap.cnf"
2356 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
2357 hf_index, BER_CLASS_APP, 19, TRUE, dissect_ldap_SEQUENCE_OF_LDAPURL);
2360 ldap_do_protocolop(actx->pinfo);
2369 static const value_string ldap_T_operation_vals[] = {
2378 dissect_ldap_T_operation(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2379 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
2386 static const ber_sequence_t AttributeTypeAndValues_sequence[] = {
2387 { &hf_ldap_type , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_AttributeDescription },
2388 { &hf_ldap_vals , BER_CLASS_UNI, BER_UNI_TAG_SET, BER_FLAGS_NOOWNTAG, dissect_ldap_SET_OF_AttributeValue },
2389 { NULL, 0, 0, 0, NULL }
2393 dissect_ldap_AttributeTypeAndValues(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2394 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
2395 AttributeTypeAndValues_sequence, hf_index, ett_ldap_AttributeTypeAndValues);
2401 static const ber_sequence_t T_modifyRequest_modification_item_sequence[] = {
2402 { &hf_ldap_operation , BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_ldap_T_operation },
2403 { &hf_ldap_modification , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ldap_AttributeTypeAndValues },
2404 { NULL, 0, 0, 0, NULL }
2408 dissect_ldap_T_modifyRequest_modification_item(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2409 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
2410 T_modifyRequest_modification_item_sequence, hf_index, ett_ldap_T_modifyRequest_modification_item);
2416 static const ber_sequence_t ModifyRequest_modification_sequence_of[1] = {
2417 { &hf_ldap_modifyRequest_modification_item, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ldap_T_modifyRequest_modification_item },
2421 dissect_ldap_ModifyRequest_modification(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2422 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
2423 ModifyRequest_modification_sequence_of, hf_index, ett_ldap_ModifyRequest_modification);
2429 static const ber_sequence_t ModifyRequest_U_sequence[] = {
2430 { &hf_ldap_object , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_LDAPDN },
2431 { &hf_ldap_modifyRequest_modification, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ldap_ModifyRequest_modification },
2432 { NULL, 0, 0, 0, NULL }
2436 dissect_ldap_ModifyRequest_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2437 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
2438 ModifyRequest_U_sequence, hf_index, ett_ldap_ModifyRequest_U);
2446 dissect_ldap_ModifyRequest(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2447 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
2448 hf_index, BER_CLASS_APP, 6, TRUE, dissect_ldap_ModifyRequest_U);
2456 dissect_ldap_ModifyResponse(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2457 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
2458 hf_index, BER_CLASS_APP, 7, TRUE, dissect_ldap_LDAPResult);
2464 static const ber_sequence_t AttributeList_item_sequence[] = {
2465 { &hf_ldap_type , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_AttributeDescription },
2466 { &hf_ldap_vals , BER_CLASS_UNI, BER_UNI_TAG_SET, BER_FLAGS_NOOWNTAG, dissect_ldap_SET_OF_AttributeValue },
2467 { NULL, 0, 0, 0, NULL }
2471 dissect_ldap_AttributeList_item(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2472 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
2473 AttributeList_item_sequence, hf_index, ett_ldap_AttributeList_item);
2479 static const ber_sequence_t AttributeList_sequence_of[1] = {
2480 { &hf_ldap_AttributeList_item, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ldap_AttributeList_item },
2484 dissect_ldap_AttributeList(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2485 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
2486 AttributeList_sequence_of, hf_index, ett_ldap_AttributeList);
2492 static const ber_sequence_t AddRequest_U_sequence[] = {
2493 { &hf_ldap_entry , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_LDAPDN },
2494 { &hf_ldap_attributes , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ldap_AttributeList },
2495 { NULL, 0, 0, 0, NULL }
2499 dissect_ldap_AddRequest_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2500 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
2501 AddRequest_U_sequence, hf_index, ett_ldap_AddRequest_U);
2509 dissect_ldap_AddRequest(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2510 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
2511 hf_index, BER_CLASS_APP, 8, TRUE, dissect_ldap_AddRequest_U);
2519 dissect_ldap_AddResponse(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2520 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
2521 hf_index, BER_CLASS_APP, 9, TRUE, dissect_ldap_LDAPResult);
2529 dissect_ldap_DelRequest(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2530 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
2531 hf_index, BER_CLASS_APP, 10, TRUE, dissect_ldap_LDAPDN);
2539 dissect_ldap_DelResponse(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2540 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
2541 hf_index, BER_CLASS_APP, 11, TRUE, dissect_ldap_LDAPResult);
2549 dissect_ldap_RelativeLDAPDN(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2550 offset = dissect_ldap_LDAPString(implicit_tag, tvb, offset, actx, tree, hf_index);
2556 static const ber_sequence_t ModifyDNRequest_U_sequence[] = {
2557 { &hf_ldap_entry , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_LDAPDN },
2558 { &hf_ldap_newrdn , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_RelativeLDAPDN },
2559 { &hf_ldap_deleteoldrdn , BER_CLASS_UNI, BER_UNI_TAG_BOOLEAN, BER_FLAGS_NOOWNTAG, dissect_ldap_BOOLEAN },
2560 { &hf_ldap_newSuperior , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_LDAPDN },
2561 { NULL, 0, 0, 0, NULL }
2565 dissect_ldap_ModifyDNRequest_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2566 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
2567 ModifyDNRequest_U_sequence, hf_index, ett_ldap_ModifyDNRequest_U);
2575 dissect_ldap_ModifyDNRequest(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2576 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
2577 hf_index, BER_CLASS_APP, 12, TRUE, dissect_ldap_ModifyDNRequest_U);
2585 dissect_ldap_ModifyDNResponse(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2586 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
2587 hf_index, BER_CLASS_APP, 13, TRUE, dissect_ldap_LDAPResult);
2593 static const ber_sequence_t CompareRequest_U_sequence[] = {
2594 { &hf_ldap_entry , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_LDAPDN },
2595 { &hf_ldap_ava , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ldap_AttributeValueAssertion },
2596 { NULL, 0, 0, 0, NULL }
2600 dissect_ldap_CompareRequest_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2601 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
2602 CompareRequest_U_sequence, hf_index, ett_ldap_CompareRequest_U);
2610 dissect_ldap_CompareRequest(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2611 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
2612 hf_index, BER_CLASS_APP, 14, TRUE, dissect_ldap_CompareRequest_U);
2620 dissect_ldap_CompareResponse(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2621 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
2622 hf_index, BER_CLASS_APP, 15, TRUE, dissect_ldap_LDAPResult);
2630 dissect_ldap_AbandonRequest(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2631 #line 761 "ldap.cnf"
2633 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
2634 hf_index, BER_CLASS_APP, 16, TRUE, dissect_ldap_MessageID);
2637 ldap_do_protocolop(actx->pinfo);
2648 dissect_ldap_LDAPOID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2651 tvbuff_t *parameter_tvb;
2655 offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
2660 object_identifier_id = NULL;
2665 object_identifier_id = tvb_get_ephemeral_string(parameter_tvb, 0, tvb_length_remaining(parameter_tvb,0));
2666 name = oid_resolved_from_string(object_identifier_id);
2669 proto_item_append_text(actx->created_item, " (%s)", name);
2671 if((hf_index == hf_ldap_requestName) || (hf_index == hf_ldap_responseName)) {
2672 ldap_do_protocolop(actx->pinfo);
2674 if(check_col(actx->pinfo->cinfo, COL_INFO))
2675 col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%s ", name);
2679 if(((hf_index == hf_ldap_responseName) || (hf_index == hf_ldap_requestName)) &&
2680 !strcmp(object_identifier_id, "1.3.6.1.4.1.1466.20037")) {
2682 /* we have agreed start_tls */
2683 ldap_conv_info_t *ldap_info = NULL;
2685 ldap_info = (ldap_conv_info_t *)actx->pinfo->private_data;
2688 if(hf_index == hf_ldap_responseName)
2689 /* TLS in the next frame */
2690 ldap_info->start_tls_frame = (actx->pinfo->fd->num) + 1;
2692 /* remember we have asked to start_tls */
2693 ldap_info->start_tls_pending = TRUE;
2704 dissect_ldap_T_requestValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2705 #line 746 "ldap.cnf"
2707 if((object_identifier_id != NULL) && oid_has_dissector(object_identifier_id)) {
2708 offset = call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
2710 offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
2721 static const ber_sequence_t ExtendedRequest_U_sequence[] = {
2722 { &hf_ldap_requestName , BER_CLASS_CON, 0, BER_FLAGS_IMPLTAG, dissect_ldap_LDAPOID },
2723 { &hf_ldap_requestValue , BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_T_requestValue },
2724 { NULL, 0, 0, 0, NULL }
2728 dissect_ldap_ExtendedRequest_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2729 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
2730 ExtendedRequest_U_sequence, hf_index, ett_ldap_ExtendedRequest_U);
2738 dissect_ldap_ExtendedRequest(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2739 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
2740 hf_index, BER_CLASS_APP, 23, TRUE, dissect_ldap_ExtendedRequest_U);
2746 static const value_string ldap_ExtendedResponse_resultCode_vals[] = {
2748 { 1, "operationsError" },
2749 { 2, "protocolError" },
2750 { 3, "timeLimitExceeded" },
2751 { 4, "sizeLimitExceeded" },
2752 { 5, "compareFalse" },
2753 { 6, "compareTrue" },
2754 { 7, "authMethodNotSupported" },
2755 { 8, "strongAuthRequired" },
2757 { 11, "adminLimitExceeded" },
2758 { 12, "unavailableCriticalExtension" },
2759 { 13, "confidentialityRequired" },
2760 { 14, "saslBindInProgress" },
2761 { 16, "noSuchAttribute" },
2762 { 17, "undefinedAttributeType" },
2763 { 18, "inappropriateMatching" },
2764 { 19, "constraintViolation" },
2765 { 20, "attributeOrValueExists" },
2766 { 21, "invalidAttributeSyntax" },
2767 { 32, "noSuchObject" },
2768 { 33, "aliasProblem" },
2769 { 34, "invalidDNSyntax" },
2770 { 36, "aliasDereferencingProblem" },
2771 { 48, "inappropriateAuthentication" },
2772 { 49, "invalidCredentials" },
2773 { 50, "insufficientAccessRights" },
2775 { 52, "unavailable" },
2776 { 53, "unwillingToPerform" },
2777 { 54, "loopDetect" },
2778 { 64, "namingViolation" },
2779 { 65, "objectClassViolation" },
2780 { 66, "notAllowedOnNonLeaf" },
2781 { 67, "notAllowedOnRDN" },
2782 { 68, "entryAlreadyExists" },
2783 { 69, "objectClassModsProhibited" },
2784 { 71, "affectsMultipleDSAs" },
2786 { 118, "canceled" },
2787 { 119, "noSuchOperation" },
2789 { 121, "cannotCancel" },
2795 dissect_ldap_ExtendedResponse_resultCode(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2796 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
2805 dissect_ldap_ResponseName(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2806 offset = dissect_ldap_LDAPOID(implicit_tag, tvb, offset, actx, tree, hf_index);
2814 dissect_ldap_OCTET_STRING(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2815 offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
2822 static const ber_sequence_t ExtendedResponse_U_sequence[] = {
2823 { &hf_ldap_extendedResponse_resultCode, BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_ldap_ExtendedResponse_resultCode },
2824 { &hf_ldap_matchedDN , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_LDAPDN },
2825 { &hf_ldap_errorMessage , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_ErrorMessage },
2826 { &hf_ldap_referral , BER_CLASS_CON, 3, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_Referral },
2827 { &hf_ldap_responseName , BER_CLASS_CON, 10, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_ResponseName },
2828 { &hf_ldap_response , BER_CLASS_CON, 11, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_OCTET_STRING },
2829 { NULL, 0, 0, 0, NULL }
2833 dissect_ldap_ExtendedResponse_U(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2834 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
2835 ExtendedResponse_U_sequence, hf_index, ett_ldap_ExtendedResponse_U);
2843 dissect_ldap_ExtendedResponse(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2844 offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
2845 hf_index, BER_CLASS_APP, 24, TRUE, dissect_ldap_ExtendedResponse_U);
2851 static const value_string ldap_ProtocolOp_vals[] = {
2852 { 0, "bindRequest" },
2853 { 1, "bindResponse" },
2854 { 2, "unbindRequest" },
2855 { 3, "searchRequest" },
2856 { 4, "searchResEntry" },
2857 { 5, "searchResDone" },
2858 { 19, "searchResRef" },
2859 { 6, "modifyRequest" },
2860 { 7, "modifyResponse" },
2861 { 8, "addRequest" },
2862 { 9, "addResponse" },
2863 { 10, "delRequest" },
2864 { 11, "delResponse" },
2865 { 12, "modDNRequest" },
2866 { 13, "modDNResponse" },
2867 { 14, "compareRequest" },
2868 { 15, "compareResponse" },
2869 { 16, "abandonRequest" },
2870 { 23, "extendedReq" },
2871 { 24, "extendedResp" },
2875 static const ber_choice_t ProtocolOp_choice[] = {
2876 { 0, &hf_ldap_bindRequest , BER_CLASS_APP, 0, BER_FLAGS_NOOWNTAG, dissect_ldap_BindRequest },
2877 { 1, &hf_ldap_bindResponse , BER_CLASS_APP, 1, BER_FLAGS_NOOWNTAG, dissect_ldap_BindResponse },
2878 { 2, &hf_ldap_unbindRequest , BER_CLASS_APP, 2, BER_FLAGS_NOOWNTAG, dissect_ldap_UnbindRequest },
2879 { 3, &hf_ldap_searchRequest , BER_CLASS_APP, 3, BER_FLAGS_NOOWNTAG, dissect_ldap_SearchRequest },
2880 { 4, &hf_ldap_searchResEntry , BER_CLASS_APP, 4, BER_FLAGS_NOOWNTAG, dissect_ldap_SearchResultEntry },
2881 { 5, &hf_ldap_searchResDone , BER_CLASS_APP, 5, BER_FLAGS_NOOWNTAG, dissect_ldap_SearchResultDone },
2882 { 19, &hf_ldap_searchResRef , BER_CLASS_APP, 19, BER_FLAGS_NOOWNTAG, dissect_ldap_SearchResultReference },
2883 { 6, &hf_ldap_modifyRequest , BER_CLASS_APP, 6, BER_FLAGS_NOOWNTAG, dissect_ldap_ModifyRequest },
2884 { 7, &hf_ldap_modifyResponse , BER_CLASS_APP, 7, BER_FLAGS_NOOWNTAG, dissect_ldap_ModifyResponse },
2885 { 8, &hf_ldap_addRequest , BER_CLASS_APP, 8, BER_FLAGS_NOOWNTAG, dissect_ldap_AddRequest },
2886 { 9, &hf_ldap_addResponse , BER_CLASS_APP, 9, BER_FLAGS_NOOWNTAG, dissect_ldap_AddResponse },
2887 { 10, &hf_ldap_delRequest , BER_CLASS_APP, 10, BER_FLAGS_NOOWNTAG, dissect_ldap_DelRequest },
2888 { 11, &hf_ldap_delResponse , BER_CLASS_APP, 11, BER_FLAGS_NOOWNTAG, dissect_ldap_DelResponse },
2889 { 12, &hf_ldap_modDNRequest , BER_CLASS_APP, 12, BER_FLAGS_NOOWNTAG, dissect_ldap_ModifyDNRequest },
2890 { 13, &hf_ldap_modDNResponse , BER_CLASS_APP, 13, BER_FLAGS_NOOWNTAG, dissect_ldap_ModifyDNResponse },
2891 { 14, &hf_ldap_compareRequest , BER_CLASS_APP, 14, BER_FLAGS_NOOWNTAG, dissect_ldap_CompareRequest },
2892 { 15, &hf_ldap_compareResponse, BER_CLASS_APP, 15, BER_FLAGS_NOOWNTAG, dissect_ldap_CompareResponse },
2893 { 16, &hf_ldap_abandonRequest , BER_CLASS_APP, 16, BER_FLAGS_NOOWNTAG, dissect_ldap_AbandonRequest },
2894 { 23, &hf_ldap_extendedReq , BER_CLASS_APP, 23, BER_FLAGS_NOOWNTAG, dissect_ldap_ExtendedRequest },
2895 { 24, &hf_ldap_extendedResp , BER_CLASS_APP, 24, BER_FLAGS_NOOWNTAG, dissect_ldap_ExtendedResponse },
2896 { 0, NULL, 0, 0, 0, NULL }
2900 dissect_ldap_ProtocolOp(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2901 #line 100 "ldap.cnf"
2903 ldap_call_response_t *lcrp;
2904 ldap_conv_info_t *ldap_info = (ldap_conv_info_t *)actx->pinfo->private_data;
2905 do_protocolop = TRUE;
2908 offset = dissect_ber_choice(actx, tree, tvb, offset,
2909 ProtocolOp_choice, hf_index, ett_ldap_ProtocolOp,
2912 #line 106 "ldap.cnf"
2914 if (ProtocolOp == -1) {
2918 /* ProtocolOp is the index, not the tag so convert it to the tag value */
2919 ProtocolOp = ldap_ProtocolOp_vals[ProtocolOp].value;
2921 lcrp=ldap_match_call_response(tvb, actx->pinfo, tree, MessageID, ProtocolOp);
2923 tap_queue_packet(ldap_tap, actx->pinfo, lcrp);
2926 /* XXX: the count will not work if the results span multiple TCP packets */
2928 if(ldap_info && tree) { /* only count once - on tree pass */
2929 switch(ProtocolOp) {
2931 case LDAP_RES_SEARCH_ENTRY:
2932 ldap_info->num_results++;
2934 proto_item_append_text(tree, " [%d result%s]",
2935 ldap_info->num_results, ldap_info->num_results == 1 ? "" : "s");
2939 case LDAP_RES_SEARCH_RESULT:
2941 if (check_col(actx->pinfo->cinfo, COL_INFO))
2942 col_append_fstr(actx->pinfo->cinfo, COL_INFO, " [%d result%s]",
2943 ldap_info->num_results, ldap_info->num_results == 1 ? "" : "s");
2945 proto_item_append_text(tree, " [%d result%s]",
2946 ldap_info->num_results, ldap_info->num_results == 1 ? "" : "s");
2948 ldap_info->num_results = 0;
2955 if(ldap_info && (ProtocolOp == LDAP_RES_EXTENDED)) {
2956 /* this is an extend result */
2958 if(ldap_info->start_tls_pending && !ldap_info->start_tls_frame) {
2959 /* XXX: some directories do not correctly return the responseName in the extendedResponse so we don't know start_tls has been negotiated */
2961 if(check_col(actx->pinfo->cinfo, COL_INFO))
2962 col_append_fstr(actx->pinfo->cinfo, COL_INFO, "[LDAP_START_TLS_OID responseName missing] ");
2963 ldap_info->start_tls_frame = (actx->pinfo->fd->num) + 1;
2966 ldap_info->start_tls_pending = FALSE;
2976 dissect_ldap_ControlType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2977 offset = dissect_ldap_LDAPOID(implicit_tag, tvb, offset, actx, tree, hf_index);
2985 dissect_ldap_T_controlValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
2986 #line 727 "ldap.cnf"
2992 if((object_identifier_id != NULL) && oid_has_dissector(object_identifier_id)) {
2993 /* remove the OCTET STRING encoding */
2994 offset=dissect_ber_identifier(actx->pinfo, NULL, tvb, offset, &class, &pc, &tag);
2995 offset=dissect_ber_length(actx->pinfo, NULL, tvb, offset, &len, &ind);
2997 call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
3001 offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
3013 static const ber_sequence_t Control_sequence[] = {
3014 { &hf_ldap_controlType , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_ControlType },
3015 { &hf_ldap_criticality , BER_CLASS_UNI, BER_UNI_TAG_BOOLEAN, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ldap_BOOLEAN },
3016 { &hf_ldap_controlValue , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG, dissect_ldap_T_controlValue },
3017 { NULL, 0, 0, 0, NULL }
3021 dissect_ldap_Control(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
3022 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
3023 Control_sequence, hf_index, ett_ldap_Control);
3029 static const ber_sequence_t Controls_sequence_of[1] = {
3030 { &hf_ldap_Controls_item , BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ldap_Control },
3034 dissect_ldap_Controls(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
3035 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
3036 Controls_sequence_of, hf_index, ett_ldap_Controls);
3042 static const ber_sequence_t LDAPMessage_sequence[] = {
3043 { &hf_ldap_messageID , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_ldap_MessageID },
3044 { &hf_ldap_protocolOp , BER_CLASS_ANY/*choice*/, -1/*choice*/, BER_FLAGS_NOOWNTAG|BER_FLAGS_NOTCHKTAG, dissect_ldap_ProtocolOp },
3045 { &hf_ldap_controls , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_Controls },
3046 { NULL, 0, 0, 0, NULL }
3050 dissect_ldap_LDAPMessage(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
3051 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
3052 LDAPMessage_sequence, hf_index, ett_ldap_LDAPMessage);
3062 dissect_ldap_INTEGER(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
3063 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
3070 static const ber_sequence_t SearchControlValue_sequence[] = {
3071 { &hf_ldap_size , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_ldap_INTEGER },
3072 { &hf_ldap_cookie , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_OCTET_STRING },
3073 { NULL, 0, 0, 0, NULL }
3077 dissect_ldap_SearchControlValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
3078 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
3079 SearchControlValue_sequence, hf_index, ett_ldap_SearchControlValue);
3085 static const ber_sequence_t SortKeyList_item_sequence[] = {
3086 { &hf_ldap_attributeType , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_AttributeDescription },
3087 { &hf_ldap_orderingRule , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_MatchingRuleId },
3088 { &hf_ldap_reverseOrder , BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_BOOLEAN },
3089 { NULL, 0, 0, 0, NULL }
3093 dissect_ldap_SortKeyList_item(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
3094 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
3095 SortKeyList_item_sequence, hf_index, ett_ldap_SortKeyList_item);
3101 static const ber_sequence_t SortKeyList_sequence_of[1] = {
3102 { &hf_ldap_SortKeyList_item, BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG, dissect_ldap_SortKeyList_item },
3106 dissect_ldap_SortKeyList(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
3107 offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
3108 SortKeyList_sequence_of, hf_index, ett_ldap_SortKeyList);
3114 static const value_string ldap_T_sortResult_vals[] = {
3116 { 1, "operationsError" },
3117 { 3, "timeLimitExceeded" },
3118 { 8, "strongAuthRequired" },
3119 { 11, "adminLimitExceeded" },
3120 { 16, "noSuchAttribute" },
3121 { 18, "inappropriateMatching" },
3122 { 50, "insufficientAccessRights" },
3124 { 53, "unwillingToPerform" },
3131 dissect_ldap_T_sortResult(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
3132 offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_index,
3139 static const ber_sequence_t SortResult_sequence[] = {
3140 { &hf_ldap_sortResult , BER_CLASS_UNI, BER_UNI_TAG_ENUMERATED, BER_FLAGS_NOOWNTAG, dissect_ldap_T_sortResult },
3141 { &hf_ldap_attributeType , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_AttributeDescription },
3142 { NULL, 0, 0, 0, NULL }
3146 dissect_ldap_SortResult(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
3147 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
3148 SortResult_sequence, hf_index, ett_ldap_SortResult);
3154 static const ber_sequence_t ReplControlValue_sequence[] = {
3155 { &hf_ldap_parentsFirst , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_ldap_INTEGER },
3156 { &hf_ldap_maxReturnLength, BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_ldap_INTEGER },
3157 { &hf_ldap_cookie , BER_CLASS_UNI, BER_UNI_TAG_OCTETSTRING, BER_FLAGS_NOOWNTAG, dissect_ldap_OCTET_STRING },
3158 { NULL, 0, 0, 0, NULL }
3162 dissect_ldap_ReplControlValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
3163 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
3164 ReplControlValue_sequence, hf_index, ett_ldap_ReplControlValue);
3170 static const ber_sequence_t PasswdModifyRequestValue_sequence[] = {
3171 { &hf_ldap_userIdentity , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_OCTET_STRING },
3172 { &hf_ldap_oldPasswd , BER_CLASS_CON, 1, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_OCTET_STRING },
3173 { &hf_ldap_newPasswd , BER_CLASS_CON, 2, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_OCTET_STRING },
3174 { NULL, 0, 0, 0, NULL }
3178 dissect_ldap_PasswdModifyRequestValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
3179 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
3180 PasswdModifyRequestValue_sequence, hf_index, ett_ldap_PasswdModifyRequestValue);
3186 static const ber_sequence_t PasswdModifyResponseValue_sequence[] = {
3187 { &hf_ldap_genPasswd , BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL|BER_FLAGS_IMPLTAG, dissect_ldap_OCTET_STRING },
3188 { NULL, 0, 0, 0, NULL }
3192 dissect_ldap_PasswdModifyResponseValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
3193 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
3194 PasswdModifyResponseValue_sequence, hf_index, ett_ldap_PasswdModifyResponseValue);
3200 static const ber_sequence_t CancelRequestValue_sequence[] = {
3201 { &hf_ldap_cancelID , BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_ldap_MessageID },
3202 { NULL, 0, 0, 0, NULL }
3206 dissect_ldap_CancelRequestValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
3207 offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
3208 CancelRequestValue_sequence, hf_index, ett_ldap_CancelRequestValue);
3215 static void dissect_LDAPMessage_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
3216 asn1_ctx_t asn1_ctx;
3217 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
3218 dissect_ldap_LDAPMessage(FALSE, tvb, 0, &asn1_ctx, tree, hf_ldap_LDAPMessage_PDU);
3220 static void dissect_SearchControlValue_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
3221 asn1_ctx_t asn1_ctx;
3222 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
3223 dissect_ldap_SearchControlValue(FALSE, tvb, 0, &asn1_ctx, tree, hf_ldap_SearchControlValue_PDU);
3225 static void dissect_SortKeyList_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
3226 asn1_ctx_t asn1_ctx;
3227 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
3228 dissect_ldap_SortKeyList(FALSE, tvb, 0, &asn1_ctx, tree, hf_ldap_SortKeyList_PDU);
3230 static void dissect_SortResult_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
3231 asn1_ctx_t asn1_ctx;
3232 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
3233 dissect_ldap_SortResult(FALSE, tvb, 0, &asn1_ctx, tree, hf_ldap_SortResult_PDU);
3235 static void dissect_ReplControlValue_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
3236 asn1_ctx_t asn1_ctx;
3237 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
3238 dissect_ldap_ReplControlValue(FALSE, tvb, 0, &asn1_ctx, tree, hf_ldap_ReplControlValue_PDU);
3240 static void dissect_PasswdModifyRequestValue_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
3241 asn1_ctx_t asn1_ctx;
3242 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
3243 dissect_ldap_PasswdModifyRequestValue(FALSE, tvb, 0, &asn1_ctx, tree, hf_ldap_PasswdModifyRequestValue_PDU);
3245 static void dissect_CancelRequestValue_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) {
3246 asn1_ctx_t asn1_ctx;
3247 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
3248 dissect_ldap_CancelRequestValue(FALSE, tvb, 0, &asn1_ctx, tree, hf_ldap_CancelRequestValue_PDU);
3252 /*--- End of included file: packet-ldap-fn.c ---*/
3253 #line 708 "packet-ldap-template.c"
3256 dissect_ldap_payload(tvbuff_t *tvb, packet_info *pinfo,
3257 proto_tree *tree, ldap_conv_info_t *ldap_info,
3258 gboolean is_mscldap)
3261 guint length_remaining;
3263 int messageOffset = 0;
3264 guint headerLength = 0;
3266 tvbuff_t *msg_tvb = NULL;
3268 gboolean pc, ind = 0;
3274 length_remaining = tvb_ensure_length_remaining(tvb, offset);
3276 if (length_remaining < 6) return;
3279 * OK, try to read the "Sequence Of" header; this gets the total
3280 * length of the LDAP message.
3282 messageOffset = get_ber_identifier(tvb, offset, &class, &pc, &ber_tag);
3283 messageOffset = get_ber_length(tvb, messageOffset, &msg_len, &ind);
3286 if((msg_len<4) || (msg_len>10000000)) return;
3288 if ( (class==BER_CLASS_UNI) && (ber_tag==BER_UNI_TAG_SEQUENCE) ) {
3290 * Add the length of the "Sequence Of" header to the message
3293 headerLength = messageOffset - offset;
3294 msg_len += headerLength;
3295 if (msg_len < headerLength) {
3297 * The message length was probably so large that the total length
3300 * Report this as an error.
3302 show_reported_bounds_error(tvb, pinfo, tree);
3307 * We couldn't parse the header; just make it the amount of data
3308 * remaining in the tvbuff, so we'll give up on this segment
3309 * after attempting to parse the message - there's nothing more
3310 * we can do. "dissect_ldap_message()" will display the error.
3312 msg_len = length_remaining;
3316 * Construct a tvbuff containing the amount of the payload we have
3317 * available. Make its reported length the amount of data in the
3320 * XXX - if reassembly isn't enabled. the subdissector will throw a
3321 * BoundsError exception, rather than a ReportedBoundsError exception.
3322 * We really want a tvbuff where the length is "length", the reported
3323 * length is "plen", and the "if the snapshot length were infinite"
3324 * length is the minimum of the reported length of the tvbuff handed
3325 * to us and "plen", with a new type of exception thrown if the offset
3326 * is within the reported length but beyond that third length, with
3327 * that exception getting the "Unreassembled Packet" error.
3329 length = length_remaining;
3330 if (length > msg_len) length = msg_len;
3331 msg_tvb = tvb_new_subset(tvb, offset, length, msg_len);
3334 * Now dissect the LDAP message.
3336 ldap_info->is_mscldap = is_mscldap;
3337 pinfo->private_data = ldap_info;
3338 dissect_LDAPMessage_PDU(msg_tvb, pinfo, tree);
3342 /* If this was a sasl blob there might be another PDU following in the
3345 if(tvb_length_remaining(tvb, offset)>=6){
3346 tvb = tvb_new_subset(tvb, offset, tvb_length_remaining(tvb, offset), -1);
3355 dissect_ldap_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_mscldap)
3358 conversation_t *conversation;
3359 gboolean doing_sasl_security = FALSE;
3360 guint length_remaining;
3361 ldap_conv_info_t *ldap_info = NULL;
3362 proto_item *ldap_item = NULL;
3363 proto_tree *ldap_tree = NULL;
3368 * Do we have a conversation for this connection?
3370 conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
3371 pinfo->ptype, pinfo->srcport,
3372 pinfo->destport, 0);
3373 if (conversation == NULL) {
3374 /* We don't yet have a conversation, so create one. */
3375 conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst,
3376 pinfo->ptype, pinfo->srcport,
3377 pinfo->destport, 0);
3382 * Do we already have a type and mechanism?
3384 ldap_info = conversation_get_proto_data(conversation, proto_ldap);
3385 if (ldap_info == NULL) {
3386 /* No. Attach that information to the conversation, and add
3387 * it to the list of information structures.
3389 ldap_info = g_malloc(sizeof(ldap_conv_info_t));
3390 ldap_info->auth_type = 0;
3391 ldap_info->auth_mech = 0;
3392 ldap_info->first_auth_frame = 0;
3393 ldap_info->matched=g_hash_table_new(ldap_info_hash_matched, ldap_info_equal_matched);
3394 ldap_info->unmatched=g_hash_table_new(ldap_info_hash_unmatched, ldap_info_equal_unmatched);
3395 ldap_info->num_results = 0;
3396 ldap_info->start_tls_frame = 0;
3397 ldap_info->start_tls_pending = FALSE;
3399 conversation_add_proto_data(conversation, proto_ldap, ldap_info);
3401 ldap_info->next = ldap_info_items;
3402 ldap_info_items = ldap_info;
3406 switch (ldap_info->auth_type) {
3407 case LDAP_AUTH_SASL:
3409 * It's SASL; are we using a security layer?
3411 if (ldap_info->first_auth_frame != 0 &&
3412 pinfo->fd->num >= ldap_info->first_auth_frame) {
3413 doing_sasl_security = TRUE; /* yes */
3417 length_remaining = tvb_ensure_length_remaining(tvb, offset);
3419 /* It might still be a packet containing a SASL security layer
3420 * but its just that we never saw the BIND packet.
3421 * check if it looks like it could be a SASL blob here
3422 * and in that case just assume it is GSS-SPNEGO
3424 if(!doing_sasl_security && (tvb_bytes_exist(tvb, offset, 5))
3425 &&(tvb_get_ntohl(tvb, offset)<=(guint)(tvb_reported_length_remaining(tvb, offset)-4))
3426 &&(tvb_get_guint8(tvb, offset+4)==0x60) ){
3427 ldap_info->auth_type=LDAP_AUTH_SASL;
3428 ldap_info->first_auth_frame=pinfo->fd->num;
3429 ldap_info->auth_mech=g_strdup("GSS-SPNEGO");
3430 doing_sasl_security=TRUE;
3434 * This is the first PDU, set the Protocol column and clear the
3437 if (check_col(pinfo->cinfo, COL_PROTOCOL)) col_set_str(pinfo->cinfo, COL_PROTOCOL, pinfo->current_proto);
3439 if(last_frame_seen == pinfo->fd->num) {
3440 /* we have already dissected an ldap PDU in this frame - add a separator and set a fence */
3441 if (check_col(pinfo->cinfo, COL_INFO)) {
3442 col_append_str(pinfo->cinfo, COL_INFO, "| ");
3443 col_set_fence(pinfo->cinfo, COL_INFO);
3446 if (check_col(pinfo->cinfo, COL_INFO)) col_clear(pinfo->cinfo, COL_INFO);
3448 last_frame_seen = pinfo->fd->num;
3450 ldap_item = proto_tree_add_item(tree, is_mscldap?proto_cldap:proto_ldap, tvb, 0, -1, FALSE);
3451 ldap_tree = proto_item_add_subtree(ldap_item, ett_ldap);
3454 * Might we be doing a SASL security layer and, if so, *are* we doing
3457 * Just because we've seen a bind reply for SASL, that doesn't mean
3458 * that we're using a SASL security layer; I've seen captures in
3459 * which some SASL negotiations lead to a security layer being used
3460 * and other negotiations don't, and it's not obvious what's different
3461 * in the two negotiations. Therefore, we assume that if the first
3462 * byte is 0, it's a length for a SASL security layer (that way, we
3463 * never reassemble more than 16 megabytes, protecting us from
3464 * chewing up *too* much memory), and otherwise that it's an LDAP
3465 * message (actually, if it's an LDAP message it should begin with 0x30,
3466 * but we want to parse garbage as LDAP messages rather than really
3470 if (doing_sasl_security && tvb_get_guint8(tvb, offset) == 0) {
3471 proto_item *sasl_item = NULL;
3472 proto_tree *sasl_tree = NULL;
3474 guint sasl_len, sasl_msg_len, length;
3476 * Yes. The frame begins with a 4-byte big-endian length.
3477 * And we know we have at least 6 bytes
3481 * Get the SASL length, which is the length of data in the buffer
3482 * following the length (i.e., it's 4 less than the total length).
3484 * XXX - do we need to reassemble buffers? For now, we
3485 * assume that each LDAP message is entirely contained within
3488 sasl_len = tvb_get_ntohl(tvb, offset);
3489 sasl_msg_len = sasl_len + 4;
3490 if (sasl_msg_len < 4) {
3492 * The message length was probably so large that the total length
3495 * Report this as an error.
3497 show_reported_bounds_error(tvb, pinfo, tree);
3502 * Construct a tvbuff containing the amount of the payload we have
3503 * available. Make its reported length the amount of data in the PDU.
3505 * XXX - if reassembly isn't enabled. the subdissector will throw a
3506 * BoundsError exception, rather than a ReportedBoundsError exception.
3507 * We really want a tvbuff where the length is "length", the reported
3508 * length is "plen", and the "if the snapshot length were infinite"
3509 * length is the minimum of the reported length of the tvbuff handed
3510 * to us and "plen", with a new type of exception thrown if the offset
3511 * is within the reported length but beyond that third length, with
3512 * that exception getting the "Unreassembled Packet" error.
3514 length = length_remaining;
3515 if (length > sasl_msg_len) length = sasl_msg_len;
3516 sasl_tvb = tvb_new_subset(tvb, offset, length, sasl_msg_len);
3519 proto_tree_add_uint(ldap_tree, hf_ldap_sasl_buffer_length, sasl_tvb, 0, 4,
3522 sasl_item = proto_tree_add_text(ldap_tree, sasl_tvb, 0, sasl_msg_len, "SASL Buffer");
3523 sasl_tree = proto_item_add_subtree(sasl_item, ett_ldap_sasl_blob);
3526 if (ldap_info->auth_mech != NULL &&
3527 ((strcmp(ldap_info->auth_mech, "GSS-SPNEGO") == 0) ||
3528 /* auth_mech may have been set from the bind */
3529 (strcmp(ldap_info->auth_mech, "GSSAPI") == 0))) {
3530 tvbuff_t *gssapi_tvb, *plain_tvb = NULL, *decr_tvb= NULL;
3535 * This is GSS-API (using SPNEGO, but we should be done with
3536 * the negotiation by now).
3538 * Dissect the GSS_Wrap() token; it'll return the length of
3539 * the token, from which we compute the offset in the tvbuff at
3540 * which the plaintext data, i.e. the LDAP message, begins.
3542 length = tvb_length_remaining(sasl_tvb, 4);
3543 if ((guint)length > sasl_len)
3545 gssapi_tvb = tvb_new_subset(sasl_tvb, 4, length, sasl_len);
3547 /* Attempt decryption of the GSSAPI wrapped data if possible */
3548 pinfo->decrypt_gssapi_tvb=DECRYPT_GSSAPI_NORMAL;
3549 pinfo->gssapi_wrap_tvb=NULL;
3550 pinfo->gssapi_encrypted_tvb=NULL;
3551 pinfo->gssapi_decrypted_tvb=NULL;
3552 ver_len = call_dissector(gssapi_wrap_handle, gssapi_tvb, pinfo, sasl_tree);
3553 /* if we could unwrap, do a tvb shuffle */
3554 if(pinfo->gssapi_decrypted_tvb){
3555 decr_tvb=pinfo->gssapi_decrypted_tvb;
3558 pinfo->decrypt_gssapi_tvb=0;
3559 pinfo->gssapi_wrap_tvb=NULL;
3560 pinfo->gssapi_encrypted_tvb=NULL;
3561 pinfo->gssapi_decrypted_tvb=NULL;
3564 * if len is 0 it probably mean that we got a PDU that is not
3565 * aligned to the start of the segment.
3572 * if we don't have unwrapped data,
3573 * see if the wrapping involved encryption of the
3574 * data; if not, just use the plaintext data.
3577 if(!pinfo->gssapi_data_encrypted){
3578 plain_tvb = tvb_new_subset(gssapi_tvb, ver_len, -1, -1);
3583 proto_item *enc_item = NULL;
3584 proto_tree *enc_tree = NULL;
3587 * The LDAP message was encrypted in the packet, and has
3588 * been decrypted; dissect the decrypted LDAP message.
3590 if (check_col(pinfo->cinfo, COL_INFO)) {
3591 col_set_str(pinfo->cinfo, COL_INFO, "SASL GSS-API Privacy (decrypted): ");
3595 enc_item = proto_tree_add_text(sasl_tree, gssapi_tvb, ver_len, -1,
3596 "GSS-API Encrypted payload (%d byte%s)",
3598 plurality(sasl_len - ver_len, "", "s"));
3599 enc_tree = proto_item_add_subtree(enc_item, ett_ldap_payload);
3601 dissect_ldap_payload(decr_tvb, pinfo, enc_tree, ldap_info, is_mscldap);
3602 } else if (plain_tvb) {
3603 proto_item *plain_item = NULL;
3604 proto_tree *plain_tree = NULL;
3607 * The LDAP message wasn't encrypted in the packet;
3608 * dissect the plain LDAP message.
3610 if (check_col(pinfo->cinfo, COL_INFO)) {
3611 col_set_str(pinfo->cinfo, COL_INFO, "SASL GSS-API Integrity: ");
3615 plain_item = proto_tree_add_text(sasl_tree, gssapi_tvb, ver_len, -1,
3616 "GSS-API payload (%d byte%s)",
3618 plurality(sasl_len - ver_len, "", "s"));
3619 plain_tree = proto_item_add_subtree(plain_item, ett_ldap_payload);
3622 dissect_ldap_payload(plain_tvb, pinfo, plain_tree, ldap_info, is_mscldap);
3625 * The LDAP message was encrypted in the packet, and was
3626 * not decrypted; just show it as encrypted data.
3628 if (check_col(pinfo->cinfo, COL_INFO)) {
3629 col_add_fstr(pinfo->cinfo, COL_INFO, "SASL GSS-API Privacy: payload (%d byte%s)",
3631 plurality(sasl_len - ver_len, "", "s"));
3634 proto_tree_add_text(sasl_tree, gssapi_tvb, ver_len, -1,
3635 "GSS-API Encrypted payload (%d byte%s)",
3637 plurality(sasl_len - ver_len, "", "s"));
3641 offset += sasl_msg_len;
3643 /* plain LDAP, so dissect the payload */
3644 dissect_ldap_payload(tvb, pinfo, ldap_tree, ldap_info, is_mscldap);
3648 static int dissect_mscldap_string(tvbuff_t *tvb, int offset, char *str, int maxlen, gboolean prepend_dot)
3652 len=tvb_get_guint8(tvb, offset);
3657 /* add potential field separation dot */
3670 /* ops its a mscldap compressed string */
3672 new_offset=tvb_get_guint8(tvb, offset);
3673 if (new_offset == offset - 1)
3674 THROW(ReportedBoundsError);
3677 dissect_mscldap_string(tvb, new_offset, str, maxlen, FALSE);
3691 return offset; /* will mess up offset in caller, is unlikely */
3693 tvb_memcpy(tvb, str, offset, len);
3700 len=tvb_get_guint8(tvb, offset);
3708 /* These are the cldap DC flags
3709 http://msdn.microsoft.com/en-us/library/cc201036.aspx
3711 static const true_false_string tfs_ads_pdc = {
3715 static const true_false_string tfs_ads_gc = {
3716 "This is a GLOBAL CATALOGUE of forest",
3717 "This is NOT a global catalog of forest"
3719 static const true_false_string tfs_ads_ldap = {
3720 "This is an LDAP server",
3721 "This is NOT an ldap server"
3723 static const true_false_string tfs_ads_ds = {
3724 "This dc supports DS",
3725 "This dc does NOT support ds"
3727 static const true_false_string tfs_ads_kdc = {
3728 "This is a KDC (kerberos)",
3729 "This is NOT a kdc (kerberos)"
3731 static const true_false_string tfs_ads_timeserv = {
3732 "This dc is running TIME SERVICES (ntp)",
3733 "This dc is NOT running time services (ntp)"
3735 static const true_false_string tfs_ads_closest = {
3736 "This is the CLOSEST dc",
3737 "This is NOT the closest dc"
3739 static const true_false_string tfs_ads_writable = {
3740 "This dc is WRITABLE",
3741 "This dc is NOT writable"
3743 static const true_false_string tfs_ads_good_timeserv = {
3744 "This dc has a GOOD TIME SERVICE (i.e. hardware clock)",
3745 "This dc does NOT have a good time service (i.e. no hardware clock)"
3747 static const true_false_string tfs_ads_ndnc = {
3748 "Domain is NON-DOMAIN NC serviced by ldap server",
3749 "Domain is NOT non-domain nc serviced by ldap server"
3751 static const true_false_string tfs_ads_rodc = {
3752 "Domain controller is a Windows 2008 RODC",
3753 "Domain controller is not a Windows 2008 RODC"
3755 static const true_false_string tfs_ads_wdc = {
3756 "Domain controller is a Windows 2008 writable NC",
3757 "Domain controller is not a Windows 2008 writable NC"
3759 static const true_false_string tfs_ads_dns = {
3760 "Server name is in DNS format (Windows 2008)",
3761 "Server name is not in DNS format (Windows 2008)"
3763 static const true_false_string tfs_ads_dnc = {
3764 "The NC is the default NC (Windows 2008)",
3765 "The NC is not the default NC (Windows 2008)"
3767 static const true_false_string tfs_ads_fnc = {
3768 "The NC is the default forest NC(Windows 2008)",
3769 "The NC is not the default forest NC (Windows 2008)"
3771 static int dissect_mscldap_netlogon_flags(proto_tree *parent_tree, tvbuff_t *tvb, int offset)
3775 proto_tree *tree=NULL;
3777 hf_mscldap_netlogon_flags_fnc,
3778 hf_mscldap_netlogon_flags_dnc,
3779 hf_mscldap_netlogon_flags_dns,
3780 hf_mscldap_netlogon_flags_wdc,
3781 hf_mscldap_netlogon_flags_rodc,
3782 hf_mscldap_netlogon_flags_ndnc,
3783 hf_mscldap_netlogon_flags_good_timeserv,
3784 hf_mscldap_netlogon_flags_writable,
3785 hf_mscldap_netlogon_flags_closest,
3786 hf_mscldap_netlogon_flags_timeserv,
3787 hf_mscldap_netlogon_flags_kdc,
3788 hf_mscldap_netlogon_flags_ds,
3789 hf_mscldap_netlogon_flags_ldap,
3790 hf_mscldap_netlogon_flags_gc,
3791 hf_mscldap_netlogon_flags_pdc,
3794 header_field_info *hfi;
3795 gboolean one_bit_set = FALSE;
3797 flags=tvb_get_letohl(tvb, offset);
3798 item=proto_tree_add_item(parent_tree, hf_mscldap_netlogon_flags, tvb, offset, 4, TRUE);
3800 tree = proto_item_add_subtree(item, ett_mscldap_netlogon_flags);
3803 proto_item_append_text(item, " (");
3805 for(field = fields; *field; field++) {
3806 proto_tree_add_boolean(tree, *field, tvb, offset, 4, flags);
3807 hfi = proto_registrar_get_nth(*field);
3809 if(flags & hfi->bitmask) {
3812 proto_item_append_text(item, ", ");
3816 proto_item_append_text(item, hfi->name);
3821 proto_item_append_text(item, ")");
3828 static void dissect_NetLogon_PDU(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
3830 int old_offset, offset=0;
3843 /* Get the length of the buffer */
3844 len=tvb_length_remaining(tvb,offset);
3846 /* check the len if it is to small return */
3847 if (len < 10) return;
3850 itype = tvb_get_letohs(tvb, offset);
3852 /* get the version number from the end of the buffer, as the
3853 length is variable and the version determines what fields
3854 need to be decoded */
3856 version = tvb_get_letohl(tvb,len-8);
3860 case LOGON_SAM_LOGON_RESPONSE:
3862 proto_tree_add_uint_format(tree, hf_mscldap_netlogon_type, tvb,offset, 2, itype,"Type: LOGON_SAM_LOGON_RESPONSE (19)" );
3865 /* logon server name */
3866 fn = get_unicode_or_ascii_string(tvb,&offset,TRUE,&fn_len,FALSE,FALSE,&bc);
3867 proto_tree_add_string(tree, hf_mscldap_nb_hostname, tvb,offset, fn_len, fn);
3871 fn = get_unicode_or_ascii_string(tvb,&offset,TRUE,&fn_len,FALSE,FALSE,&bc);
3872 proto_tree_add_string(tree, hf_mscldap_username, tvb,offset, fn_len, fn);
3876 fn = get_unicode_or_ascii_string(tvb,&offset,TRUE,&fn_len,FALSE,FALSE,&bc);
3877 proto_tree_add_string(tree, hf_mscldap_nb_domain, tvb,offset, fn_len, fn);
3880 /* include the extra version 5 fields */
3881 if ((version & NETLOGON_NT_VERSION_5) == NETLOGON_NT_VERSION_5){
3884 proto_tree_add_item(tree, hf_mscldap_domain_guid, tvb, offset, 16, TRUE);
3887 /* domain guid part 2
3888 there is another 16 byte guid but this is alway zero, so we will skip it */
3893 offset=dissect_mscldap_string(tvb, offset, str, 255, FALSE);
3894 proto_tree_add_string(tree, hf_mscldap_forest, tvb, old_offset, offset-old_offset, str);
3898 offset=dissect_mscldap_string(tvb, offset, str, 255, FALSE);
3899 proto_tree_add_string(tree, hf_mscldap_domain, tvb, old_offset, offset-old_offset, str);
3903 offset=dissect_mscldap_string(tvb, offset, str, 255, FALSE);
3904 proto_tree_add_string(tree, hf_mscldap_hostname, tvb, old_offset, offset-old_offset, str);
3907 proto_tree_add_ipv4(tree, hf_mscldap_netlogon_ipaddress, tvb, offset, 4, tvb_get_ntohl(tvb,offset));
3911 offset = dissect_mscldap_netlogon_flags(tree, tvb, offset);
3917 case LOGON_SAM_LOGON_RESPONSE_EX:
3920 proto_tree_add_uint_format(tree, hf_mscldap_netlogon_type, tvb, offset, 2, itype,"Type: LOGON_SAM_LOGON_RESPONSE_EX (23)" );
3925 offset = dissect_mscldap_netlogon_flags(tree, tvb, offset);
3928 proto_tree_add_item(tree, hf_mscldap_domain_guid, tvb, offset, 16, TRUE);
3933 offset=dissect_mscldap_string(tvb, offset, str, 255, FALSE);
3934 proto_tree_add_string(tree, hf_mscldap_forest, tvb, old_offset, offset-old_offset, str);
3938 offset=dissect_mscldap_string(tvb, offset, str, 255, FALSE);
3939 proto_tree_add_string(tree, hf_mscldap_domain, tvb, old_offset, offset-old_offset, str);
3943 offset=dissect_mscldap_string(tvb, offset, str, 255, FALSE);
3944 proto_tree_add_string(tree, hf_mscldap_hostname, tvb, old_offset, offset-old_offset, str);
3946 /* NetBios Domain */
3948 offset=dissect_mscldap_string(tvb, offset, str, 255, FALSE);
3949 proto_tree_add_string(tree, hf_mscldap_nb_domain, tvb, old_offset, offset-old_offset, str);
3951 /* NetBios Hostname */
3953 offset=dissect_mscldap_string(tvb, offset, str, 255, FALSE);
3954 proto_tree_add_string(tree, hf_mscldap_nb_hostname, tvb, old_offset, offset-old_offset, str);
3958 offset=dissect_mscldap_string(tvb, offset, str, 255, FALSE);
3959 proto_tree_add_string(tree, hf_mscldap_username, tvb, old_offset, offset-old_offset, str);
3963 offset=dissect_mscldap_string(tvb, offset, str, 255, FALSE);
3964 proto_tree_add_string(tree, hf_mscldap_sitename, tvb, old_offset, offset-old_offset, str);
3968 offset=dissect_mscldap_string(tvb, offset, str, 255, FALSE);
3969 proto_tree_add_string(tree, hf_mscldap_clientsitename, tvb, old_offset, offset-old_offset, str);
3971 /* include the extra fields for version 5 with IP s */
3972 if ((version & NETLOGON_NT_VERSION_5EX_WITH_IP) == NETLOGON_NT_VERSION_5EX_WITH_IP){
3975 /* The ip address is returned as a sockaddr_in structure
3977 * This section may need to be updated if the base Windows APIs
3978 * are changed to support ipv6, which currently is not the case.
3980 * The desector assumes the length is based on ipv4 and
3981 * ignores the length
3984 /* skip the length of the sockaddr_in */
3988 /* add IP address and desect the sockaddr_in structure */
3990 old_offset = offset + 4;
3991 item = proto_tree_add_ipv4(tree, hf_mscldap_netlogon_ipaddress, tvb, old_offset, 4, tvb_get_ipv4(tvb,old_offset));
3994 proto_tree *subtree;
3996 subtree = proto_item_add_subtree(item, ett_mscldap_ipdetails);
3998 /* get sockaddr family */
3999 proto_tree_add_item(subtree, hf_mscldap_netlogon_ipaddress_family, tvb, offset, 2, TRUE);
4002 /* get sockaddr port */
4003 proto_tree_add_item(subtree, hf_mscldap_netlogon_ipaddress_port, tvb, offset, 2, TRUE);
4006 /* get IP address */
4007 proto_tree_add_ipv4(subtree, hf_mscldap_netlogon_ipaddress_ipv4, tvb, offset, 4, tvb_get_ipv4(tvb,offset));
4010 /* skip the 8 bytes of zeros in the sockaddr structure */
4019 proto_tree_add_uint_format(tree, hf_mscldap_netlogon_type, tvb, offset, 2, itype,"Type: Unknown type (%d)", itype );
4024 /* complete the decode with the version and token details */
4029 proto_tree_add_item(tree, hf_mscldap_netlogon_version, tvb, offset, 4, TRUE);
4033 proto_tree_add_item(tree, hf_mscldap_netlogon_lm_token, tvb, offset, 2, TRUE);
4037 proto_tree_add_item(tree, hf_mscldap_netlogon_nt_token, tvb, offset, 2, TRUE);
4044 get_sasl_ldap_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
4046 /* sasl encapsulated ldap is 4 bytes plus the length in size */
4047 return tvb_get_ntohl(tvb, offset)+4;
4051 dissect_sasl_ldap_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
4053 dissect_ldap_pdu(tvb, pinfo, tree, FALSE);
4058 get_normal_ldap_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
4064 /* normal ldap is tag+len bytes plus the length
4065 * offset is where the tag is
4066 * offset+1 is where length starts
4068 data_offset=get_ber_length(tvb, offset+1, &len, &ind);
4069 return len+data_offset-offset;
4073 dissect_normal_ldap_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
4075 dissect_ldap_pdu(tvb, pinfo, tree, FALSE);
4080 dissect_ldap_oid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
4083 const char *oidname;
4085 /* tvb here contains an ascii string that is really an oid */
4086 /* XXX we should convert the string oid into a real oid so we can use
4087 * proto_tree_add_oid() instead.
4090 oid=tvb_get_ephemeral_string(tvb, 0, tvb_length(tvb));
4095 oidname=oid_resolved_from_string(oid);
4098 proto_tree_add_text(tree, tvb, 0, tvb_length(tvb), "OID: %s (%s)",oid,oidname);
4100 proto_tree_add_text(tree, tvb, 0, tvb_length(tvb), "OID: %s",oid);
4104 #define LDAP_ACCESSMASK_ADS_CREATE_CHILD 0x00000001
4105 static const true_false_string ldap_AccessMask_ADS_CREATE_CHILD_tfs = {
4106 "ADS CREATE CHILD is SET",
4107 "Ads create child is NOT set",
4110 #define LDAP_ACCESSMASK_ADS_DELETE_CHILD 0x00000002
4111 static const true_false_string ldap_AccessMask_ADS_DELETE_CHILD_tfs = {
4112 "ADS DELETE CHILD is SET",
4113 "Ads delete child is NOT set",
4115 #define LDAP_ACCESSMASK_ADS_LIST 0x00000004
4116 static const true_false_string ldap_AccessMask_ADS_LIST_tfs = {
4118 "Ads list is NOT set",
4120 #define LDAP_ACCESSMASK_ADS_SELF_WRITE 0x00000008
4121 static const true_false_string ldap_AccessMask_ADS_SELF_WRITE_tfs = {
4122 "ADS SELF WRITE is SET",
4123 "Ads self write is NOT set",
4125 #define LDAP_ACCESSMASK_ADS_READ_PROP 0x00000010
4126 static const true_false_string ldap_AccessMask_ADS_READ_PROP_tfs = {
4127 "ADS READ PROP is SET",
4128 "Ads read prop is NOT set",
4130 #define LDAP_ACCESSMASK_ADS_WRITE_PROP 0x00000020
4131 static const true_false_string ldap_AccessMask_ADS_WRITE_PROP_tfs = {
4132 "ADS WRITE PROP is SET",
4133 "Ads write prop is NOT set",
4135 #define LDAP_ACCESSMASK_ADS_DELETE_TREE 0x00000040
4136 static const true_false_string ldap_AccessMask_ADS_DELETE_TREE_tfs = {
4137 "ADS DELETE TREE is SET",
4138 "Ads delete tree is NOT set",
4140 #define LDAP_ACCESSMASK_ADS_LIST_OBJECT 0x00000080
4141 static const true_false_string ldap_AccessMask_ADS_LIST_OBJECT_tfs = {
4142 "ADS LIST OBJECT is SET",
4143 "Ads list object is NOT set",
4145 #define LDAP_ACCESSMASK_ADS_CONTROL_ACCESS 0x00000100
4146 static const true_false_string ldap_AccessMask_ADS_CONTROL_ACCESS_tfs = {
4147 "ADS CONTROL ACCESS is SET",
4148 "Ads control access is NOT set",
4152 ldap_specific_rights(tvbuff_t *tvb, gint offset, proto_tree *tree, guint32 access)
4154 proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_CONTROL_ACCESS, tvb, offset, 4, access);
4156 proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_LIST_OBJECT, tvb, offset, 4, access);
4158 proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_DELETE_TREE, tvb, offset, 4, access);
4160 proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_WRITE_PROP, tvb, offset, 4, access);
4162 proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_READ_PROP, tvb, offset, 4, access);
4164 proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_SELF_WRITE, tvb, offset, 4, access);
4166 proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_LIST, tvb, offset, 4, access);
4168 proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_DELETE_CHILD, tvb, offset, 4, access);
4170 proto_tree_add_boolean(tree, hf_ldap_AccessMask_ADS_CREATE_CHILD, tvb, offset, 4, access);
4172 struct access_mask_info ldap_access_mask_info = {
4173 "LDAP", /* Name of specific rights */
4174 ldap_specific_rights, /* Dissection function */
4175 NULL, /* Generic mapping table */
4176 NULL /* Standard mapping table */
4180 dissect_ldap_nt_sec_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
4182 dissect_nt_sec_desc(tvb, 0, pinfo, tree, NULL, TRUE, tvb_length(tvb), &ldap_access_mask_info);
4186 dissect_ldap_sid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
4190 /* this octet string contains an NT SID */
4191 dissect_nt_sid(tvb, 0, tree, "SID", &tmpstr, hf_ldap_sid);
4192 ldapvalue_string=tmpstr;
4196 dissect_ldap_guid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
4198 guint8 drep[4] = { 0x10, 0x00, 0x00, 0x00}; /* fake DREP struct */
4201 /* This octet string contained a GUID */
4202 dissect_dcerpc_uuid_t(tvb, 0, pinfo, tree, drep, hf_ldap_guid, &uuid);
4204 ldapvalue_string=ep_alloc(1024);
4205 g_snprintf(ldapvalue_string, 1023, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
4206 uuid.Data1, uuid.Data2, uuid.Data3,
4207 uuid.Data4[0], uuid.Data4[1],
4208 uuid.Data4[2], uuid.Data4[3],
4209 uuid.Data4[4], uuid.Data4[5],
4210 uuid.Data4[6], uuid.Data4[7]);
4214 dissect_ldap_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
4220 conversation_t *conversation;
4221 ldap_conv_info_t *ldap_info = NULL;
4224 * Do we have a conversation for this connection?
4226 conversation = find_conversation(pinfo->fd->num,
4227 &pinfo->src, &pinfo->dst,
4228 pinfo->ptype, pinfo->srcport,
4229 pinfo->destport, 0);
4231 ldap_info = conversation_get_proto_data(conversation, proto_ldap);
4236 /* This is a bit tricky. We have to find out whether SASL is used
4237 * so that we know how big a header we are supposed to pass
4238 * to tcp_dissect_pdus()
4239 * We must also cope with the case when a client connects to LDAP
4240 * and performs a few unauthenticated searches of LDAP before
4241 * it performs the bind on the same tcp connection.
4243 /* check for a SASL header, i.e. assume it is SASL if
4244 * 1, first four bytes (SASL length) is an integer
4245 * with a value that must be <LDAP_SASL_MAX_BUF and >2
4246 * (>2 to fight false positives, 0x00000000 is a common
4247 * "random" tcp payload)
4248 * (SASL ldap PDUs might be >64k in size, which is why
4249 * LDAP_SASL_MAX_BUF is used - defined in packet-ldap.h)
4251 * 2, we must have a conversation and the auth type must
4254 sasl_len=tvb_get_ntohl(tvb, 0);
4257 goto this_was_not_sasl;
4260 if( sasl_len>LDAP_SASL_MAX_BUF ){
4261 goto this_was_not_sasl;
4264 if((!ldap_info) || (ldap_info->auth_type!=LDAP_AUTH_SASL) ){
4265 goto this_was_not_sasl;
4268 tcp_dissect_pdus(tvb, pinfo, tree, ldap_desegment, 4, get_sasl_ldap_pdu_len, dissect_sasl_ldap_pdu);
4272 /* check if it is a normal BER encoded LDAP packet
4273 * i.e. first byte is 0x30 followed by a length that is
4275 * (no ldap PDUs are ever >64kb? )
4277 if(tvb_get_guint8(tvb, 0)!=0x30){
4278 goto this_was_not_normal_ldap;
4281 /* check that length makes sense */
4282 offset=get_ber_length(tvb, 1, &ldap_len, &ind);
4284 /* dont check ind since indefinite length is never used for ldap (famous last words)*/
4286 goto this_was_not_normal_ldap;
4289 tcp_dissect_pdus(tvb, pinfo, tree, ldap_desegment, 4, get_normal_ldap_pdu_len, dissect_normal_ldap_pdu);
4293 this_was_not_normal_ldap:
4295 /* perhaps it was SSL? */
4297 ldap_info->start_tls_frame &&
4298 ( pinfo->fd->num >= ldap_info->start_tls_frame)) {
4300 /* we have started TLS and so this may be an SSL layer */
4301 guint32 old_start_tls_frame;
4303 /* temporarily dissect this port as SSL */
4304 dissector_delete("tcp.port", tcp_port, ldap_handle);
4305 ssl_dissector_add(tcp_port, "ldap", TRUE);
4307 old_start_tls_frame = ldap_info->start_tls_frame;
4308 ldap_info->start_tls_frame = 0; /* make sure we don't call SSL again */
4309 pinfo->can_desegment++; /* ignore this LDAP layer so SSL can use the TCP resegment */
4311 offset = call_dissector(ssl_handle, tvb, pinfo, tree);
4313 ldap_info->start_tls_frame = old_start_tls_frame;
4314 ssl_dissector_delete(tcp_port, "ldap", TRUE);
4316 /* restore ldap as the dissector for this port */
4317 dissector_add("tcp.port", tcp_port, ldap_handle);
4327 dissect_mscldap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
4329 dissect_ldap_pdu(tvb, pinfo, tree, TRUE);
4337 ldap_conv_info_t *ldap_info;
4339 /* Free up state attached to the ldap_info structures */
4340 for (ldap_info = ldap_info_items; ldap_info != NULL; ) {
4341 ldap_conv_info_t *next;
4343 if (ldap_info->auth_mech != NULL) {
4344 g_free(ldap_info->auth_mech);
4345 ldap_info->auth_mech=NULL;
4347 g_hash_table_destroy(ldap_info->matched);
4348 ldap_info->matched=NULL;
4349 g_hash_table_destroy(ldap_info->unmatched);
4350 ldap_info->unmatched=NULL;
4352 next = ldap_info->next;
4357 ldap_info_items = NULL;
4358 last_frame_seen = 0;
4363 register_ldap_name_dissector_handle(const char *attr_type, dissector_handle_t dissector)
4365 dissector_add_string("ldap.name", attr_type, dissector);
4369 register_ldap_name_dissector(const char *attr_type, dissector_t dissector, int proto)
4371 dissector_handle_t dissector_handle;
4373 dissector_handle=create_dissector_handle(dissector, proto);
4374 register_ldap_name_dissector_handle(attr_type, dissector_handle);
4378 /*--- proto_register_ldap -------------------------------------------*/
4379 void proto_register_ldap(void) {
4381 /* List of fields */
4383 static hf_register_info hf[] = {
4385 { &hf_ldap_sasl_buffer_length,
4386 { "SASL Buffer Length", "ldap.sasl_buffer_length",
4387 FT_UINT32, BASE_DEC, NULL, 0x0,
4388 "SASL Buffer Length", HFILL }},
4389 { &hf_ldap_response_in,
4390 { "Response In", "ldap.response_in",
4391 FT_FRAMENUM, BASE_DEC, NULL, 0x0,
4392 "The response to this LDAP request is in this frame", HFILL }},
4393 { &hf_ldap_response_to,
4394 { "Response To", "ldap.response_to",
4395 FT_FRAMENUM, BASE_DEC, NULL, 0x0,
4396 "This is a response to the LDAP request in this frame", HFILL }},
4398 { "Time", "ldap.time",
4399 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
4400 "The time between the Call and the Reply", HFILL }},
4402 { &hf_mscldap_netlogon_type,
4403 { "Type", "mscldap.netlogon.type",
4404 FT_UINT16, BASE_DEC, NULL, 0x0,
4405 "NetLogon Response type", HFILL }},
4407 { &hf_mscldap_netlogon_version,
4408 { "Version", "mscldap.netlogon.version",
4409 FT_UINT32, BASE_DEC, NULL, 0x0,
4410 "Version", HFILL }},
4412 { &hf_mscldap_netlogon_ipaddress_family,
4413 { "Family", "mscldap.netlogon.ipaddress.family",
4414 FT_UINT16, BASE_DEC, NULL, 0x0,
4417 { &hf_mscldap_netlogon_ipaddress_ipv4,
4418 { "IPv4", "mscldap.netlogon.ipaddress.ipv4",
4419 FT_IPv4, BASE_DEC, NULL, 0x0,
4420 "IP Address", HFILL }},
4422 { &hf_mscldap_netlogon_ipaddress_port,
4423 { "Port", "mscldap.netlogon.ipaddress.port",
4424 FT_UINT16, BASE_DEC, NULL, 0x0,
4427 { &hf_mscldap_netlogon_ipaddress,
4428 { "IP Address","mscldap.netlogon.ipaddress",
4429 FT_IPv4, BASE_NONE, NULL, 0x0,
4430 "Domain Controller IP Address ", HFILL }},
4432 { &hf_mscldap_netlogon_lm_token,
4433 { "LM Token", "mscldap.netlogon.lm_token",
4434 FT_UINT16, BASE_HEX, NULL, 0x0,
4435 "LM Token", HFILL }},
4437 { &hf_mscldap_netlogon_nt_token,
4438 { "NT Token", "mscldap.netlogon.nt_token",
4439 FT_UINT16, BASE_HEX, NULL, 0x0,
4440 "NT Token", HFILL }},
4442 { &hf_mscldap_netlogon_flags,
4443 { "Flags", "mscldap.netlogon.flags",
4444 FT_UINT32, BASE_HEX, NULL, 0x0,
4445 "Netlogon flags describing the DC properties", HFILL }},
4447 { &hf_mscldap_ntver_flags,
4448 { "Search Flags", "mscldap.ntver.searchflags",
4449 FT_UINT32, BASE_HEX, NULL, 0x0,
4450 "cldap Netlogon request flags", HFILL }},
4452 { &hf_mscldap_domain_guid,
4453 { "Domain GUID", "mscldap.domain.guid",
4454 FT_BYTES, BASE_HEX, NULL, 0x0,
4455 "Domain GUID", HFILL }},
4457 { &hf_mscldap_forest,
4458 { "Forest", "mscldap.forest",
4459 FT_STRING, BASE_NONE, NULL, 0x0,
4462 { &hf_mscldap_domain,
4463 { "Domain", "mscldap.domain",
4464 FT_STRING, BASE_NONE, NULL, 0x0,
4465 "Domainname", HFILL }},
4467 { &hf_mscldap_hostname,
4468 { "Hostname", "mscldap.hostname",
4469 FT_STRING, BASE_NONE, NULL, 0x0,
4470 "Hostname", HFILL }},
4472 { &hf_mscldap_nb_domain,
4473 { "NetBios Domain", "mscldap.nb_domain",
4474 FT_STRING, BASE_NONE, NULL, 0x0,
4475 "NetBios Domainname", HFILL }},
4477 { &hf_mscldap_nb_hostname,
4478 { "NetBios Hostname", "mscldap.nb_hostname",
4479 FT_STRING, BASE_NONE, NULL, 0x0,
4480 "NetBios Hostname", HFILL }},
4482 { &hf_mscldap_username,
4483 { "Username", "mscldap.username",
4484 FT_STRING, BASE_NONE, NULL, 0x0,
4485 "User name", HFILL }},
4487 { &hf_mscldap_sitename,
4488 { "Site", "mscldap.sitename",
4489 FT_STRING, BASE_NONE, NULL, 0x0,
4490 "Site name", HFILL }},
4492 { &hf_mscldap_clientsitename,
4493 { "Client Site", "mscldap.clientsitename",
4494 FT_STRING, BASE_NONE, NULL, 0x0,
4495 "Client Site name", HFILL }},
4498 { "Sid", "ldap.sid",
4499 FT_STRING, BASE_NONE, NULL, 0x0,
4502 { &hf_mscldap_ntver_flags_v5cs,
4503 { "V5CS", "mscldap.ntver.searchflags.v5cs", FT_BOOLEAN, 32,
4504 TFS(&tfs_ntver_v5cs), 0x00000010, "", HFILL }},
4506 { &hf_mscldap_ntver_flags_v5ip,
4507 { "V5IP", "mscldap.ntver.searchflags.v5ip", FT_BOOLEAN, 32,
4508 TFS(&tfs_ntver_v5ip), 0x00000008, "", HFILL }},
4510 { &hf_mscldap_ntver_flags_v5ex,
4511 { "V5EX", "mscldap.ntver.searchflags.v5ex", FT_BOOLEAN, 32,
4512 TFS(&tfs_ntver_v5ex), 0x00000004, "", HFILL }},
4514 { &hf_mscldap_ntver_flags_v5,
4515 { "V5", "mscldap.ntver.searchflags.v5", FT_BOOLEAN, 32,
4516 TFS(&tfs_ntver_v5), 0x00000002, "", HFILL }},
4518 { &hf_mscldap_ntver_flags_v1,
4519 { "V1", "mscldap.ntver.searchflags.v1", FT_BOOLEAN, 32,
4520 TFS(&tfs_ntver_v1), 0x00000001, "", HFILL }},
4522 { &hf_mscldap_ntver_flags_gc,
4523 { "GC", "mscldap.ntver.searchflags.gc", FT_BOOLEAN, 32,
4524 TFS(&tfs_ntver_gc), 0x80000000, "", HFILL }},
4526 { &hf_mscldap_ntver_flags_local,
4527 { "Local", "mscldap.ntver.searchflags.local", FT_BOOLEAN, 32,
4528 TFS(&tfs_ntver_local), 0x40000000, "", HFILL }},
4530 { &hf_mscldap_ntver_flags_ip,
4531 { "IP", "mscldap.ntver.searchflags.ip", FT_BOOLEAN, 32,
4532 TFS(&tfs_ntver_ip), 0x20000000, "", HFILL }},
4534 { &hf_mscldap_ntver_flags_pdc,
4535 { "PDC", "mscldap.ntver.searchflags.pdc", FT_BOOLEAN, 32,
4536 TFS(&tfs_ntver_pdc), 0x10000000, "", HFILL }},
4538 { &hf_mscldap_ntver_flags_nt4,
4539 { "NT4", "mscldap.ntver.searchflags.nt4", FT_BOOLEAN, 32,
4540 TFS(&tfs_ntver_nt4), 0x01000000, "", HFILL }},
4542 { &hf_mscldap_netlogon_flags_pdc,
4543 { "PDC", "mscldap.netlogon.flags.pdc", FT_BOOLEAN, 32,
4544 TFS(&tfs_ads_pdc), 0x00000001, "Is this DC a PDC or not?", HFILL }},
4546 { &hf_mscldap_netlogon_flags_gc,
4547 { "GC", "mscldap.netlogon.flags.gc", FT_BOOLEAN, 32,
4548 TFS(&tfs_ads_gc), 0x00000004, "Does this dc service as a GLOBAL CATALOGUE?", HFILL }},
4550 { &hf_mscldap_netlogon_flags_ldap,
4551 { "LDAP", "mscldap.netlogon.flags.ldap", FT_BOOLEAN, 32,
4552 TFS(&tfs_ads_ldap), 0x00000008, "Does this DC act as an LDAP server?", HFILL }},
4554 { &hf_mscldap_netlogon_flags_ds,
4555 { "DS", "mscldap.netlogon.flags.ds", FT_BOOLEAN, 32,
4556 TFS(&tfs_ads_ds), 0x00000010, "Does this dc provide DS services?", HFILL }},
4558 { &hf_mscldap_netlogon_flags_kdc,
4559 { "KDC", "mscldap.netlogon.flags.kdc", FT_BOOLEAN, 32,
4560 TFS(&tfs_ads_kdc), 0x00000020, "Does this dc act as a KDC?", HFILL }},
4562 { &hf_mscldap_netlogon_flags_timeserv,
4563 { "Time Serv", "mscldap.netlogon.flags.timeserv", FT_BOOLEAN, 32,
4564 TFS(&tfs_ads_timeserv), 0x00000040, "Does this dc provide time services (ntp) ?", HFILL }},
4566 { &hf_mscldap_netlogon_flags_closest,
4567 { "Closest", "mscldap.netlogon.flags.closest", FT_BOOLEAN, 32,
4568 TFS(&tfs_ads_closest), 0x00000080, "Is this the closest dc?", HFILL }},
4570 { &hf_mscldap_netlogon_flags_writable,
4571 { "Writable", "mscldap.netlogon.flags.writable", FT_BOOLEAN, 32,
4572 TFS(&tfs_ads_writable), 0x00000100, "Is this dc writable?", HFILL }},
4574 { &hf_mscldap_netlogon_flags_good_timeserv,
4575 { "Good Time Serv", "mscldap.netlogon.flags.good_timeserv", FT_BOOLEAN, 32,
4576 TFS(&tfs_ads_good_timeserv), 0x00000200, "Is this a Good Time Server? (i.e. does it have a hardware clock)", HFILL }},
4578 { &hf_mscldap_netlogon_flags_ndnc,
4579 { "NDNC", "mscldap.netlogon.flags.ndnc", FT_BOOLEAN, 32,
4580 TFS(&tfs_ads_ndnc), 0x00000400, "Is this an NDNC dc?", HFILL }},
4582 { &hf_mscldap_netlogon_flags_rodc,
4583 { "RODC", "mscldap.netlogon.flags.rodc", FT_BOOLEAN, 32,
4584 TFS(&tfs_ads_rodc), 0x00000800, "Is this an read only dc?", HFILL }},
4586 { &hf_mscldap_netlogon_flags_wdc,
4587 { "WDC", "mscldap.netlogon.flags.writabledc.", FT_BOOLEAN, 32,
4588 TFS(&tfs_ads_wdc), 0x00001000, "Is this an writable dc (Windows 2008)?", HFILL }},
4590 { &hf_mscldap_netlogon_flags_dns,
4591 { "DNS", "mscldap.netlogon.flags.dnsname", FT_BOOLEAN, 32,
4592 TFS(&tfs_ads_dns), 0x20000000, "Does the server have a dns name (Windows 2008)?", HFILL }},
4594 { &hf_mscldap_netlogon_flags_dnc,
4595 { "DNC", "mscldap.netlogon.flags.defaultnc", FT_BOOLEAN, 32,
4596 TFS(&tfs_ads_dnc), 0x40000000, "Is this the default NC (Windows 2008)?", HFILL }},
4598 { &hf_mscldap_netlogon_flags_fnc,
4599 { "FDC", "mscldap.netlogon.flags.forestnc", FT_BOOLEAN, 32,
4600 TFS(&tfs_ads_fnc), 0x80000000, "Is the the NC the default forest root(Windows 2008)?", HFILL }},
4603 { "GUID", "ldap.guid", FT_GUID, BASE_NONE,
4604 NULL, 0, "GUID", HFILL }},
4606 { &hf_ldap_AccessMask_ADS_CREATE_CHILD,
4607 { "Create Child", "ldap.AccessMask.ADS_CREATE_CHILD", FT_BOOLEAN, 32, TFS(&ldap_AccessMask_ADS_CREATE_CHILD_tfs), LDAP_ACCESSMASK_ADS_CREATE_CHILD, "", HFILL }},
4609 { &hf_ldap_AccessMask_ADS_DELETE_CHILD,
4610 { "Delete Child", "ldap.AccessMask.ADS_DELETE_CHILD", FT_BOOLEAN, 32, TFS(&ldap_AccessMask_ADS_DELETE_CHILD_tfs), LDAP_ACCESSMASK_ADS_DELETE_CHILD, "", HFILL }},
4612 { &hf_ldap_AccessMask_ADS_LIST,
4613 { "List", "ldap.AccessMask.ADS_LIST", FT_BOOLEAN, 32, TFS(&ldap_AccessMask_ADS_LIST_tfs), LDAP_ACCESSMASK_ADS_LIST, "", HFILL }},
4615 { &hf_ldap_AccessMask_ADS_SELF_WRITE,
4616 { "Self Write", "ldap.AccessMask.ADS_SELF_WRITE", FT_BOOLEAN, 32, TFS(&ldap_AccessMask_ADS_SELF_WRITE_tfs), LDAP_ACCESSMASK_ADS_SELF_WRITE, "", HFILL }},
4618 { &hf_ldap_AccessMask_ADS_READ_PROP,
4619 { "Read Prop", "ldap.AccessMask.ADS_READ_PROP", FT_BOOLEAN, 32, TFS(&ldap_AccessMask_ADS_READ_PROP_tfs), LDAP_ACCESSMASK_ADS_READ_PROP, "", HFILL }},
4621 { &hf_ldap_AccessMask_ADS_WRITE_PROP,
4622 { "Write Prop", "ldap.AccessMask.ADS_WRITE_PROP", FT_BOOLEAN, 32, TFS(&ldap_AccessMask_ADS_WRITE_PROP_tfs), LDAP_ACCESSMASK_ADS_WRITE_PROP, "", HFILL }},
4624 { &hf_ldap_AccessMask_ADS_DELETE_TREE,
4625 { "Delete Tree", "ldap.AccessMask.ADS_DELETE_TREE", FT_BOOLEAN, 32, TFS(&ldap_AccessMask_ADS_DELETE_TREE_tfs), LDAP_ACCESSMASK_ADS_DELETE_TREE, "", HFILL }},
4627 { &hf_ldap_AccessMask_ADS_LIST_OBJECT,
4628 { "List Object", "ldap.AccessMask.ADS_LIST_OBJECT", FT_BOOLEAN, 32, TFS(&ldap_AccessMask_ADS_LIST_OBJECT_tfs), LDAP_ACCESSMASK_ADS_LIST_OBJECT, "", HFILL }},
4630 { &hf_ldap_AccessMask_ADS_CONTROL_ACCESS,
4631 { "Control Access", "ldap.AccessMask.ADS_CONTROL_ACCESS", FT_BOOLEAN, 32, TFS(&ldap_AccessMask_ADS_CONTROL_ACCESS_tfs), LDAP_ACCESSMASK_ADS_CONTROL_ACCESS, "", HFILL }},
4634 /*--- Included file: packet-ldap-hfarr.c ---*/
4635 #line 1 "packet-ldap-hfarr.c"
4636 { &hf_ldap_LDAPMessage_PDU,
4637 { "LDAPMessage", "ldap.LDAPMessage",
4638 FT_NONE, BASE_NONE, NULL, 0,
4639 "ldap.LDAPMessage", HFILL }},
4640 { &hf_ldap_SearchControlValue_PDU,
4641 { "SearchControlValue", "ldap.SearchControlValue",
4642 FT_NONE, BASE_NONE, NULL, 0,
4643 "ldap.SearchControlValue", HFILL }},
4644 { &hf_ldap_SortKeyList_PDU,
4645 { "SortKeyList", "ldap.SortKeyList",
4646 FT_UINT32, BASE_DEC, NULL, 0,
4647 "ldap.SortKeyList", HFILL }},
4648 { &hf_ldap_SortResult_PDU,
4649 { "SortResult", "ldap.SortResult",
4650 FT_NONE, BASE_NONE, NULL, 0,
4651 "ldap.SortResult", HFILL }},
4652 { &hf_ldap_ReplControlValue_PDU,
4653 { "ReplControlValue", "ldap.ReplControlValue",
4654 FT_NONE, BASE_NONE, NULL, 0,
4655 "ldap.ReplControlValue", HFILL }},
4656 { &hf_ldap_PasswdModifyRequestValue_PDU,
4657 { "PasswdModifyRequestValue", "ldap.PasswdModifyRequestValue",
4658 FT_NONE, BASE_NONE, NULL, 0,
4659 "ldap.PasswdModifyRequestValue", HFILL }},
4660 { &hf_ldap_CancelRequestValue_PDU,
4661 { "CancelRequestValue", "ldap.CancelRequestValue",
4662 FT_NONE, BASE_NONE, NULL, 0,
4663 "ldap.CancelRequestValue", HFILL }},
4664 { &hf_ldap_messageID,
4665 { "messageID", "ldap.messageID",
4666 FT_UINT32, BASE_DEC, NULL, 0,
4667 "ldap.MessageID", HFILL }},
4668 { &hf_ldap_protocolOp,
4669 { "protocolOp", "ldap.protocolOp",
4670 FT_UINT32, BASE_DEC, VALS(ldap_ProtocolOp_vals), 0,
4671 "ldap.ProtocolOp", HFILL }},
4672 { &hf_ldap_controls,
4673 { "controls", "ldap.controls",
4674 FT_UINT32, BASE_DEC, NULL, 0,
4675 "ldap.Controls", HFILL }},
4676 { &hf_ldap_bindRequest,
4677 { "bindRequest", "ldap.bindRequest",
4678 FT_NONE, BASE_NONE, NULL, 0,
4679 "ldap.BindRequest", HFILL }},
4680 { &hf_ldap_bindResponse,
4681 { "bindResponse", "ldap.bindResponse",
4682 FT_NONE, BASE_NONE, NULL, 0,
4683 "ldap.BindResponse", HFILL }},
4684 { &hf_ldap_unbindRequest,
4685 { "unbindRequest", "ldap.unbindRequest",
4686 FT_NONE, BASE_NONE, NULL, 0,
4687 "ldap.UnbindRequest", HFILL }},
4688 { &hf_ldap_searchRequest,
4689 { "searchRequest", "ldap.searchRequest",
4690 FT_NONE, BASE_NONE, NULL, 0,
4691 "ldap.SearchRequest", HFILL }},
4692 { &hf_ldap_searchResEntry,
4693 { "searchResEntry", "ldap.searchResEntry",
4694 FT_NONE, BASE_NONE, NULL, 0,
4695 "ldap.SearchResultEntry", HFILL }},
4696 { &hf_ldap_searchResDone,
4697 { "searchResDone", "ldap.searchResDone",
4698 FT_NONE, BASE_NONE, NULL, 0,
4699 "ldap.SearchResultDone", HFILL }},
4700 { &hf_ldap_searchResRef,
4701 { "searchResRef", "ldap.searchResRef",
4702 FT_UINT32, BASE_DEC, NULL, 0,
4703 "ldap.SearchResultReference", HFILL }},
4704 { &hf_ldap_modifyRequest,
4705 { "modifyRequest", "ldap.modifyRequest",
4706 FT_NONE, BASE_NONE, NULL, 0,
4707 "ldap.ModifyRequest", HFILL }},
4708 { &hf_ldap_modifyResponse,
4709 { "modifyResponse", "ldap.modifyResponse",
4710 FT_NONE, BASE_NONE, NULL, 0,
4711 "ldap.ModifyResponse", HFILL }},
4712 { &hf_ldap_addRequest,
4713 { "addRequest", "ldap.addRequest",
4714 FT_NONE, BASE_NONE, NULL, 0,
4715 "ldap.AddRequest", HFILL }},
4716 { &hf_ldap_addResponse,
4717 { "addResponse", "ldap.addResponse",
4718 FT_NONE, BASE_NONE, NULL, 0,
4719 "ldap.AddResponse", HFILL }},
4720 { &hf_ldap_delRequest,
4721 { "delRequest", "ldap.delRequest",
4722 FT_STRING, BASE_NONE, NULL, 0,
4723 "ldap.DelRequest", HFILL }},
4724 { &hf_ldap_delResponse,
4725 { "delResponse", "ldap.delResponse",
4726 FT_NONE, BASE_NONE, NULL, 0,
4727 "ldap.DelResponse", HFILL }},
4728 { &hf_ldap_modDNRequest,
4729 { "modDNRequest", "ldap.modDNRequest",
4730 FT_NONE, BASE_NONE, NULL, 0,
4731 "ldap.ModifyDNRequest", HFILL }},
4732 { &hf_ldap_modDNResponse,
4733 { "modDNResponse", "ldap.modDNResponse",
4734 FT_NONE, BASE_NONE, NULL, 0,
4735 "ldap.ModifyDNResponse", HFILL }},
4736 { &hf_ldap_compareRequest,
4737 { "compareRequest", "ldap.compareRequest",
4738 FT_NONE, BASE_NONE, NULL, 0,
4739 "ldap.CompareRequest", HFILL }},
4740 { &hf_ldap_compareResponse,
4741 { "compareResponse", "ldap.compareResponse",
4742 FT_NONE, BASE_NONE, NULL, 0,
4743 "ldap.CompareResponse", HFILL }},
4744 { &hf_ldap_abandonRequest,
4745 { "abandonRequest", "ldap.abandonRequest",
4746 FT_UINT32, BASE_DEC, NULL, 0,
4747 "ldap.AbandonRequest", HFILL }},
4748 { &hf_ldap_extendedReq,
4749 { "extendedReq", "ldap.extendedReq",
4750 FT_NONE, BASE_NONE, NULL, 0,
4751 "ldap.ExtendedRequest", HFILL }},
4752 { &hf_ldap_extendedResp,
4753 { "extendedResp", "ldap.extendedResp",
4754 FT_NONE, BASE_NONE, NULL, 0,
4755 "ldap.ExtendedResponse", HFILL }},
4756 { &hf_ldap_AttributeDescriptionList_item,
4757 { "AttributeDescriptionList", "ldap.AttributeDescriptionList_item",
4758 FT_STRING, BASE_NONE, NULL, 0,
4759 "ldap.AttributeDescription", HFILL }},
4760 { &hf_ldap_attributeDesc,
4761 { "attributeDesc", "ldap.attributeDesc",
4762 FT_STRING, BASE_NONE, NULL, 0,
4763 "ldap.AttributeDescription", HFILL }},
4764 { &hf_ldap_assertionValue,
4765 { "assertionValue", "ldap.assertionValue",
4766 FT_STRING, BASE_NONE, NULL, 0,
4767 "ldap.AssertionValue", HFILL }},
4769 { "type", "ldap.type",
4770 FT_STRING, BASE_NONE, NULL, 0,
4771 "ldap.AttributeDescription", HFILL }},
4773 { "vals", "ldap.vals",
4774 FT_UINT32, BASE_DEC, NULL, 0,
4775 "ldap.SET_OF_AttributeValue", HFILL }},
4776 { &hf_ldap_vals_item,
4777 { "vals", "ldap.vals_item",
4778 FT_BYTES, BASE_HEX, NULL, 0,
4779 "ldap.AttributeValue", HFILL }},
4780 { &hf_ldap_resultCode,
4781 { "resultCode", "ldap.resultCode",
4782 FT_UINT32, BASE_DEC, VALS(ldap_T_resultCode_vals), 0,
4783 "ldap.T_resultCode", HFILL }},
4784 { &hf_ldap_matchedDN,
4785 { "matchedDN", "ldap.matchedDN",
4786 FT_STRING, BASE_NONE, NULL, 0,
4787 "ldap.LDAPDN", HFILL }},
4788 { &hf_ldap_errorMessage,
4789 { "errorMessage", "ldap.errorMessage",
4790 FT_STRING, BASE_NONE, NULL, 0,
4791 "ldap.ErrorMessage", HFILL }},
4792 { &hf_ldap_referral,
4793 { "referral", "ldap.referral",
4794 FT_UINT32, BASE_DEC, NULL, 0,
4795 "ldap.Referral", HFILL }},
4796 { &hf_ldap_Referral_item,
4797 { "Referral", "ldap.Referral_item",
4798 FT_STRING, BASE_NONE, NULL, 0,
4799 "ldap.LDAPURL", HFILL }},
4800 { &hf_ldap_Controls_item,
4801 { "Controls", "ldap.Controls_item",
4802 FT_NONE, BASE_NONE, NULL, 0,
4803 "ldap.Control", HFILL }},
4804 { &hf_ldap_controlType,
4805 { "controlType", "ldap.controlType",
4806 FT_STRING, BASE_NONE, NULL, 0,
4807 "ldap.ControlType", HFILL }},
4808 { &hf_ldap_criticality,
4809 { "criticality", "ldap.criticality",
4810 FT_BOOLEAN, 8, NULL, 0,
4811 "ldap.BOOLEAN", HFILL }},
4812 { &hf_ldap_controlValue,
4813 { "controlValue", "ldap.controlValue",
4814 FT_BYTES, BASE_HEX, NULL, 0,
4815 "ldap.T_controlValue", HFILL }},
4817 { "version", "ldap.version",
4818 FT_UINT32, BASE_DEC, NULL, 0,
4819 "ldap.INTEGER_1_127", HFILL }},
4821 { "name", "ldap.name",
4822 FT_STRING, BASE_NONE, NULL, 0,
4823 "ldap.LDAPDN", HFILL }},
4824 { &hf_ldap_authentication,
4825 { "authentication", "ldap.authentication",
4826 FT_UINT32, BASE_DEC, VALS(ldap_AuthenticationChoice_vals), 0,
4827 "ldap.AuthenticationChoice", HFILL }},
4829 { "simple", "ldap.simple",
4830 FT_BYTES, BASE_HEX, NULL, 0,
4831 "ldap.Simple", HFILL }},
4833 { "sasl", "ldap.sasl",
4834 FT_NONE, BASE_NONE, NULL, 0,
4835 "ldap.SaslCredentials", HFILL }},
4836 { &hf_ldap_ntlmsspNegotiate,
4837 { "ntlmsspNegotiate", "ldap.ntlmsspNegotiate",
4838 FT_BYTES, BASE_HEX, NULL, 0,
4839 "ldap.T_ntlmsspNegotiate", HFILL }},
4840 { &hf_ldap_ntlmsspAuth,
4841 { "ntlmsspAuth", "ldap.ntlmsspAuth",
4842 FT_BYTES, BASE_HEX, NULL, 0,
4843 "ldap.T_ntlmsspAuth", HFILL }},
4844 { &hf_ldap_mechanism,
4845 { "mechanism", "ldap.mechanism",
4846 FT_STRING, BASE_NONE, NULL, 0,
4847 "ldap.Mechanism", HFILL }},
4848 { &hf_ldap_credentials,
4849 { "credentials", "ldap.credentials",
4850 FT_BYTES, BASE_HEX, NULL, 0,
4851 "ldap.Credentials", HFILL }},
4852 { &hf_ldap_bindResponse_resultCode,
4853 { "resultCode", "ldap.resultCode",
4854 FT_UINT32, BASE_DEC, VALS(ldap_BindResponse_resultCode_vals), 0,
4855 "ldap.BindResponse_resultCode", HFILL }},
4856 { &hf_ldap_bindResponse_matchedDN,
4857 { "matchedDN", "ldap.matchedDN",
4858 FT_STRING, BASE_NONE, NULL, 0,
4859 "ldap.T_bindResponse_matchedDN", HFILL }},
4860 { &hf_ldap_serverSaslCreds,
4861 { "serverSaslCreds", "ldap.serverSaslCreds",
4862 FT_BYTES, BASE_HEX, NULL, 0,
4863 "ldap.ServerSaslCreds", HFILL }},
4864 { &hf_ldap_baseObject,
4865 { "baseObject", "ldap.baseObject",
4866 FT_STRING, BASE_NONE, NULL, 0,
4867 "ldap.LDAPDN", HFILL }},
4869 { "scope", "ldap.scope",
4870 FT_UINT32, BASE_DEC, VALS(ldap_T_scope_vals), 0,
4871 "ldap.T_scope", HFILL }},
4872 { &hf_ldap_derefAliases,
4873 { "derefAliases", "ldap.derefAliases",
4874 FT_UINT32, BASE_DEC, VALS(ldap_T_derefAliases_vals), 0,
4875 "ldap.T_derefAliases", HFILL }},
4876 { &hf_ldap_sizeLimit,
4877 { "sizeLimit", "ldap.sizeLimit",
4878 FT_UINT32, BASE_DEC, NULL, 0,
4879 "ldap.INTEGER_0_maxInt", HFILL }},
4880 { &hf_ldap_timeLimit,
4881 { "timeLimit", "ldap.timeLimit",
4882 FT_UINT32, BASE_DEC, NULL, 0,
4883 "ldap.INTEGER_0_maxInt", HFILL }},
4884 { &hf_ldap_typesOnly,
4885 { "typesOnly", "ldap.typesOnly",
4886 FT_BOOLEAN, 8, NULL, 0,
4887 "ldap.BOOLEAN", HFILL }},
4889 { "filter", "ldap.filter",
4890 FT_UINT32, BASE_DEC, VALS(ldap_Filter_vals), 0,
4891 "ldap.T_filter", HFILL }},
4892 { &hf_ldap_searchRequest_attributes,
4893 { "attributes", "ldap.attributes",
4894 FT_UINT32, BASE_DEC, NULL, 0,
4895 "ldap.AttributeDescriptionList", HFILL }},
4897 { "and", "ldap.and",
4898 FT_UINT32, BASE_DEC, NULL, 0,
4899 "ldap.T_and", HFILL }},
4900 { &hf_ldap_and_item,
4901 { "and", "ldap.and_item",
4902 FT_UINT32, BASE_DEC, VALS(ldap_Filter_vals), 0,
4903 "ldap.T_and_item", HFILL }},
4906 FT_UINT32, BASE_DEC, NULL, 0,
4907 "ldap.T_or", HFILL }},
4909 { "or", "ldap.or_item",
4910 FT_UINT32, BASE_DEC, VALS(ldap_Filter_vals), 0,
4911 "ldap.T_or_item", HFILL }},
4913 { "not", "ldap.not",
4914 FT_UINT32, BASE_DEC, VALS(ldap_Filter_vals), 0,
4915 "ldap.T_not", HFILL }},
4916 { &hf_ldap_equalityMatch,
4917 { "equalityMatch", "ldap.equalityMatch",
4918 FT_NONE, BASE_NONE, NULL, 0,
4919 "ldap.T_equalityMatch", HFILL }},
4920 { &hf_ldap_substrings,
4921 { "substrings", "ldap.substrings",
4922 FT_NONE, BASE_NONE, NULL, 0,
4923 "ldap.SubstringFilter", HFILL }},
4924 { &hf_ldap_greaterOrEqual,
4925 { "greaterOrEqual", "ldap.greaterOrEqual",
4926 FT_NONE, BASE_NONE, NULL, 0,
4927 "ldap.T_greaterOrEqual", HFILL }},
4928 { &hf_ldap_lessOrEqual,
4929 { "lessOrEqual", "ldap.lessOrEqual",
4930 FT_NONE, BASE_NONE, NULL, 0,
4931 "ldap.T_lessOrEqual", HFILL }},
4933 { "present", "ldap.present",
4934 FT_STRING, BASE_NONE, NULL, 0,
4935 "ldap.T_present", HFILL }},
4936 { &hf_ldap_approxMatch,
4937 { "approxMatch", "ldap.approxMatch",
4938 FT_NONE, BASE_NONE, NULL, 0,
4939 "ldap.T_approxMatch", HFILL }},
4940 { &hf_ldap_extensibleMatch,
4941 { "extensibleMatch", "ldap.extensibleMatch",
4942 FT_NONE, BASE_NONE, NULL, 0,
4943 "ldap.T_extensibleMatch", HFILL }},
4944 { &hf_ldap_substringFilter_substrings,
4945 { "substrings", "ldap.substrings",
4946 FT_UINT32, BASE_DEC, NULL, 0,
4947 "ldap.T_substringFilter_substrings", HFILL }},
4948 { &hf_ldap_substringFilter_substrings_item,
4949 { "substrings", "ldap.substrings_item",
4950 FT_UINT32, BASE_DEC, VALS(ldap_T_substringFilter_substrings_item_vals), 0,
4951 "ldap.T_substringFilter_substrings_item", HFILL }},
4953 { "initial", "ldap.initial",
4954 FT_STRING, BASE_NONE, NULL, 0,
4955 "ldap.LDAPString", HFILL }},
4957 { "any", "ldap.any",
4958 FT_STRING, BASE_NONE, NULL, 0,
4959 "ldap.LDAPString", HFILL }},
4961 { "final", "ldap.final",
4962 FT_STRING, BASE_NONE, NULL, 0,
4963 "ldap.LDAPString", HFILL }},
4964 { &hf_ldap_matchingRule,
4965 { "matchingRule", "ldap.matchingRule",
4966 FT_STRING, BASE_NONE, NULL, 0,
4967 "ldap.MatchingRuleId", HFILL }},
4968 { &hf_ldap_matchValue,
4969 { "matchValue", "ldap.matchValue",
4970 FT_STRING, BASE_NONE, NULL, 0,
4971 "ldap.AssertionValue", HFILL }},
4972 { &hf_ldap_dnAttributes,
4973 { "dnAttributes", "ldap.dnAttributes",
4974 FT_BOOLEAN, 8, NULL, 0,
4975 "ldap.T_dnAttributes", HFILL }},
4976 { &hf_ldap_objectName,
4977 { "objectName", "ldap.objectName",
4978 FT_STRING, BASE_NONE, NULL, 0,
4979 "ldap.LDAPDN", HFILL }},
4980 { &hf_ldap_searchResultEntry_attributes,
4981 { "attributes", "ldap.attributes",
4982 FT_UINT32, BASE_DEC, NULL, 0,
4983 "ldap.PartialAttributeList", HFILL }},
4984 { &hf_ldap_PartialAttributeList_item,
4985 { "PartialAttributeList", "ldap.PartialAttributeList_item",
4986 FT_NONE, BASE_NONE, NULL, 0,
4987 "ldap.PartialAttributeList_item", HFILL }},
4988 { &hf_ldap__untag_item,
4989 { "_untag", "ldap._untag_item",
4990 FT_STRING, BASE_NONE, NULL, 0,
4991 "ldap.LDAPURL", HFILL }},
4993 { "object", "ldap.object",
4994 FT_STRING, BASE_NONE, NULL, 0,
4995 "ldap.LDAPDN", HFILL }},
4996 { &hf_ldap_modifyRequest_modification,
4997 { "modification", "ldap.modification",
4998 FT_UINT32, BASE_DEC, NULL, 0,
4999 "ldap.ModifyRequest_modification", HFILL }},
5000 { &hf_ldap_modifyRequest_modification_item,
5001 { "modification", "ldap.modification_item",
5002 FT_NONE, BASE_NONE, NULL, 0,
5003 "ldap.T_modifyRequest_modification_item", HFILL }},
5004 { &hf_ldap_operation,
5005 { "operation", "ldap.operation",
5006 FT_UINT32, BASE_DEC, VALS(ldap_T_operation_vals), 0,
5007 "ldap.T_operation", HFILL }},
5008 { &hf_ldap_modification,
5009 { "modification", "ldap.modification",
5010 FT_NONE, BASE_NONE, NULL, 0,
5011 "ldap.AttributeTypeAndValues", HFILL }},
5013 { "entry", "ldap.entry",
5014 FT_STRING, BASE_NONE, NULL, 0,
5015 "ldap.LDAPDN", HFILL }},
5016 { &hf_ldap_attributes,
5017 { "attributes", "ldap.attributes",
5018 FT_UINT32, BASE_DEC, NULL, 0,
5019 "ldap.AttributeList", HFILL }},
5020 { &hf_ldap_AttributeList_item,
5021 { "AttributeList", "ldap.AttributeList_item",
5022 FT_NONE, BASE_NONE, NULL, 0,
5023 "ldap.AttributeList_item", HFILL }},
5025 { "newrdn", "ldap.newrdn",
5026 FT_STRING, BASE_NONE, NULL, 0,
5027 "ldap.RelativeLDAPDN", HFILL }},
5028 { &hf_ldap_deleteoldrdn,
5029 { "deleteoldrdn", "ldap.deleteoldrdn",
5030 FT_BOOLEAN, 8, NULL, 0,
5031 "ldap.BOOLEAN", HFILL }},
5032 { &hf_ldap_newSuperior,
5033 { "newSuperior", "ldap.newSuperior",
5034 FT_STRING, BASE_NONE, NULL, 0,
5035 "ldap.LDAPDN", HFILL }},
5037 { "ava", "ldap.ava",
5038 FT_NONE, BASE_NONE, NULL, 0,
5039 "ldap.AttributeValueAssertion", HFILL }},
5040 { &hf_ldap_requestName,
5041 { "requestName", "ldap.requestName",
5042 FT_STRING, BASE_NONE, NULL, 0,
5043 "ldap.LDAPOID", HFILL }},
5044 { &hf_ldap_requestValue,
5045 { "requestValue", "ldap.requestValue",
5046 FT_BYTES, BASE_HEX, NULL, 0,
5047 "ldap.T_requestValue", HFILL }},
5048 { &hf_ldap_extendedResponse_resultCode,
5049 { "resultCode", "ldap.resultCode",
5050 FT_UINT32, BASE_DEC, VALS(ldap_ExtendedResponse_resultCode_vals), 0,
5051 "ldap.ExtendedResponse_resultCode", HFILL }},
5052 { &hf_ldap_responseName,
5053 { "responseName", "ldap.responseName",
5054 FT_STRING, BASE_NONE, NULL, 0,
5055 "ldap.ResponseName", HFILL }},
5056 { &hf_ldap_response,
5057 { "response", "ldap.response",
5058 FT_BYTES, BASE_HEX, NULL, 0,
5059 "ldap.OCTET_STRING", HFILL }},
5061 { "size", "ldap.size",
5062 FT_INT32, BASE_DEC, NULL, 0,
5063 "ldap.INTEGER", HFILL }},
5065 { "cookie", "ldap.cookie",
5066 FT_BYTES, BASE_HEX, NULL, 0,
5067 "ldap.OCTET_STRING", HFILL }},
5068 { &hf_ldap_SortKeyList_item,
5069 { "SortKeyList", "ldap.SortKeyList_item",
5070 FT_NONE, BASE_NONE, NULL, 0,
5071 "ldap.SortKeyList_item", HFILL }},
5072 { &hf_ldap_attributeType,
5073 { "attributeType", "ldap.attributeType",
5074 FT_STRING, BASE_NONE, NULL, 0,
5075 "ldap.AttributeDescription", HFILL }},
5076 { &hf_ldap_orderingRule,
5077 { "orderingRule", "ldap.orderingRule",
5078 FT_STRING, BASE_NONE, NULL, 0,
5079 "ldap.MatchingRuleId", HFILL }},
5080 { &hf_ldap_reverseOrder,
5081 { "reverseOrder", "ldap.reverseOrder",
5082 FT_BOOLEAN, 8, NULL, 0,
5083 "ldap.BOOLEAN", HFILL }},
5084 { &hf_ldap_sortResult,
5085 { "sortResult", "ldap.sortResult",
5086 FT_UINT32, BASE_DEC, VALS(ldap_T_sortResult_vals), 0,
5087 "ldap.T_sortResult", HFILL }},
5088 { &hf_ldap_parentsFirst,
5089 { "parentsFirst", "ldap.parentsFirst",
5090 FT_INT32, BASE_DEC, NULL, 0,
5091 "ldap.INTEGER", HFILL }},
5092 { &hf_ldap_maxReturnLength,
5093 { "maxReturnLength", "ldap.maxReturnLength",
5094 FT_INT32, BASE_DEC, NULL, 0,
5095 "ldap.INTEGER", HFILL }},
5096 { &hf_ldap_userIdentity,
5097 { "userIdentity", "ldap.userIdentity",
5098 FT_BYTES, BASE_HEX, NULL, 0,
5099 "ldap.OCTET_STRING", HFILL }},
5100 { &hf_ldap_oldPasswd,
5101 { "oldPasswd", "ldap.oldPasswd",
5102 FT_BYTES, BASE_HEX, NULL, 0,
5103 "ldap.OCTET_STRING", HFILL }},
5104 { &hf_ldap_newPasswd,
5105 { "newPasswd", "ldap.newPasswd",
5106 FT_BYTES, BASE_HEX, NULL, 0,
5107 "ldap.OCTET_STRING", HFILL }},
5108 { &hf_ldap_genPasswd,
5109 { "genPasswd", "ldap.genPasswd",
5110 FT_BYTES, BASE_HEX, NULL, 0,
5111 "ldap.OCTET_STRING", HFILL }},
5112 { &hf_ldap_cancelID,
5113 { "cancelID", "ldap.cancelID",
5114 FT_UINT32, BASE_DEC, NULL, 0,
5115 "ldap.MessageID", HFILL }},
5117 /*--- End of included file: packet-ldap-hfarr.c ---*/
5118 #line 2088 "packet-ldap-template.c"
5121 /* List of subtrees */
5122 static gint *ett[] = {
5125 &ett_ldap_sasl_blob,
5127 &ett_mscldap_netlogon_flags,
5128 &ett_mscldap_ntver_flags,
5129 &ett_mscldap_ipdetails,
5132 /*--- Included file: packet-ldap-ettarr.c ---*/
5133 #line 1 "packet-ldap-ettarr.c"
5134 &ett_ldap_LDAPMessage,
5135 &ett_ldap_ProtocolOp,
5136 &ett_ldap_AttributeDescriptionList,
5137 &ett_ldap_AttributeValueAssertion,
5138 &ett_ldap_Attribute,
5139 &ett_ldap_SET_OF_AttributeValue,
5140 &ett_ldap_LDAPResult,
5144 &ett_ldap_BindRequest_U,
5145 &ett_ldap_AuthenticationChoice,
5146 &ett_ldap_SaslCredentials,
5147 &ett_ldap_BindResponse_U,
5148 &ett_ldap_SearchRequest_U,
5152 &ett_ldap_SubstringFilter,
5153 &ett_ldap_T_substringFilter_substrings,
5154 &ett_ldap_T_substringFilter_substrings_item,
5155 &ett_ldap_MatchingRuleAssertion,
5156 &ett_ldap_SearchResultEntry_U,
5157 &ett_ldap_PartialAttributeList,
5158 &ett_ldap_PartialAttributeList_item,
5159 &ett_ldap_SEQUENCE_OF_LDAPURL,
5160 &ett_ldap_ModifyRequest_U,
5161 &ett_ldap_ModifyRequest_modification,
5162 &ett_ldap_T_modifyRequest_modification_item,
5163 &ett_ldap_AttributeTypeAndValues,
5164 &ett_ldap_AddRequest_U,
5165 &ett_ldap_AttributeList,
5166 &ett_ldap_AttributeList_item,
5167 &ett_ldap_ModifyDNRequest_U,
5168 &ett_ldap_CompareRequest_U,
5169 &ett_ldap_ExtendedRequest_U,
5170 &ett_ldap_ExtendedResponse_U,
5171 &ett_ldap_SearchControlValue,
5172 &ett_ldap_SortKeyList,
5173 &ett_ldap_SortKeyList_item,
5174 &ett_ldap_SortResult,
5175 &ett_ldap_ReplControlValue,
5176 &ett_ldap_PasswdModifyRequestValue,
5177 &ett_ldap_PasswdModifyResponseValue,
5178 &ett_ldap_CancelRequestValue,
5180 /*--- End of included file: packet-ldap-ettarr.c ---*/
5181 #line 2101 "packet-ldap-template.c"
5184 module_t *ldap_module;
5186 /* Register protocol */
5187 proto_ldap = proto_register_protocol(PNAME, PSNAME, PFNAME);
5188 /* Register fields and subtrees */
5189 proto_register_field_array(proto_ldap, hf, array_length(hf));
5190 proto_register_subtree_array(ett, array_length(ett));
5193 register_dissector("ldap", dissect_ldap_tcp, proto_ldap);
5195 ldap_module = prefs_register_protocol(proto_ldap, prefs_register_ldap);
5196 prefs_register_bool_preference(ldap_module, "desegment_ldap_messages",
5197 "Reassemble LDAP messages spanning multiple TCP segments",
5198 "Whether the LDAP dissector should reassemble messages spanning multiple TCP segments."
5199 " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
5202 prefs_register_uint_preference(ldap_module, "tcp.port", "LDAP TCP Port",
5203 "Set the port for LDAP operations",
5204 10, &global_ldap_tcp_port);
5206 prefs_register_uint_preference(ldap_module, "ssl.port", "LDAPS TCP Port",
5207 "Set the port for LDAP operations over SSL",
5208 10, &global_ldaps_tcp_port);
5210 prefs_register_obsolete_preference(ldap_module, "max_pdu");
5212 proto_cldap = proto_register_protocol(
5213 "Connectionless Lightweight Directory Access Protocol",
5216 register_init_routine(ldap_reinit);
5217 ldap_tap=register_tap("ldap");
5219 ldap_name_dissector_table = register_dissector_table("ldap.name", "LDAP Attribute Type Dissectors", FT_STRING, BASE_NONE);
5224 /*--- proto_reg_handoff_ldap ---------------------------------------*/
5226 proto_reg_handoff_ldap(void)
5228 dissector_handle_t cldap_handle;
5229 ldap_handle = create_dissector_handle(dissect_ldap_tcp, proto_ldap);
5231 dissector_add("tcp.port", global_ldap_tcp_port, ldap_handle);
5232 dissector_add("tcp.port", TCP_PORT_GLOBALCAT_LDAP, ldap_handle);
5234 ssl_dissector_add(global_ldaps_tcp_port, "ldap", TRUE);
5236 cldap_handle = create_dissector_handle(dissect_mscldap, proto_cldap);
5237 dissector_add("udp.port", UDP_PORT_CLDAP, cldap_handle);
5239 gssapi_handle = find_dissector("gssapi");
5240 gssapi_wrap_handle = find_dissector("gssapi_verf");
5241 spnego_handle = find_dissector("spnego");
5243 ntlmssp_handle = find_dissector("ntlmssp");
5245 ssl_handle = find_dissector("ssl");
5247 /* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dsml/dsml/ldap_controls_and_session_support.asp */
5248 oid_add_from_string("LDAP_PAGED_RESULT_OID_STRING","1.2.840.113556.1.4.319");
5249 oid_add_from_string("LDAP_SERVER_SHOW_DELETED_OID","1.2.840.113556.1.4.417");
5250 oid_add_from_string("LDAP_SERVER_SORT_OID","1.2.840.113556.1.4.473");
5251 oid_add_from_string("LDAP_CONTROL_SORT_RESP_OID","1.2.840.113556.1.4.474");
5252 oid_add_from_string("LDAP_SERVER_CROSSDOM_MOVE_TARGET_OID","1.2.840.113556.1.4.521");
5253 oid_add_from_string("LDAP_SERVER_NOTIFICATION_OID","1.2.840.113556.1.4.528");
5254 oid_add_from_string("LDAP_SERVER_EXTENDED_DN_OID","1.2.840.113556.1.4.529");
5255 oid_add_from_string("meetingAdvertiseScope","1.2.840.113556.1.4.582");
5256 oid_add_from_string("LDAP_SERVER_LAZY_COMMIT_OID","1.2.840.113556.1.4.619");
5257 oid_add_from_string("mhsORAddress","1.2.840.113556.1.4.650");
5258 oid_add_from_string("managedObjects","1.2.840.113556.1.4.654");
5259 oid_add_from_string("LDAP_CAP_ACTIVE_DIRECTORY_OID","1.2.840.113556.1.4.800");
5260 oid_add_from_string("LDAP_SERVER_SD_FLAGS_OID","1.2.840.113556.1.4.801");
5261 oid_add_from_string("LDAP_OID_COMPARATOR_OR","1.2.840.113556.1.4.804");
5262 oid_add_from_string("LDAP_SERVER_TREE_DELETE_OID","1.2.840.113556.1.4.805");
5263 oid_add_from_string("LDAP_SERVER_DIRSYNC_OID","1.2.840.113556.1.4.841");
5264 oid_add_from_string("None","1.2.840.113556.1.4.970");
5265 oid_add_from_string("LDAP_SERVER_VERIFY_NAME_OID","1.2.840.113556.1.4.1338");
5266 oid_add_from_string("LDAP_SERVER_DOMAIN_SCOPE_OID","1.2.840.113556.1.4.1339");
5267 oid_add_from_string("LDAP_SERVER_SEARCH_OPTIONS_OID","1.2.840.113556.1.4.1340");
5268 oid_add_from_string("LDAP_SERVER_PERMISSIVE_MODIFY_OID","1.2.840.113556.1.4.1413");
5269 oid_add_from_string("LDAP_SERVER_ASQ_OID","1.2.840.113556.1.4.1504");
5270 oid_add_from_string("LDAP_CAP_ACTIVE_DIRECTORY_V51_OID","1.2.840.113556.1.4.1670");
5271 oid_add_from_string("LDAP_SERVER_FAST_BIND_OID","1.2.840.113556.1.4.1781");
5272 oid_add_from_string("LDAP_CAP_ACTIVE_DIRECTORY_LDAP_INTEG_OID","1.2.840.113556.1.4.1791");
5273 oid_add_from_string("msDS-ObjectReference","1.2.840.113556.1.4.1840");
5274 oid_add_from_string("msDS-QuotaEffective","1.2.840.113556.1.4.1848");
5275 oid_add_from_string("LDAP_CAP_ACTIVE_DIRECTORY_ADAM_OID","1.2.840.113556.1.4.1851");
5276 oid_add_from_string("msDS-PortSSL","1.2.840.113556.1.4.1860");
5277 oid_add_from_string("msDS-isRODC","1.2.840.113556.1.4.1960");
5278 oid_add_from_string("msDS-SDReferenceDomain","1.2.840.113556.1.4.1711");
5279 oid_add_from_string("msDS-AdditionalDnsHostName","1.2.840.113556.1.4.1717");
5280 oid_add_from_string("None","1.3.6.1.4.1.1466.101.119.1");
5281 oid_add_from_string("LDAP_START_TLS_OID","1.3.6.1.4.1.1466.20037");
5282 oid_add_from_string("LDAP_CONTROL_VLVREQUEST VLV","2.16.840.1.113730.3.4.9");
5283 oid_add_from_string("LDAP_CONTROL_VLVRESPONSE VLV","2.16.840.1.113730.3.4.10");
5285 register_ldap_name_dissector("netlogon", dissect_NetLogon_PDU, proto_cldap);
5286 register_ldap_name_dissector("objectGUID", dissect_ldap_guid, proto_ldap);
5287 register_ldap_name_dissector("supportedControl", dissect_ldap_oid, proto_ldap);
5288 register_ldap_name_dissector("supportedCapabilities", dissect_ldap_oid, proto_ldap);
5289 register_ldap_name_dissector("objectSid", dissect_ldap_sid, proto_ldap);
5290 register_ldap_name_dissector("nTSecurityDescriptor", dissect_ldap_nt_sec_desc, proto_ldap);
5293 /*--- Included file: packet-ldap-dis-tab.c ---*/
5294 #line 1 "packet-ldap-dis-tab.c"
5295 register_ber_oid_dissector("1.2.840.113556.1.4.319", dissect_SearchControlValue_PDU, proto_ldap, "pagedResultsControl");
5296 register_ber_oid_dissector("1.2.840.113556.1.4.473", dissect_SortKeyList_PDU, proto_ldap, "sortKeyList");
5297 register_ber_oid_dissector("1.2.840.113556.1.4.474", dissect_SortResult_PDU, proto_ldap, "sortResult");
5298 register_ber_oid_dissector("1.2.840.113556.1.4.841", dissect_ReplControlValue_PDU, proto_ldap, "replControlValue");
5299 register_ber_oid_dissector("1.3.6.1.4.1.4203.1.11.1", dissect_PasswdModifyRequestValue_PDU, proto_ldap, "passwdModifyOID");
5300 register_ber_oid_dissector("1.3.6.1.1.8", dissect_CancelRequestValue_PDU, proto_ldap, "cancelRequstOID");
5303 /*--- End of included file: packet-ldap-dis-tab.c ---*/
5304 #line 2212 "packet-ldap-template.c"
5309 void prefs_register_ldap(void) {
5311 if(tcp_port != global_ldap_tcp_port) {
5313 dissector_delete("tcp.port", tcp_port, ldap_handle);
5315 /* Set our port number for future use */
5316 tcp_port = global_ldap_tcp_port;
5319 dissector_add("tcp.port", tcp_port, ldap_handle);
5323 if(ssl_port != global_ldaps_tcp_port) {
5325 ssl_dissector_delete(ssl_port, "ldap", TRUE);
5327 /* Set our port number for future use */
5328 ssl_port = global_ldaps_tcp_port;
5331 ssl_dissector_add(ssl_port, "ldap", TRUE);