aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2012-03-29 12:03:49 +0000
committerStig Bjørlykke <stig@bjorlykke.org>2012-03-29 12:03:49 +0000
commit91f2f97f28c3cf02576bd78456a77ea1348087c3 (patch)
treecb0b8e35f645a8c0fd48838f77ac1cedfd13926c
parent378d03900965a694c92b0e724b7ae24b746ea6c6 (diff)
Don't try to convert AttributeValue to string if having a ldap_name dissector.
Prefix the converted printable string correctly with 'AttributeValue: '. svn path=/trunk/; revision=41823
-rw-r--r--asn1/ldap/ldap.cnf26
-rw-r--r--asn1/ldap/packet-ldap-template.c2
-rw-r--r--epan/dissectors/packet-ldap.c88
3 files changed, 54 insertions, 62 deletions
diff --git a/asn1/ldap/ldap.cnf b/asn1/ldap/ldap.cnf
index 010c2dd5e0..4ae2f88d62 100644
--- a/asn1/ldap/ldap.cnf
+++ b/asn1/ldap/ldap.cnf
@@ -470,25 +470,21 @@ ldap_conv_info_t *ldap_info;
/* 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)) {
- offset = old_offset;
+ offset = old_offset;
- /* do the default thing */
- %(DEFAULT_BODY)s
+ /* do the default thing */
+ %(DEFAULT_BODY)s
- }
-
- len = tvb_length_remaining(next_tvb, 0);
-
- for(i = 0; i < len; i++)
- if(!g_ascii_isprint(tvb_get_guint8(next_tvb, i)))
- break;
+ len = tvb_length_remaining(next_tvb, 0);
- if(i == len) {
- string = tvb_get_ephemeral_string(next_tvb, 0, tvb_length_remaining(next_tvb, 0));
-
-
- proto_item_set_text(actx->created_item, "%%s", string);
+ for(i = 0; i < len; i++)
+ if(!g_ascii_isprint(tvb_get_guint8(next_tvb, i)))
+ break;
+ if(i == len) {
+ string = tvb_get_ephemeral_string(next_tvb, 0, tvb_length_remaining(next_tvb, 0));
+ proto_item_set_text(actx->created_item, "AttributeValue: %%s", string);
+ }
}
#.FN_BODY AuthenticationChoice VAL_PTR = &branch
diff --git a/asn1/ldap/packet-ldap-template.c b/asn1/ldap/packet-ldap-template.c
index ce2e70b6cb..7a69961ccc 100644
--- a/asn1/ldap/packet-ldap-template.c
+++ b/asn1/ldap/packet-ldap-template.c
@@ -1634,7 +1634,7 @@ dissect_ldap_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint32 sasl_len;
guint32 ldap_len;
gboolean ind;
- conversation_t *conversation;
+ conversation_t *conversation;
ldap_conv_info_t *ldap_info = NULL;
/*
diff --git a/epan/dissectors/packet-ldap.c b/epan/dissectors/packet-ldap.c
index 8c432ec961..0abd207035 100644
--- a/epan/dissectors/packet-ldap.c
+++ b/epan/dissectors/packet-ldap.c
@@ -1245,7 +1245,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 705 "../../asn1/ldap/ldap.cnf"
+#line 701 "../../asn1/ldap/ldap.cnf"
/* make sure the protocol op comes first */
ldap_do_protocolop(actx->pinfo);
@@ -1261,7 +1261,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 712 "../../asn1/ldap/ldap.cnf"
+#line 708 "../../asn1/ldap/ldap.cnf"
/* make sure the protocol op comes first */
ldap_do_protocolop(actx->pinfo);
@@ -1292,7 +1292,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 495 "../../asn1/ldap/ldap.cnf"
+#line 491 "../../asn1/ldap/ldap.cnf"
gint branch = -1;
gint auth = -1;
const gchar *valstr;
@@ -1426,7 +1426,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 719 "../../asn1/ldap/ldap.cnf"
+#line 715 "../../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 +1605,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 517 "../../asn1/ldap/ldap.cnf"
+#line 513 "../../asn1/ldap/ldap.cnf"
implicit_tag = TRUE; /* correct problem with asn2wrs */
@@ -1701,7 +1701,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 563 "../../asn1/ldap/ldap.cnf"
+#line 559 "../../asn1/ldap/ldap.cnf"
if(and_filter_string){
and_filter_string=ep_strdup_printf("(&%s%s)",and_filter_string,Filter_string);
} else {
@@ -1719,7 +1719,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 570 "../../asn1/ldap/ldap.cnf"
+#line 566 "../../asn1/ldap/ldap.cnf"
proto_tree *tr=NULL;
proto_item *it=NULL;
const char *old_and_filter_string=and_filter_string;
@@ -1752,7 +1752,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 590 "../../asn1/ldap/ldap.cnf"
+#line 586 "../../asn1/ldap/ldap.cnf"
if(or_filter_string){
or_filter_string=ep_strdup_printf("(|%s%s)",or_filter_string,Filter_string);
} else {
@@ -1771,7 +1771,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 598 "../../asn1/ldap/ldap.cnf"
+#line 594 "../../asn1/ldap/ldap.cnf"
proto_tree *tr=NULL;
proto_item *it=NULL;
const char *old_or_filter_string=or_filter_string;
@@ -1802,7 +1802,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 619 "../../asn1/ldap/ldap.cnf"
+#line 615 "../../asn1/ldap/ldap.cnf"
Filter_string=ep_strdup_printf("(!%s)",string_or_null(Filter_string));
@@ -1840,7 +1840,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 540 "../../asn1/ldap/ldap.cnf"
+#line 536 "../../asn1/ldap/ldap.cnf"
Filter_string=ep_strdup_printf("(%s=%s)",
string_or_null(attributedesc_string),
string_or_null(ldapvalue_string));
@@ -1871,7 +1871,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 645 "../../asn1/ldap/ldap.cnf"
+#line 641 "../../asn1/ldap/ldap.cnf"
if (substring_item_final) {
substring_value=ep_strdup_printf("%s%s",
(substring_value?substring_value:"*"),
@@ -1911,7 +1911,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 659 "../../asn1/ldap/ldap.cnf"
+#line 655 "../../asn1/ldap/ldap.cnf"
proto_tree *tr=NULL;
proto_item *it=NULL;
const char *old_substring_value=substring_value;
@@ -1946,7 +1946,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 546 "../../asn1/ldap/ldap.cnf"
+#line 542 "../../asn1/ldap/ldap.cnf"
Filter_string=ep_strdup_printf("(%s>=%s)",
string_or_null(attributedesc_string),
string_or_null(ldapvalue_string));
@@ -1962,7 +1962,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 552 "../../asn1/ldap/ldap.cnf"
+#line 548 "../../asn1/ldap/ldap.cnf"
Filter_string=ep_strdup_printf("(%s<=%s)",
string_or_null(attributedesc_string),
string_or_null(ldapvalue_string));
@@ -1978,7 +1978,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 616 "../../asn1/ldap/ldap.cnf"
+#line 612 "../../asn1/ldap/ldap.cnf"
Filter_string=ep_strdup_printf("(%s=*)",string_or_null(Filter_string));
@@ -1991,7 +1991,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 558 "../../asn1/ldap/ldap.cnf"
+#line 554 "../../asn1/ldap/ldap.cnf"
Filter_string=ep_strdup_printf("(%s~=%s)",
string_or_null(attributedesc_string),
string_or_null(ldapvalue_string));
@@ -2013,7 +2013,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 622 "../../asn1/ldap/ldap.cnf"
+#line 618 "../../asn1/ldap/ldap.cnf"
gboolean val;
offset = dissect_ber_boolean(implicit_tag, actx, tree, tvb, offset, hf_index, &val);
@@ -2048,7 +2048,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 631 "../../asn1/ldap/ldap.cnf"
+#line 627 "../../asn1/ldap/ldap.cnf"
attr_type=NULL;
matching_rule_string=NULL;
ldapvalue_string=NULL;
@@ -2057,7 +2057,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 637 "../../asn1/ldap/ldap.cnf"
+#line 633 "../../asn1/ldap/ldap.cnf"
Filter_string=ep_strdup_printf("(%s:%s%s%s=%s)",
(attr_type?attr_type:""),
(matching_rule_dnattr?"dn:":""),
@@ -2100,7 +2100,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 681 "../../asn1/ldap/ldap.cnf"
+#line 677 "../../asn1/ldap/ldap.cnf"
proto_tree *tr=NULL;
proto_item *it=NULL;
attributedesc_string=NULL;
@@ -2136,7 +2136,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 529 "../../asn1/ldap/ldap.cnf"
+#line 525 "../../asn1/ldap/ldap.cnf"
Filter_string=NULL;
Filter_elements = 0;
Filter_length = 0;
@@ -2144,7 +2144,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 534 "../../asn1/ldap/ldap.cnf"
+#line 530 "../../asn1/ldap/ldap.cnf"
Filter_string=NULL;
and_filter_string=NULL;
Filter_elements = 0;
@@ -2216,27 +2216,23 @@ dissect_ldap_AttributeValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of
/* 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)) {
- offset = old_offset;
+ offset = old_offset;
- /* do the default thing */
- offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
+ /* do the default thing */
+ offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
NULL);
- }
-
- len = tvb_length_remaining(next_tvb, 0);
-
- for(i = 0; i < len; i++)
- if(!g_ascii_isprint(tvb_get_guint8(next_tvb, i)))
- break;
-
- if(i == len) {
- string = tvb_get_ephemeral_string(next_tvb, 0, tvb_length_remaining(next_tvb, 0));
-
+ len = tvb_length_remaining(next_tvb, 0);
- proto_item_set_text(actx->created_item, "%s", string);
+ for(i = 0; i < len; i++)
+ if(!g_ascii_isprint(tvb_get_guint8(next_tvb, i)))
+ break;
+ if(i == len) {
+ string = tvb_get_ephemeral_string(next_tvb, 0, tvb_length_remaining(next_tvb, 0));
+ proto_item_set_text(actx->created_item, "AttributeValue: %s", string);
+ }
}
@@ -2428,7 +2424,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 822 "../../asn1/ldap/ldap.cnf"
+#line 818 "../../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);
@@ -2705,7 +2701,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 829 "../../asn1/ldap/ldap.cnf"
+#line 825 "../../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);
@@ -2776,7 +2772,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 754 "../../asn1/ldap/ldap.cnf"
+#line 750 "../../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);
@@ -2925,12 +2921,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 762 "../../asn1/ldap/ldap.cnf"
+#line 758 "../../asn1/ldap/ldap.cnf"
const gchar *name;
-#line 766 "../../asn1/ldap/ldap.cnf"
+#line 762 "../../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);
@@ -3111,7 +3107,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 735 "../../asn1/ldap/ldap.cnf"
+#line 731 "../../asn1/ldap/ldap.cnf"
gint8 ber_class;
gboolean pc, ind;
gint32 tag;
@@ -3296,7 +3292,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 779 "../../asn1/ldap/ldap.cnf"
+#line 775 "../../asn1/ldap/ldap.cnf"
gint8 ber_class;
gboolean pc;
gint32 tag;
@@ -4598,7 +4594,7 @@ dissect_ldap_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint32 sasl_len;
guint32 ldap_len;
gboolean ind;
- conversation_t *conversation;
+ conversation_t *conversation;
ldap_conv_info_t *ldap_info = NULL;
/*