diff options
author | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2006-06-10 05:07:42 +0000 |
---|---|---|
committer | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2006-06-10 05:07:42 +0000 |
commit | fcf198a69d3b985907ac84b17aefd8e8dc6a12f0 (patch) | |
tree | e8d09b6b69a6399c55401d34b6bfccf7ab045512 /asn1/ldap | |
parent | 5e49882844be74fd17b3ecb8173d5ea6c6e32a5d (diff) |
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
Diffstat (limited to 'asn1/ldap')
-rw-r--r-- | asn1/ldap/ldap.cnf | 2 | ||||
-rw-r--r-- | asn1/ldap/packet-ldap-template.c | 47 |
2 files changed, 48 insertions, 1 deletions
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<len;i++){ + if(str[i]<0x20){ + is_ascii=0; + } + } + } + } + + if(is_ascii){ + offset=dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_ldap_assertionValue_str, NULL); + } else { + offset=dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_ldap_assertionValue_bin, NULL); + } + + return offset; +} + /* Global variables */ char *mechanism = NULL; static gint MessageID =-1; @@ -1167,6 +1204,16 @@ void proto_register_ldap(void) { FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, "The time between the Call and the Reply", HFILL }}, + { &hf_ldap_assertionValue_str, + { "assertionValue", "ldap.assertionValue_str", + FT_STRING, BASE_NONE, NULL, 0, + "AttributeValueAssertion/assertionValue", HFILL }}, + + { &hf_ldap_assertionValue_bin, + { "assertionValue", "ldap.assertionValue_bin", + FT_BYTES, BASE_HEX, NULL, 0, + "AttributeValueAssertion/assertionValue", HFILL }}, + { &hf_mscldap_netlogon_type, { "Type", "mscldap.netlogon.type", FT_UINT32, BASE_DEC, NULL, 0x0, |