diff options
-rw-r--r-- | asn1/ldap/ldap.cnf | 2 | ||||
-rw-r--r-- | asn1/ldap/packet-ldap-template.c | 47 | ||||
-rw-r--r-- | epan/dissectors/packet-ldap.c | 102 |
3 files changed, 118 insertions, 33 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, diff --git a/epan/dissectors/packet-ldap.c b/epan/dissectors/packet-ldap.c index 5e5c2c5531..183bc58820 100644 --- a/epan/dissectors/packet-ldap.c +++ b/epan/dissectors/packet-ldap.c @@ -111,6 +111,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; @@ -239,7 +241,7 @@ static int hf_ldap_responseName = -1; /* ResponseName */ static int hf_ldap_response = -1; /* OCTET_STRING */ /*--- End of included file: packet-ldap-hf.c ---*/ -#line 133 "packet-ldap-template.c" +#line 135 "packet-ldap-template.c" /* Initialize the subtree pointers */ static gint ett_ldap = -1; @@ -289,7 +291,7 @@ static gint ett_ldap_ExtendedRequest = -1; static gint ett_ldap_ExtendedResponse = -1; /*--- End of included file: packet-ldap-ett.c ---*/ -#line 142 "packet-ldap-template.c" +#line 144 "packet-ldap-template.c" static dissector_table_t ldap_name_dissector_table=NULL; @@ -397,6 +399,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; @@ -575,7 +612,7 @@ static int dissect_not_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, static int dissect_ldap_MessageID(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { -#line 53 "ldap.cnf" +#line 52 "ldap.cnf" offset = dissect_ber_integer(implicit_tag, pinfo, tree, tvb, offset, hf_index, &MessageID); @@ -608,7 +645,7 @@ static int dissect_version(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, static int dissect_ldap_LDAPString(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { -#line 240 "ldap.cnf" +#line 239 "ldap.cnf" tvbuff_t *parameter_tvb = NULL; char *ldapstring; gchar *sc = NULL; /* semi-colon pointer */ @@ -716,7 +753,7 @@ static int dissect_newSuperior_impl(packet_info *pinfo, proto_tree *tree, tvbuff static int dissect_ldap_Simple(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { -#line 103 "ldap.cnf" +#line 102 "ldap.cnf" ldap_conv_info_t *ldap_info; offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index, @@ -740,7 +777,7 @@ static int dissect_simple_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t *t static int dissect_ldap_Mechanism(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { -#line 114 "ldap.cnf" +#line 113 "ldap.cnf" ldap_conv_info_t *ldap_info; tvbuff_t *parameter_tvb; @@ -792,7 +829,7 @@ static int dissect_mechanism(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb static int dissect_ldap_Credentials(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { -#line 153 "ldap.cnf" +#line 152 "ldap.cnf" tvbuff_t *parameter_tvb; ldap_conv_info_t *ldap_info; @@ -860,7 +897,7 @@ static const ber_choice_t AuthenticationChoice_choice[] = { static int dissect_ldap_AuthenticationChoice(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { -#line 399 "ldap.cnf" +#line 398 "ldap.cnf" gint branch = -1; gint auth = -1; const gchar *valstr; @@ -958,7 +995,7 @@ static const value_string ldap_BindResponse_resultCode_vals[] = { static int dissect_ldap_BindResponse_resultCode(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { -#line 341 "ldap.cnf" +#line 340 "ldap.cnf" const gchar *valstr; @@ -1036,7 +1073,7 @@ static int dissect_referral_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t static int dissect_ldap_ServerSaslCreds(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { -#line 179 "ldap.cnf" +#line 178 "ldap.cnf" tvbuff_t *parameter_tvb; ldap_conv_info_t *ldap_info; @@ -1130,7 +1167,7 @@ static int dissect_bindResponse(packet_info *pinfo, proto_tree *tree, tvbuff_t * static int dissect_ldap_UnbindRequest(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { -#line 420 "ldap.cnf" +#line 419 "ldap.cnf" implicit_tag = TRUE; /* correct problem with asn2wrs */ @@ -1158,7 +1195,7 @@ static const value_string ldap_T_scope_vals[] = { static int dissect_ldap_T_scope(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { -#line 300 "ldap.cnf" +#line 299 "ldap.cnf" gint scope; const gchar *valstr; @@ -1286,15 +1323,6 @@ static int dissect_present_impl(packet_info *pinfo, proto_tree *tree, tvbuff_t * return dissect_ldap_AttributeDescription(TRUE, tvb, offset, pinfo, tree, hf_ldap_present); } - - -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_) { - offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index, - NULL); - - return offset; -} static int dissect_assertionValue(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) { return dissect_ldap_AssertionValue(FALSE, tvb, offset, pinfo, tree, hf_ldap_assertionValue); } @@ -1507,7 +1535,7 @@ static int dissect_searchRequest(packet_info *pinfo, proto_tree *tree, tvbuff_t static int dissect_ldap_AttributeValue(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { -#line 362 "ldap.cnf" +#line 361 "ldap.cnf" tvbuff_t *next_tvb; gchar *string; @@ -1667,7 +1695,7 @@ static const value_string ldap_T_resultCode_vals[] = { static int dissect_ldap_T_resultCode(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { -#line 319 "ldap.cnf" +#line 318 "ldap.cnf" const gchar *valstr; @@ -2022,7 +2050,7 @@ static int dissect_abandonRequest(packet_info *pinfo, proto_tree *tree, tvbuff_t static int dissect_ldap_LDAPOID(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { -#line 33 "ldap.cnf" +#line 32 "ldap.cnf" tvbuff_t *parameter_tvb; const gchar *name; @@ -2033,7 +2061,7 @@ dissect_ldap_LDAPOID(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packe offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index, ¶meter_tvb); -#line 40 "ldap.cnf" +#line 39 "ldap.cnf" if (!parameter_tvb) return offset; item = get_ber_last_created_item(); @@ -2229,7 +2257,7 @@ static const ber_choice_t ProtocolOp_choice[] = { static int dissect_ldap_ProtocolOp(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index _U_) { -#line 61 "ldap.cnf" +#line 60 "ldap.cnf" ldap_call_response_t *lcrp; ldap_conv_info_t *ldap_info = (ldap_conv_info_t *)pinfo->private_data; @@ -2240,7 +2268,7 @@ dissect_ldap_ProtocolOp(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, pa ProtocolOp_choice, hf_index, ett_ldap_ProtocolOp, &ProtocolOp); -#line 67 "ldap.cnf" +#line 66 "ldap.cnf" lcrp=ldap_match_call_response(tvb, pinfo, tree, MessageID, ProtocolOp); if(lcrp){ @@ -2356,7 +2384,7 @@ static void dissect_LDAPMessage_PDU(tvbuff_t *tvb, packet_info *pinfo, proto_tre /*--- End of included file: packet-ldap-fn.c ---*/ -#line 398 "packet-ldap-template.c" +#line 435 "packet-ldap-template.c" static void dissect_ldap_payload(tvbuff_t *tvb, packet_info *pinfo, @@ -3129,6 +3157,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, @@ -3348,7 +3386,7 @@ void proto_register_ldap(void) { "AttributeValueAssertion/attributeDesc", HFILL }}, { &hf_ldap_assertionValue, { "assertionValue", "ldap.assertionValue", - FT_STRING, BASE_NONE, NULL, 0, + FT_BYTES, BASE_HEX, NULL, 0, "AttributeValueAssertion/assertionValue", HFILL }}, { &hf_ldap_type, { "type", "ldap.type", @@ -3540,7 +3578,7 @@ void proto_register_ldap(void) { "MatchingRuleAssertion/matchingRule", HFILL }}, { &hf_ldap_matchValue, { "matchValue", "ldap.matchValue", - FT_STRING, BASE_NONE, NULL, 0, + FT_BYTES, BASE_HEX, NULL, 0, "MatchingRuleAssertion/matchValue", HFILL }}, { &hf_ldap_dnAttributes, { "dnAttributes", "ldap.dnAttributes", @@ -3632,7 +3670,7 @@ void proto_register_ldap(void) { "ExtendedResponse/response", HFILL }}, /*--- End of included file: packet-ldap-hfarr.c ---*/ -#line 1281 "packet-ldap-template.c" +#line 1328 "packet-ldap-template.c" }; /* List of subtrees */ @@ -3684,7 +3722,7 @@ void proto_register_ldap(void) { &ett_ldap_ExtendedResponse, /*--- End of included file: packet-ldap-ettarr.c ---*/ -#line 1292 "packet-ldap-template.c" +#line 1339 "packet-ldap-template.c" }; module_t *ldap_module; |