Commit Graph

126 Commits

Author SHA1 Message Date
Graeme Lunt abefaf32bf Basic Encoding Rules (BER) encoded file reading. Not really a packet trace format but still useful for dissecting arbitrary BER/DER ASN.1.
svn path=/trunk/; revision=18110
2006-05-08 19:56:36 +00:00
Graeme Lunt 759203ed61 Preference to disable BER length sanity check (needed for asn2eth LDAP dissector).
svn path=/trunk/; revision=18056
2006-05-01 09:26:40 +00:00
Graeme Lunt 011ced394c Support for Session Extended User Data and IMPLICIT APPLICATION tagged bitstrings
svn path=/trunk/; revision=17726
2006-03-25 16:32:46 +00:00
Jaap Keuter 09f2ccdca3 Fix bug 819: make sure to always return a tvb pointer.
svn path=/trunk/; revision=17656
2006-03-17 11:46:07 +00:00
Ronnie Sahlberg 6ea1f1a77c coverity bug 68
prevent a very very long loop


svn path=/trunk/; revision=17625
2006-03-14 07:47:19 +00:00
Gerald Combs 172556500d Remove MIN and MAX defines, which GLib provides.
svn path=/trunk/; revision=17551
2006-03-09 16:00:33 +00:00
Jaap Keuter 3b2760d2df Catch negative return value, leading to near infinite loop.
Filed as coverity bug 136.

svn path=/trunk/; revision=17498
2006-03-07 15:22:57 +00:00
Ronnie Sahlberg 590d27a8c0 add new dissect_ber_integer64() that can handle 8,16,24,32 and 64bit integers.
use proto_tree_add_[u]int[8,16,24,32,64]() instread of proto_tree_add_item()
since BER integers may well be encoded in less bytes than the type requires.
(i do not think the old code with proto_tree_add_item() could have handleded negative values very well    or at all.)




svn path=/trunk/; revision=17425
2006-02-28 09:39:53 +00:00
Ronnie Sahlberg b63bc8410a fix bug 400
the choice dissector didnt sometimes use the correct next_tvb.
based on a bogus variable    'first_pass'   that was added as a qad solution to some weird CMIP problem.





svn path=/trunk/; revision=17142
2006-02-02 08:34:59 +00:00
Jörg Mayer 1900bf87fc done:
packet-ntp.c: Rather confused and incorrect use of g_snprintf return value
packet-pim.c: whitespace change
packet-icmpv6.c: g_snprintf takes trailing \0 into account, fix off by 1 error
packet-clnp.c: Fix incorrect use of g_snprintf return value
packet-isakmp.c: g_snprintf takes trailing \0 into account
packet-tr.c: Fix incorrect use of g_snprintf return value
packet-radius.c: Fix incorrect use of g_snprintf return value
packet-radius.h: constify a string variable
packet-ldap.c: The return value isn't needed, so don't use it incorrectly
packet-tcp.c: Fix incorrect use of g_snprintf return value
packet-windows-common.c: Remove unneeded DISSECTOR_ASSERT
packet-smb-sidsnooping.c: g_snprintf takes trailing \0 into account
packet-pvfs2.c: g_snprintf takes trailing \0 into account
packet-ptp.c: Remove #include snprintf
packet-ppp.c: Fix incorrect use of g_snprintf return value
packet-ospf.c: Fix incorrect use of g_snprintf return value
packet-mip6.c: snprintf -> g_snprintf
packet-bootp.c: Remove a commented out bad use of g_snprintf
packet-ber.c: snprintf -> g_snprintf, g_snprintf takes trailing \0 into account

2do:

     52 packet-ieee80211.c: 2DO
      2 packet-nfs.c: 2DO - too many side effects
     33 packet-bgp.c: 2DO
     18 packet-dns.c: 2DO
     14 packet-dcm.c: 2DO
     13 packet-x11.c: 2DO
     11 packet-kerberos.c: 2DO
     10 packet-diameter.c: 2DO
      9 packet-snmp.c: 2DO
      9 packet-pgm.c: 2DO
      7 packet-nbns.c: 2DO
      6 packet-fcswils.c: 2DO
      5 packet-wccp.c: 2DO
      5 packet-cops.c: 2DO
      4 packet-wtp.c: 2DO


svn path=/trunk/; revision=17038
2006-01-16 07:59:44 +00:00
Anders Broman 7980c9295e From Graeme Lunt:
Here is a patch for packet-ber.c that only includes the upgraded dissect_unknown_ber()

svn path=/trunk/; revision=16798
2005-12-14 20:45:15 +00:00
Guy Harris a770b7b647 "get_oid_name()" can return a null pointer; don't try to add the name if
it does.

svn path=/trunk/; revision=16735
2005-12-08 23:21:26 +00:00
Guy Harris aaf8a3060d Clean up indentation.
For OID fields of type FT_STRING, put back the code to append the OID
name.  (Ultimately, we should probably convert them all to type FT_OID.)

svn path=/trunk/; revision=16734
2005-12-08 11:27:14 +00:00
Tomas Kukosa a5bfb48c2f OBJECT IDENTIFIER name resolution moved to oid_resolv.c
svn path=/trunk/; revision=16699
2005-12-06 11:45:55 +00:00
Anders Broman e74a09cd01 If we don't have the OID name let the SNMP dissector try to get it from the MIB:s
svn path=/trunk/; revision=16680
2005-12-05 17:24:19 +00:00
Tomas Kukosa dcae7d303f new field type FT_OID for OBJECT IDENTIFIERs
svn path=/trunk/; revision=16652
2005-12-02 13:16:58 +00:00
Guy Harris d25e4c8e0f Fix typoes in comments.
Update a comment, and get rid of a commented-out unused variable.

Use "get_ber_identifier()" and "get_ber_length()", rather than
"dissect_ber_identifier()" and "dissect_ber_length()", if we're just
fetching the values, rather than dissecting them.  As we're just
fetching the values, if we get an error, put the identifer and length
into the protocol tree (if we've enabled that) with
"dissect_ber_identifier()" and "dissect_ber_length()".

Properly declare class and tag variables as signed.

svn path=/trunk/; revision=16602
2005-11-26 04:16:40 +00:00
Guy Harris 12ae3bba4d Don't crash if a null OID pointer is passed to
"call_ber_oid_callback()".  (Arguably, the caller of
"call_ber_oid_callback()" should check for that, and report that a
presumably-required field is missing.)

svn path=/trunk/; revision=16544
2005-11-18 10:06:47 +00:00
Tomas Kukosa 3b770d5c7c - dissect_ber_object_identifier() returns value as tvb
- new dissect_ber_object_identifier_str() function
 - BER dissectors adapted and regenerated

svn path=/trunk/; revision=16501
2005-11-14 10:02:31 +00:00
Ronnie Sahlberg ce341ab40f add decoding of some more universal types for the opportunistic decode of unknown ber blobs.
svn path=/trunk/; revision=16343
2005-10-27 11:27:40 +00:00
Ronnie Sahlberg 3824015b82 remove a strcpy call
svn path=/trunk/; revision=16237
2005-10-16 00:36:43 +00:00
Guy Harris 2d14a6f4ae Show unsigned quantities as such.
svn path=/trunk/; revision=16001
2005-09-25 09:07:41 +00:00
Guy Harris c952476658 Squelch some compiler wranings, and fix up the creation of a subset
tvbuff.

Fix indentation.

svn path=/trunk/; revision=15921
2005-09-21 01:47:46 +00:00
Gerald Combs ba83bf145f Don't try to reassemble a zero-length fragment. Add a comment to
reassemble.c about the handling of zero-length fragments.

svn path=/trunk/; revision=15899
2005-09-20 17:23:19 +00:00
Gerald Combs d2e3d45042 In the SPNEGO dissector, don't call a subdissector if we don't have a TVB.
Fixes bugs 448, 449, 451, 452, 454, 456, and 461.

Add similar TVB checks to the BER dissector.

svn path=/trunk/; revision=15869
2005-09-19 16:23:05 +00:00
Guy Harris 138e7409d3 If the tag field is a bitfield, always show it as such, otherwise always
show the value of 1 1111 as "Continued" in the bitfield and the actual
tag value in the following bytes.

Show the BER identifier data before an OID if we're showing internal BER
fields.

svn path=/trunk/; revision=15856
2005-09-18 16:54:00 +00:00
Anders Broman 7ef861a9a9 If unkown Tag's are found in a set add length.
svn path=/trunk/; revision=15853
2005-09-17 21:02:51 +00:00
Guy Harris 806a9d66ac Note problems with some values that appear in, for example, some SNMP
captures.

svn path=/trunk/; revision=15833
2005-09-16 08:30:35 +00:00
Anders Broman 1f0fec3e78 Dont't carsh if dissect_ber_null() isn't passed a hf_id.
svn path=/trunk/; revision=15797
2005-09-14 17:04:36 +00:00
Ronnie Sahlberg 4b11d44d11 for octet strings that span beyond the end of a "short" tvb, create a new subset tvb of what we have and use that instead of bailing out completely.
svn path=/trunk/; revision=15795
2005-09-14 16:04:59 +00:00
Gerald Combs a151e8cc6a If dissect_ber_octet_string() gives us a null tvb, assume we have a malformed
packet and throw an exception.  Don't pass the null tvb to tvb_length().

svn path=/trunk/; revision=15713
2005-09-07 15:40:59 +00:00
Anders Broman 6b28d6063e From Graeme Lunt:
Attached is a patch to solve the CHOICE problem for review. 

Problem was two-fold:
1) not passing original class/tag to sub-choice we had matched BER_CLASS_ANY
2) not handling a count==0 if we had matched BER_CLASS_ANY 

The patch also includes a my constructed octet string fix again.

svn path=/trunk/; revision=15698
2005-09-06 05:30:06 +00:00
Anders Broman 4e9a8fc4fa branch_taken got lost in the recent changes.
svn path=/trunk/; revision=15687
2005-09-05 16:31:24 +00:00
Gerald Combs d3d87f3c66 Normalize our hf_id checks and make sure our hf_ids are valid before we
try to use them.  This should fix bugs 399 and 401.

svn path=/trunk/; revision=15662
2005-09-01 19:35:23 +00:00
Anders Broman 2273b1b7fc MapDialougePDU.cnf
Fix a typo.

packet-ber.c 
packet-acse.c
packet-cmip.c
- Add  OID(s)

packet-ses.c
Fix export of a value string and change names to the ones used in the protocol spec.

Replace PRES dissector with an asn2eth generated one.

svn path=/trunk/; revision=15614
2005-08-29 20:07:06 +00:00
Ronnie Sahlberg 63044dd424 In the SEQUENCE OF dissector helper
Only count the number of items in the SEQUENCE OF   IFF we have the full TVB containing the entire blob.
Dont count the items if the tvb is "short" since then this would just lead to a [short frame]  before a single item in the SEQUENCE OF has been dissected.




Do we really need to count the items and create a FT_UINT field with the number of items at all?
Then count the items as we are calling the subdissectors and 
append the '# item[s]' text to the FT_NONE items after we finished the loop?




svn path=/trunk/; revision=15607
2005-08-29 08:24:15 +00:00
Anders Broman f5132f8229 From Graeme Lunt:
b) dissect_ber_set() to report missing fields and handle untagged CHOICEs
c) dissect_ber_choice() to handle untagged CHOICEs (within the CHOICE)

svn path=/trunk/; revision=15597
2005-08-28 19:50:36 +00:00
Guy Harris 815f003071 When creating subset tvbuffs, set the length to the minimum of the
desired reported length and the remaining length, so we don't throw an
exception at tvbuff creation time if we don't have all the desired data
- we want to throw the exception at dissection time, so we can dissect
the data we do have.

Use "tvb_ensure_bytes_exist()" to force exceptions to be thrown.

When "dissect_unknown_ber()" is called from "call_ber_oid_callback()",
we're handing it a newly-created tvbuff, so the offset in that tvbuff
should be zero.

svn path=/trunk/; revision=15595
2005-08-28 17:57:30 +00:00
Guy Harris 40bf84f711 ...and don't print a separating comma if you haven't already printed an
item.

svn path=/trunk/; revision=15572
2005-08-27 18:44:57 +00:00
Guy Harris 99ff1832d7 If you don't print an "(", don't print a ")".
svn path=/trunk/; revision=15570
2005-08-27 18:16:35 +00:00
Guy Harris 9fa5d5fd9e Fix the parenthesization of an expression.
svn path=/trunk/; revision=15514
2005-08-23 08:01:46 +00:00
Anders Broman 6d52a0369a From Graeme Lunt:
Zero length elements (e.g. an empty SET) the logic is slightly wrong in get_ber_length().

Make SET work.


svn path=/trunk/; revision=15508
2005-08-22 05:49:09 +00:00
Ronnie Sahlberg a34e7e3d03 removal of even more sprintf
svn path=/trunk/; revision=15457
2005-08-20 02:33:33 +00:00
Guy Harris 8fe4435694 Set "hoffset" before using it.
svn path=/trunk/; revision=15416
2005-08-19 01:56:14 +00:00
Anders Broman 1e1df99990 From Tim Endean:
Small patch to ber.c

The tcap dissector has been updated to use this length. I have not tested other asn.1 dissectors to ensure that they correctly use the indefinite encoding flag instead of the length value returning zero. 

There may also be some problems when re-assembly is needed, but the ability to deal with indefinite length is much more useful.

For developers the get_ber_length now returns the length of the pdu including the EOC, where you have dissectors that use packet-ber.c the eoc may need to be dealt with separately.

The tcap dissector has had numerous changes to make it less cluttered, and the useful feature of the previous version where a dialogue could be filtered out by selecting either the source or destination transaction ID has been incorporated into this version.

svn path=/trunk/; revision=15414
2005-08-18 21:36:59 +00:00
Ronnie Sahlberg dc2f29288a Tim's patches for packet-ber for extra testing (works ok with my and with Anders captures)
Anders'  beginnings of a new dissect_ber_set() function

 

svn path=/trunk/; revision=15402
2005-08-18 08:37:31 +00:00
Gerald Combs 699bd0fa60 Add checks for infinite loops. Fixes recent Buildbot failures.
svn path=/trunk/; revision=15292
2005-08-11 15:35:17 +00:00
Ulf Lamping 0dc9fb3d4a various code cleanup:
-use g_snprintf instead of sprintf and snprintf
-use g_strdup_printf where appropriate
-remove #include "snprintf.h" (as only g_snprintf should be used)
-replace some more alloc/realloc/calloc/free with their glib pendants

svn path=/trunk/; revision=15264
2005-08-08 18:50:39 +00:00
Jörg Mayer 2b2506f0f6 More char -> const char warning fixes
svn path=/trunk/; revision=15222
2005-08-05 13:10:58 +00:00
Guy Harris c8fc6a8e76 Cast away some (otherwise unremovable, and harmless, in this case)
warnings.

svn path=/trunk/; revision=15135
2005-07-29 03:27:59 +00:00