diff options
author | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2007-09-25 08:05:17 +0000 |
---|---|---|
committer | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2007-09-25 08:05:17 +0000 |
commit | 84b28f1399b1c285196becb12d462e10c98ef7d4 (patch) | |
tree | 6269078afc3082eb8421d2ed5af9598a75c0565b /epan | |
parent | dea0c3c9de82f45858c9ac62430644f5283b290f (diff) |
only set ldap_info->first_auth_frame to 0 first time we see the
authentication packet or else we will get inconsistent dissection when
clicking on packets.
(inconsistent as in : a certain packet might/might not be dissected as
LDAP/SASL depending on which packets we clicked on previously)
svn path=/trunk/; revision=22949
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-ldap.c | 97 |
1 files changed, 49 insertions, 48 deletions
diff --git a/epan/dissectors/packet-ldap.c b/epan/dissectors/packet-ldap.c index 1bc55cb262..a4e97a14f2 100644 --- a/epan/dissectors/packet-ldap.c +++ b/epan/dissectors/packet-ldap.c @@ -754,7 +754,7 @@ dissect_ldap_INTEGER_1_127(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off static int dissect_ldap_LDAPString(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 275 "ldap.cnf" +#line 276 "ldap.cnf" tvbuff_t *parameter_tvb = NULL; char *ldapstring; gchar *sc = NULL; /* semi-colon pointer */ @@ -898,24 +898,25 @@ char *mechanism = NULL; * type and mechanism, if you can unbind and rebind with a * different type and/or mechanism. */ - mechanism = tvb_get_string(parameter_tvb, 0, tvb_length_remaining(parameter_tvb,0)); - ldap_info->first_auth_frame = 0; /* not known until we see the bind reply */ - /* - * If the mechanism in this request is an empty string (which is - * returned as a null pointer), use the saved mechanism instead. - * Otherwise, if the saved mechanism is an empty string (null), - * save this mechanism. - */ - if (mechanism == NULL) - mechanism = ldap_info->auth_mech; - else { - if (ldap_info->auth_mech != NULL) { - g_free(ldap_info->auth_mech); - } - ldap_info->auth_mech = mechanism; - } + if(!actx->pinfo->fd->flags.visited) { + mechanism = tvb_get_string(parameter_tvb, 0, tvb_length_remaining(parameter_tvb,0)); + ldap_info->first_auth_frame = 0; /* not known until we see the bind reply */ + /* + * If the mechanism in this request is an empty string (which is + * returned as a null pointer), use the saved mechanism instead. + * Otherwise, if the saved mechanism is an empty string (null), + * save this mechanism. + */ + if (mechanism == NULL) { + mechanism = ldap_info->auth_mech; + } else { + if (ldap_info->auth_mech != NULL) { + g_free(ldap_info->auth_mech); + } + ldap_info->auth_mech = mechanism; + } actx->pinfo->private_data = ldap_info; - + } return offset; @@ -925,7 +926,7 @@ char *mechanism = NULL; static int dissect_ldap_Credentials(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 165 "ldap.cnf" +#line 166 "ldap.cnf" tvbuff_t *parameter_tvb; ldap_conv_info_t *ldap_info; @@ -991,7 +992,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 628 "ldap.cnf" +#line 629 "ldap.cnf" /* make sure the protocol op comes first */ ldap_do_protocolop(actx->pinfo); @@ -1007,7 +1008,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 635 "ldap.cnf" +#line 636 "ldap.cnf" /* make sure the protocol op comes first */ ldap_do_protocolop(actx->pinfo); @@ -1038,7 +1039,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 449 "ldap.cnf" +#line 450 "ldap.cnf" gint branch = -1; gint auth = -1; const gchar *valstr; @@ -1131,7 +1132,7 @@ static const value_string ldap_BindResponse_resultCode_vals[] = { static int dissect_ldap_BindResponse_resultCode(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 393 "ldap.cnf" +#line 394 "ldap.cnf" const gchar *valstr; @@ -1163,7 +1164,7 @@ dissect_ldap_BindResponse_resultCode(gboolean implicit_tag _U_, tvbuff_t *tvb _U static int dissect_ldap_T_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 642 "ldap.cnf" +#line 643 "ldap.cnf" tvbuff_t *new_tvb=NULL; offset = dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_ldap_matchedDN, &new_tvb); @@ -1224,7 +1225,7 @@ dissect_ldap_Referral(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _ static int dissect_ldap_ServerSaslCreds(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 205 "ldap.cnf" +#line 206 "ldap.cnf" tvbuff_t *parameter_tvb; ldap_conv_info_t *ldap_info; @@ -1323,7 +1324,7 @@ dissect_ldap_BindResponse(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs 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 471 "ldap.cnf" +#line 472 "ldap.cnf" implicit_tag = TRUE; /* correct problem with asn2wrs */ @@ -1352,7 +1353,7 @@ static const value_string ldap_T_scope_vals[] = { static int dissect_ldap_T_scope(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 356 "ldap.cnf" +#line 357 "ldap.cnf" gint scope; const gchar *valstr; @@ -1419,7 +1420,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 505 "ldap.cnf" +#line 506 "ldap.cnf" if(and_filter_string){ and_filter_string=ep_strdup_printf("(&%s%s)",and_filter_string,Filter_string); } else { @@ -1437,7 +1438,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 512 "ldap.cnf" +#line 513 "ldap.cnf" proto_tree *tr=NULL; proto_item *it=NULL; char *old_and_filter_string=and_filter_string; @@ -1468,7 +1469,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 530 "ldap.cnf" +#line 531 "ldap.cnf" if(or_filter_string){ or_filter_string=ep_strdup_printf("(|%s%s)",or_filter_string,Filter_string); } else { @@ -1487,7 +1488,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 538 "ldap.cnf" +#line 539 "ldap.cnf" proto_tree *tr=NULL; proto_item *it=NULL; char *old_or_filter_string=or_filter_string; @@ -1516,7 +1517,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 557 "ldap.cnf" +#line 558 "ldap.cnf" Filter_string=ep_strdup_printf("(!%s)",Filter_string); @@ -1554,7 +1555,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 490 "ldap.cnf" +#line 491 "ldap.cnf" Filter_string=ep_strdup_printf("(%s=%s)",attributedesc_string,ldapvalue_string); @@ -1583,7 +1584,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 583 "ldap.cnf" +#line 584 "ldap.cnf" if (substring_item_final) { substring_value=ep_strdup_printf("%s%s", (substring_value?substring_value:"*"), @@ -1623,7 +1624,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 597 "ldap.cnf" +#line 598 "ldap.cnf" proto_tree *tr=NULL; proto_item *it=NULL; char *old_substring_value=substring_value; @@ -1655,7 +1656,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 494 "ldap.cnf" +#line 495 "ldap.cnf" Filter_string=ep_strdup_printf("(%s>=%s)",attributedesc_string,ldapvalue_string); @@ -1669,7 +1670,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 498 "ldap.cnf" +#line 499 "ldap.cnf" Filter_string=ep_strdup_printf("(%s<=%s)",attributedesc_string,ldapvalue_string); @@ -1683,7 +1684,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 554 "ldap.cnf" +#line 555 "ldap.cnf" Filter_string=ep_strdup_printf("(%s=*)",Filter_string); @@ -1696,7 +1697,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 502 "ldap.cnf" +#line 503 "ldap.cnf" Filter_string=ep_strdup_printf("(%s~=%s)",attributedesc_string,ldapvalue_string); @@ -1716,7 +1717,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 560 "ldap.cnf" +#line 561 "ldap.cnf" gboolean val; offset = dissect_ber_boolean_value(implicit_tag, actx, tree, tvb, offset, hf_index, &val); @@ -1751,7 +1752,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 569 "ldap.cnf" +#line 570 "ldap.cnf" attr_type=NULL; matching_rule_string=NULL; ldapvalue_string=NULL; @@ -1760,7 +1761,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 575 "ldap.cnf" +#line 576 "ldap.cnf" Filter_string=ep_strdup_printf("(%s:%s%s%s=%s)", (attr_type?attr_type:""), (matching_rule_dnattr?"dn:":""), @@ -1803,7 +1804,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 616 "ldap.cnf" +#line 617 "ldap.cnf" proto_tree *tr=NULL; proto_item *it=NULL; @@ -1827,13 +1828,13 @@ 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 483 "ldap.cnf" +#line 484 "ldap.cnf" Filter_string=NULL; offset = dissect_ldap_Filter(implicit_tag, tvb, offset, actx, tree, hf_index); -#line 486 "ldap.cnf" +#line 487 "ldap.cnf" Filter_string=NULL; and_filter_string=NULL; @@ -1879,7 +1880,7 @@ dissect_ldap_SearchRequest(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off static int dissect_ldap_AttributeValue(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 414 "ldap.cnf" +#line 415 "ldap.cnf" tvbuff_t *next_tvb; gchar *string; @@ -2024,7 +2025,7 @@ static const value_string ldap_T_resultCode_vals[] = { static int dissect_ldap_T_resultCode(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 373 "ldap.cnf" +#line 374 "ldap.cnf" const gchar *valstr; @@ -2569,7 +2570,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 658 "ldap.cnf" +#line 659 "ldap.cnf" gint8 class; gboolean pc, ind; gint32 tag; |