From fcf198a69d3b985907ac84b17aefd8e8dc6a12f0 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Sat, 10 Jun 2006 05:07:42 +0000 Subject: add simple heuristics to the decoding of assertionvalues to make it display ascii strings as ascii and binary data as hex bytes svn path=/trunk/; revision=18420 --- asn1/ldap/ldap.cnf | 2 +- asn1/ldap/packet-ldap-template.c | 47 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) (limited to 'asn1/ldap') diff --git a/asn1/ldap/ldap.cnf b/asn1/ldap/ldap.cnf index 8fd03a44f0..290e18eb22 100644 --- a/asn1/ldap/ldap.cnf +++ b/asn1/ldap/ldap.cnf @@ -26,7 +26,6 @@ LDAPString TYPE = FT_STRING DISPLAY = BASE_NONE STRINGS = NULL LDAPURL TYPE = FT_STRING DISPLAY = BASE_NONE STRINGS = NULL LDAPOID TYPE = FT_STRING DISPLAY = BASE_NONE STRINGS = NULL Mechanism TYPE = FT_STRING DISPLAY = BASE_NONE STRINGS = NULL -AssertionValue TYPE = FT_STRING DISPLAY = BASE_NONE STRINGS = NULL #.FN_PARS LDAPOID VAL_PTR = ¶meter_tvb #.FN_HDR LDAPOID @@ -427,3 +426,4 @@ ldap_conv_info_t *ldap_info; #.NO_EMIT AttributeType Attribute +AssertionValue diff --git a/asn1/ldap/packet-ldap-template.c b/asn1/ldap/packet-ldap-template.c index 2d8dadb8cf..a74b4d9dba 100644 --- a/asn1/ldap/packet-ldap-template.c +++ b/asn1/ldap/packet-ldap-template.c @@ -103,6 +103,8 @@ static int hf_ldap_sasl_buffer_length = -1; static int hf_ldap_response_in = -1; static int hf_ldap_response_to = -1; static int hf_ldap_time = -1; +static int hf_ldap_assertionValue_str = -1; /* string AssertionValue*/ +static int hf_ldap_assertionValue_bin = -1; /* binary AssertionValue*/ static int hf_mscldap_netlogon_type = -1; static int hf_mscldap_netlogon_flags = -1; @@ -246,6 +248,41 @@ ldap_info_equal_unmatched(gconstpointer k1, gconstpointer k2) return key1->messageId==key2->messageId; } +/* if the octet string contain all ascii characters then display it as + * a string else display it in the defaulkt HEX mode + */ +static int +dissect_ldap_AssertionValue(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) +{ + tvbuff_t *str_tvb=NULL; + int i, len, is_ascii=0; + char *str; + + /* grab a tvb of the octet string so we can check if it is ascii or binary */ + dissect_ber_octet_string(implicit_tag, pinfo, NULL, tvb, offset, hf_index, &str_tvb); + + if(str_tvb){ + len=tvb_length(str_tvb); + if(len>0){ + str=tvb_get_ptr(str_tvb, 0, len); + is_ascii=1; + for(i=0;i