From adabb3d63ed6bbc52f9cbb70eff5bd8eafe53084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig=20Bj=C3=B8rlykke?= Date: Fri, 30 Mar 2012 09:08:55 +0000 Subject: Added support for configuring custom LDAP AttributeValue types. svn path=/trunk/; revision=41841 --- epan/dissectors/packet-ldap.c | 245 +++++++++++++++++++++++++++++++++++------- 1 file changed, 205 insertions(+), 40 deletions(-) (limited to 'epan') diff --git a/epan/dissectors/packet-ldap.c b/epan/dissectors/packet-ldap.c index 0abd207035..3bd3ddcfc1 100644 --- a/epan/dissectors/packet-ldap.c +++ b/epan/dissectors/packet-ldap.c @@ -112,6 +112,7 @@ #include #include #include +#include #include "packet-ldap.h" #include "packet-ntlmssp.h" @@ -341,7 +342,7 @@ static int hf_ldap_graceAuthNsRemaining = -1; /* INTEGER_0_maxInt */ static int hf_ldap_error = -1; /* T_error */ /*--- End of included file: packet-ldap-hf.c ---*/ -#line 188 "../../asn1/ldap/packet-ldap-template.c" +#line 189 "../../asn1/ldap/packet-ldap-template.c" /* Initialize the subtree pointers */ static gint ett_ldap = -1; @@ -414,7 +415,7 @@ static gint ett_ldap_PasswordPolicyResponseValue = -1; static gint ett_ldap_T_warning = -1; /*--- End of included file: packet-ldap-ett.c ---*/ -#line 199 "../../asn1/ldap/packet-ldap-template.c" +#line 200 "../../asn1/ldap/packet-ldap-template.c" static dissector_table_t ldap_name_dissector_table=NULL; static const char *object_identifier_id = NULL; /* LDAP OID */ @@ -457,7 +458,7 @@ static const value_string ldap_ProtocolOp_choice_vals[] = { { 3, "searchRequest" }, { 4, "searchResEntry" }, { 5, "searchResDone" }, - { 6, "searchResRef" }, + { 6, "searchResRef" }, { 7, "modifyRequest" }, { 8, "modifyResponse" }, { 9, "addRequest" }, @@ -606,6 +607,139 @@ static const true_false_string tfs_ntver_vl = { "Global Catalog not requested" }; +/* Stuff for generation/handling of fields for custom AttributeValues */ +typedef struct _attribute_type_t { + gchar* attribute_type; + gchar* attribute_desc; +} attribute_type_t; + +static attribute_type_t* attribute_types = NULL; +static guint num_attribute_types = 0; + +static GHashTable* attribute_types_hash = NULL; + +static void +attribute_types_update_cb(void *r, const char **err) +{ + attribute_type_t *rec = r; + char c; + + if (rec->attribute_type == NULL) { + *err = ep_strdup_printf("Attribute type can't be empty"); + return; + } + + g_strstrip(rec->attribute_type); + if (rec->attribute_type[0] == 0) { + *err = ep_strdup_printf("Attribute type can't be empty"); + return; + } + + /* Check for invalid characters (to avoid asserting out when + * registering the field). + */ + c = proto_check_field_name(rec->attribute_type); + if (c) { + *err = ep_strdup_printf("Attribute type can't contain '%c'", c); + return; + } + + *err = NULL; +} + +static void * +attribute_types_copy_cb(void* n, const void* o, size_t siz _U_) +{ + attribute_type_t* new_rec = n; + const attribute_type_t* old_rec = o; + + new_rec->attribute_type = g_strdup(old_rec->attribute_type); + new_rec->attribute_desc = g_strdup(old_rec->attribute_desc); + + return new_rec; +} + +static void +attribute_types_free_cb(void*r) +{ + attribute_type_t* rec = r; + + if (rec->attribute_type) g_free(rec->attribute_type); + if (rec->attribute_desc) g_free(rec->attribute_desc); +} + +UAT_CSTRING_CB_DEF(attribute_types, attribute_type, attribute_type_t) +UAT_CSTRING_CB_DEF(attribute_types, attribute_desc, attribute_type_t) + +/* + * + */ +static gint* +get_hf_for_header(char* attribute_type) +{ + gint* hf_id = NULL; + + if (attribute_types_hash) { + hf_id = (gint*) g_hash_table_lookup(attribute_types_hash, attribute_type); + } else { + hf_id = NULL; + } + + return hf_id; +} + +/* + * + */ +static void +attribute_types_initialize_cb(void) +{ + static hf_register_info* hf; + gint* hf_id; + guint i; + gchar* attribute_type; + + if (attribute_types_hash) { + guint hf_size = g_hash_table_size (attribute_types_hash); + /* Unregister all fields */ + for (i = 0; i < hf_size; i++) { + proto_unregister_field (proto_ldap, *(hf[i].p_id)); + + g_free (hf[i].p_id); + g_free ((char *) hf[i].hfinfo.name); + g_free ((char *) hf[i].hfinfo.abbrev); + g_free ((char *) hf[i].hfinfo.blurb); + } + g_hash_table_destroy (attribute_types_hash); + g_free (hf); + attribute_types_hash = NULL; + } + + if (num_attribute_types) { + attribute_types_hash = g_hash_table_new(g_str_hash, g_str_equal); + hf = g_malloc0(sizeof(hf_register_info) * num_attribute_types); + + for (i = 0; i < num_attribute_types; i++) { + hf_id = g_malloc(sizeof(gint)); + *hf_id = -1; + attribute_type = g_strdup(attribute_types[i].attribute_type); + + hf[i].p_id = hf_id; + hf[i].hfinfo.name = attribute_type; + hf[i].hfinfo.abbrev = g_strdup_printf("ldap.AttributeValue.%s", attribute_type); + hf[i].hfinfo.type = FT_STRING; + hf[i].hfinfo.display = BASE_NONE; + hf[i].hfinfo.strings = NULL; + hf[i].hfinfo.blurb = g_strdup(attribute_types[i].attribute_desc); + hf[i].hfinfo.same_name_prev = NULL; + hf[i].hfinfo.same_name_next = NULL; + + g_hash_table_insert(attribute_types_hash, attribute_type, hf_id); + } + + proto_register_field_array(proto_ldap, hf, num_attribute_types); + } +} /* MS-ADTS specification, section 7.3.1.1, NETLOGON_NT_VERSION Options Bits */ static int dissect_mscldap_ntver_flags(proto_tree *parent_tree, tvbuff_t *tvb, int offset) @@ -1245,7 +1379,7 @@ dissect_ldap_SaslCredentials(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int o static int 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_) { -#line 701 "../../asn1/ldap/ldap.cnf" +#line 706 "../../asn1/ldap/ldap.cnf" /* make sure the protocol op comes first */ ldap_do_protocolop(actx->pinfo); @@ -1261,7 +1395,7 @@ dissect_ldap_T_ntlmsspNegotiate(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in static int 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_) { -#line 708 "../../asn1/ldap/ldap.cnf" +#line 713 "../../asn1/ldap/ldap.cnf" /* make sure the protocol op comes first */ ldap_do_protocolop(actx->pinfo); @@ -1292,7 +1426,7 @@ static const ber_choice_t AuthenticationChoice_choice[] = { static int 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_) { -#line 491 "../../asn1/ldap/ldap.cnf" +#line 496 "../../asn1/ldap/ldap.cnf" gint branch = -1; gint auth = -1; const gchar *valstr; @@ -1426,7 +1560,7 @@ dissect_ldap_BindResponse_resultCode(gboolean implicit_tag _U_, tvbuff_t *tvb _U static int 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_) { -#line 715 "../../asn1/ldap/ldap.cnf" +#line 720 "../../asn1/ldap/ldap.cnf" tvbuff_t *new_tvb=NULL; offset = dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_ldap_matchedDN, &new_tvb); @@ -1605,7 +1739,7 @@ dissect_ldap_NULL(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, static int 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_) { -#line 513 "../../asn1/ldap/ldap.cnf" +#line 518 "../../asn1/ldap/ldap.cnf" implicit_tag = TRUE; /* correct problem with asn2wrs */ @@ -1701,7 +1835,7 @@ static int 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_) { offset = dissect_ldap_Filter(implicit_tag, tvb, offset, actx, tree, hf_index); -#line 559 "../../asn1/ldap/ldap.cnf" +#line 564 "../../asn1/ldap/ldap.cnf" if(and_filter_string){ and_filter_string=ep_strdup_printf("(&%s%s)",and_filter_string,Filter_string); } else { @@ -1719,7 +1853,7 @@ static const ber_sequence_t T_and_set_of[1] = { static int 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_) { -#line 566 "../../asn1/ldap/ldap.cnf" +#line 571 "../../asn1/ldap/ldap.cnf" proto_tree *tr=NULL; proto_item *it=NULL; const char *old_and_filter_string=and_filter_string; @@ -1752,7 +1886,7 @@ static int 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_) { offset = dissect_ldap_Filter(implicit_tag, tvb, offset, actx, tree, hf_index); -#line 586 "../../asn1/ldap/ldap.cnf" +#line 591 "../../asn1/ldap/ldap.cnf" if(or_filter_string){ or_filter_string=ep_strdup_printf("(|%s%s)",or_filter_string,Filter_string); } else { @@ -1771,7 +1905,7 @@ static const ber_sequence_t T_or_set_of[1] = { static int 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_) { -#line 594 "../../asn1/ldap/ldap.cnf" +#line 599 "../../asn1/ldap/ldap.cnf" proto_tree *tr=NULL; proto_item *it=NULL; const char *old_or_filter_string=or_filter_string; @@ -1802,7 +1936,7 @@ static int 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_) { offset = dissect_ldap_Filter(implicit_tag, tvb, offset, actx, tree, hf_index); -#line 615 "../../asn1/ldap/ldap.cnf" +#line 620 "../../asn1/ldap/ldap.cnf" Filter_string=ep_strdup_printf("(!%s)",string_or_null(Filter_string)); @@ -1840,7 +1974,7 @@ static int 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_) { offset = dissect_ldap_AttributeValueAssertion(implicit_tag, tvb, offset, actx, tree, hf_index); -#line 536 "../../asn1/ldap/ldap.cnf" +#line 541 "../../asn1/ldap/ldap.cnf" Filter_string=ep_strdup_printf("(%s=%s)", string_or_null(attributedesc_string), string_or_null(ldapvalue_string)); @@ -1871,7 +2005,7 @@ dissect_ldap_T_substringFilter_substrings_item(gboolean implicit_tag _U_, tvbuff T_substringFilter_substrings_item_choice, hf_index, ett_ldap_T_substringFilter_substrings_item, NULL); -#line 641 "../../asn1/ldap/ldap.cnf" +#line 646 "../../asn1/ldap/ldap.cnf" if (substring_item_final) { substring_value=ep_strdup_printf("%s%s", (substring_value?substring_value:"*"), @@ -1911,7 +2045,7 @@ static const ber_sequence_t SubstringFilter_sequence[] = { static int 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_) { -#line 655 "../../asn1/ldap/ldap.cnf" +#line 660 "../../asn1/ldap/ldap.cnf" proto_tree *tr=NULL; proto_item *it=NULL; const char *old_substring_value=substring_value; @@ -1946,7 +2080,7 @@ static int 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_) { offset = dissect_ldap_AttributeValueAssertion(implicit_tag, tvb, offset, actx, tree, hf_index); -#line 542 "../../asn1/ldap/ldap.cnf" +#line 547 "../../asn1/ldap/ldap.cnf" Filter_string=ep_strdup_printf("(%s>=%s)", string_or_null(attributedesc_string), string_or_null(ldapvalue_string)); @@ -1962,7 +2096,7 @@ static int 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_) { offset = dissect_ldap_AttributeValueAssertion(implicit_tag, tvb, offset, actx, tree, hf_index); -#line 548 "../../asn1/ldap/ldap.cnf" +#line 553 "../../asn1/ldap/ldap.cnf" Filter_string=ep_strdup_printf("(%s<=%s)", string_or_null(attributedesc_string), string_or_null(ldapvalue_string)); @@ -1978,7 +2112,7 @@ static int 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_) { offset = dissect_ldap_AttributeDescription(implicit_tag, tvb, offset, actx, tree, hf_index); -#line 612 "../../asn1/ldap/ldap.cnf" +#line 617 "../../asn1/ldap/ldap.cnf" Filter_string=ep_strdup_printf("(%s=*)",string_or_null(Filter_string)); @@ -1991,7 +2125,7 @@ static int 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_) { offset = dissect_ldap_AttributeValueAssertion(implicit_tag, tvb, offset, actx, tree, hf_index); -#line 554 "../../asn1/ldap/ldap.cnf" +#line 559 "../../asn1/ldap/ldap.cnf" Filter_string=ep_strdup_printf("(%s~=%s)", string_or_null(attributedesc_string), string_or_null(ldapvalue_string)); @@ -2013,7 +2147,7 @@ dissect_ldap_MatchingRuleId(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of static int 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_) { -#line 618 "../../asn1/ldap/ldap.cnf" +#line 623 "../../asn1/ldap/ldap.cnf" gboolean val; offset = dissect_ber_boolean(implicit_tag, actx, tree, tvb, offset, hf_index, &val); @@ -2048,7 +2182,7 @@ dissect_ldap_MatchingRuleAssertion(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, static int 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_) { -#line 627 "../../asn1/ldap/ldap.cnf" +#line 632 "../../asn1/ldap/ldap.cnf" attr_type=NULL; matching_rule_string=NULL; ldapvalue_string=NULL; @@ -2057,7 +2191,7 @@ dissect_ldap_T_extensibleMatch(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset = dissect_ldap_MatchingRuleAssertion(implicit_tag, tvb, offset, actx, tree, hf_index); -#line 633 "../../asn1/ldap/ldap.cnf" +#line 638 "../../asn1/ldap/ldap.cnf" Filter_string=ep_strdup_printf("(%s:%s%s%s=%s)", (attr_type?attr_type:""), (matching_rule_dnattr?"dn:":""), @@ -2100,7 +2234,7 @@ static const ber_choice_t Filter_choice[] = { 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_) { -#line 677 "../../asn1/ldap/ldap.cnf" +#line 682 "../../asn1/ldap/ldap.cnf" proto_tree *tr=NULL; proto_item *it=NULL; attributedesc_string=NULL; @@ -2136,7 +2270,7 @@ dissect_ldap_Filter(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_ static int 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_) { -#line 525 "../../asn1/ldap/ldap.cnf" +#line 530 "../../asn1/ldap/ldap.cnf" Filter_string=NULL; Filter_elements = 0; Filter_length = 0; @@ -2144,7 +2278,7 @@ dissect_ldap_T_filter(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _ offset = dissect_ldap_Filter(implicit_tag, tvb, offset, actx, tree, hf_index); -#line 530 "../../asn1/ldap/ldap.cnf" +#line 535 "../../asn1/ldap/ldap.cnf" Filter_string=NULL; and_filter_string=NULL; Filter_elements = 0; @@ -2208,14 +2342,19 @@ dissect_ldap_AttributeValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of gchar *string; guint32 i, len; int old_offset = offset; + gint *hf_id; /* attr_type, should be set before calling this function */ /* extract the value of the octetstring */ offset = dissect_ber_octet_string(FALSE, actx, NULL, tvb, offset, hf_index, &next_tvb); + /* first check if we have a custom attribute type configured */ + if ((hf_id = get_hf_for_header (attr_type)) != NULL) + proto_tree_add_item (tree, *hf_id, next_tvb, 0, tvb_length_remaining(next_tvb, 0), FALSE); + /* if we have an attribute type that isn't binary see if there is a better dissector */ - if(!attr_type || !next_tvb || !dissector_try_string(ldap_name_dissector_table, attr_type, next_tvb, actx->pinfo, tree)) { + else if(!attr_type || !next_tvb || !dissector_try_string(ldap_name_dissector_table, attr_type, next_tvb, actx->pinfo, tree)) { offset = old_offset; /* do the default thing */ @@ -2424,7 +2563,7 @@ dissect_ldap_SEQUENCE_OF_LDAPURL(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, i static int 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_) { -#line 818 "../../asn1/ldap/ldap.cnf" +#line 823 "../../asn1/ldap/ldap.cnf" offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset, hf_index, BER_CLASS_APP, 19, TRUE, dissect_ldap_SEQUENCE_OF_LDAPURL); @@ -2701,7 +2840,7 @@ dissect_ldap_CompareResponse(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int o static int 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_) { -#line 825 "../../asn1/ldap/ldap.cnf" +#line 830 "../../asn1/ldap/ldap.cnf" offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset, hf_index, BER_CLASS_APP, 16, TRUE, dissect_ldap_MessageID); @@ -2772,7 +2911,7 @@ dissect_ldap_LDAPOID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U static int 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_) { -#line 750 "../../asn1/ldap/ldap.cnf" +#line 755 "../../asn1/ldap/ldap.cnf" if((object_identifier_id != NULL) && oid_has_dissector(object_identifier_id)) { offset = call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree); @@ -2921,12 +3060,12 @@ dissect_ldap_ExtendedResponse(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int static int dissect_ldap_T_intermediateResponse_responseValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 758 "../../asn1/ldap/ldap.cnf" +#line 763 "../../asn1/ldap/ldap.cnf" const gchar *name; -#line 762 "../../asn1/ldap/ldap.cnf" +#line 767 "../../asn1/ldap/ldap.cnf" if(ldm_tree && object_identifier_id) { proto_item_set_text(ldm_tree, "%s %s", "IntermediateResponse", object_identifier_id); name = oid_resolved_from_string(object_identifier_id); @@ -3107,7 +3246,7 @@ dissect_ldap_ControlType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse static int 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_) { -#line 731 "../../asn1/ldap/ldap.cnf" +#line 736 "../../asn1/ldap/ldap.cnf" gint8 ber_class; gboolean pc, ind; gint32 tag; @@ -3292,7 +3431,7 @@ dissect_ldap_DirSyncFlagsSubEntry(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, static int dissect_ldap_DirSyncFlags(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { -#line 775 "../../asn1/ldap/ldap.cnf" +#line 780 "../../asn1/ldap/ldap.cnf" gint8 ber_class; gboolean pc; gint32 tag; @@ -3701,7 +3840,7 @@ static void dissect_PasswordPolicyResponseValue_PDU(tvbuff_t *tvb _U_, packet_in /*--- End of included file: packet-ldap-fn.c ---*/ -#line 745 "../../asn1/ldap/packet-ldap-template.c" +#line 879 "../../asn1/ldap/packet-ldap-template.c" static void dissect_ldap_payload(tvbuff_t *tvb, packet_info *pinfo, @@ -5606,7 +5745,7 @@ void proto_register_ldap(void) { NULL, HFILL }}, /*--- End of included file: packet-ldap-hfarr.c ---*/ -#line 2069 "../../asn1/ldap/packet-ldap-template.c" +#line 2203 "../../asn1/ldap/packet-ldap-template.c" }; /* List of subtrees */ @@ -5681,11 +5820,18 @@ void proto_register_ldap(void) { &ett_ldap_T_warning, /*--- End of included file: packet-ldap-ettarr.c ---*/ -#line 2082 "../../asn1/ldap/packet-ldap-template.c" +#line 2216 "../../asn1/ldap/packet-ldap-template.c" + }; + /* UAT for header fields */ + static uat_field_t custom_attribute_types_uat_fields[] = { + UAT_FLD_CSTRING(attribute_types, attribute_type, "Attribute type", "Attribute type"), + UAT_FLD_CSTRING(attribute_types, attribute_desc, "Description", "Description of the value matching type"), + UAT_END_FIELDS }; - module_t *ldap_module; - + module_t *ldap_module; + uat_t *attributes_uat; + /* Register protocol */ proto_ldap = proto_register_protocol(PNAME, PSNAME, PFNAME); /* Register fields and subtrees */ @@ -5709,6 +5855,25 @@ void proto_register_ldap(void) { prefs_register_uint_preference(ldap_module, "ssl.port", "LDAPS TCP Port", "Set the port for LDAP operations over SSL", 10, &global_ldaps_tcp_port); + /* UAT */ + attributes_uat = uat_new("Custom AttributeValue types Table", + sizeof(attribute_type_t), + "custom_ldap_attribute_types", + TRUE, + (void*) &attribute_types, + &num_attribute_types, + UAT_CAT_FIELDS, + NULL, + attribute_types_copy_cb, + attribute_types_update_cb, + attribute_types_free_cb, + attribute_types_initialize_cb, + custom_attribute_types_uat_fields); + + prefs_register_uat_preference(ldap_module, "custom_ldap_attribute_types", + "Custom AttributeValue types", + "A table to define custom LDAP attribute type values for which fields can be setup and used for filtering/data extraction etc.", + attributes_uat); prefs_register_obsolete_preference(ldap_module, "max_pdu"); @@ -5812,7 +5977,7 @@ proto_reg_handoff_ldap(void) /*--- End of included file: packet-ldap-dis-tab.c ---*/ -#line 2196 "../../asn1/ldap/packet-ldap-template.c" +#line 2356 "../../asn1/ldap/packet-ldap-template.c" } -- cgit v1.2.3