From 2d8152c0728a3867724ce18e8806714b5bc5f749 Mon Sep 17 00:00:00 2001 From: Richard Sharpe Date: Sat, 31 Aug 2002 07:26:10 +0000 Subject: [PATCH] Further fixes. Properly account for the length of headers. Still some headers that we do not account for properly, like Octet Strings. svn path=/trunk/; revision=6152 --- packet-smb.c | 5 ++++- packet-spnego.c | 29 +++++++++++++++++++---------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/packet-smb.c b/packet-smb.c index 535db92b99..cf85d03e6d 100644 --- a/packet-smb.c +++ b/packet-smb.c @@ -3,7 +3,7 @@ * Copyright 1999, Richard Sharpe * 2001 Rewrite by Ronnie Sahlberg and Guy Harris * - * $Id: packet-smb.c,v 1.290 2002/08/31 05:31:41 sharpe Exp $ + * $Id: packet-smb.c,v 1.291 2002/08/31 07:26:10 sharpe Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -2374,6 +2374,9 @@ dissect_negprot_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, in gssapi_handle, gssapi_tvb, pinfo, gssapi_tree); + if (si->ct) + si->ct->raw_ntlmssp = 0; + COUNT_BYTES(bc); } else { diff --git a/packet-spnego.c b/packet-spnego.c index b0d8a8f4b5..5988a40d37 100644 --- a/packet-spnego.c +++ b/packet-spnego.c @@ -4,7 +4,7 @@ * Copyright 2002, Tim Potter * Copyright 2002, Richard Sharpe * - * $Id: packet-spnego.c,v 1.18 2002/08/30 16:17:29 sharpe Exp $ + * $Id: packet-spnego.c,v 1.19 2002/08/31 07:26:10 sharpe Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -271,7 +271,7 @@ dissect_spnego_mechListMIC(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, /* Naughty ... but we have to adjust for what we never took */ - hnd->offset += 4; + hnd->offset += len1; offset += len1; } @@ -350,9 +350,10 @@ dissect_spnego_negTokenInit(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, offset = hnd->offset; - len1 -= 2; /* Account for the Header above ... */ - while (len1) { + int hdr_ofs; + + hdr_ofs = hnd->offset; ret = asn1_header_decode(hnd, &cls, &con, &tag, &def, &len); @@ -363,13 +364,16 @@ dissect_spnego_negTokenInit(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, } if (!(cls == ASN1_CTX && con == ASN1_CON)) { - proto_tree_add_text( - subtree, tvb, offset, 0, + proto_tree_add_text(subtree, tvb, offset, 0, "Unknown header (cls=%d, con=%d, tag=%d)", cls, con, tag); goto done; } + /* Adjust for the length of the header */ + + len1 -= (hnd->offset - hdr_ofs); + /* Should be one of the fields */ switch (tag) { @@ -402,7 +406,7 @@ dissect_spnego_negTokenInit(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, break; } - len1 -= (len + 2); /* Account for header */ + len1 -= len; } @@ -578,7 +582,6 @@ dissect_spnego_responseToken(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, return offset + nbytes; } - static int dissect_spnego_negTokenTarg(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, ASN1_SCK *hnd) @@ -626,6 +629,9 @@ dissect_spnego_negTokenTarg(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, offset = hnd->offset; while (len1) { + int hdr_ofs; + + hdr_ofs = hnd->offset; ret = asn1_header_decode(hnd, &cls, &con, &tag, &def, &len); @@ -643,6 +649,10 @@ dissect_spnego_negTokenTarg(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, goto done; } + /* Adjust for the length of the header */ + + len1 -= (hnd->offset - hdr_ofs); + /* Should be one of the fields */ switch (tag) { @@ -677,9 +687,8 @@ dissect_spnego_negTokenTarg(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, break; } - len1 -= (len + 2); /* FIXME: The +2 may be wrong */ + len1 -= len; - printf("len1 = %d\n", len1); } done: