Commit Graph

154 Commits

Author SHA1 Message Date
Hadriel Kaplan ceb8d954d2 Lua: Expose tcp_dissect_pdus() to Lua
Provide a way for Lua-based dissectors to invoke tcp_dissect_pdus()
to make TCP-based dissection easier.

Bug: 9851
Change-Id: I91630ebf1f1fc1964118b6750cc34238e18a8ad3
Reviewed-on: https://code.wireshark.org/review/6778
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Hadriel Kaplan <hadrielk@yahoo.com>
2015-01-27 15:14:12 +00:00
Michael Mann e333e4c90f Convert OID APIs to use wmem.
There are a few oid functions that are only called in oids_test.c.  I'll presume the APIs are used in proprietary dissectors rather than just remove them.

Change-Id: I4595e00f93bf9ab8cf2493fe0432b91960f55a3f
Reviewed-on: https://code.wireshark.org/review/6592
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-19 02:52:11 +00:00
Pascal Quantin c326fcaf9b LDAP: g8c608e6 did not include the changes in template file, that got lost afterwards
Change-Id: I5d79d3e48c1ad83713a312dce39b749f47b0ecc8
Reviewed-on: https://code.wireshark.org/review/6612
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-01-18 11:25:07 +00:00
Guy Harris bc23f79729 UAT error string pointers should not be const pointers.
UAT error strings are usually allocated by g_strdup() or
g_strdup_printf(), and must ultimately be freed by the caller.

Make the pointer-to-error-string-pointer arguments to various functions
be "char **", not "const char **".

Fix cases that finds where a raw string was being used, as that won't
work if you try to free it; g_strdup() it instead.

Add a missing free of an error string.

Remove some no-longer-necessary casts.

Remove some unnecessary g_strdup()s (the string being handed to it was
already g_malloc()ated).

Change some variable declarations to match.

Put in XXX comments for some cases where the error string is just freed,
without being shown to the user.

Change-Id: I40297746a2ef729c56763baeddbb0842386fa0d0
Reviewed-on: https://code.wireshark.org/review/6525
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-13 20:20:03 +00:00
Bill Meier dd859eada4 asn1 generated dissectors: cleanup #include usage
Change-Id: I36b2731d67f9345d2fd0c23800bba7d2be94c387
Reviewed-on: https://code.wireshark.org/review/6008
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-12-23 05:39:00 +00:00
Stig Bjørlykke ea167053ff Improved deregistering fields.
This improvement avoids use of deallocated memory (crash) if using a
deregistered field in display filter, color filter, custom column and
other cases when the field is used as "interesting field".

This functionality is currently used in http, imf and ldap preferences.

Also removed unused proto_registrar_n() as this does not work correctly
after deregistering fields.

Change-Id: I043e3bf7a98bd773c9801e712a012d1eab8a7f94
Reviewed-on: https://code.wireshark.org/review/5161
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-11-10 08:01:12 +00:00
Guy Harris 77acaa1f48 Get rid of unnecessary includes of ctype.h.
Change-Id: I9e2cd7a9fed33fc2f4b0c0da3603690450f6952d
Reviewed-on: https://code.wireshark.org/review/4809
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-18 01:22:31 +00:00
Stig Bjørlykke a25ae55c92 LDAP: Improved a if-check to avoid a analyzis warning.
Change-Id: Iceeaa94a80543570a720281ac39d3ccd9ac924fa
Reviewed-on: https://code.wireshark.org/review/4699
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-10-15 10:53:59 +00:00
Stig Bjørlykke 4e1b5ea866 ASN1: Register PDU-dissectors as NEW
Change-Id: I1a317b19d8076588c9305dae6287bb80cc14da64
Reviewed-on: https://code.wireshark.org/review/4494
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-10-13 11:24:07 +00:00
Bill Meier a379ac74d2 Fix spelling: cant-->can't, wont-->won't, etc
Change-Id: Ia6c3e7a25615bf8e052c3bacf096d76df775c9c2
Reviewed-on: https://code.wireshark.org/review/4126
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-09-16 15:31:58 +00:00
Guy Harris 21adbaa052 Don't use the captured length, and don't fetch the version until we need it.
The captured length reflects the way the capture was done; it should not
affect actual lengths used in the dissection.

Don't fetch the version until we need it; that lets us dissect more of
the packet if the previous change caused us to throw an exception trying
to fetch the version from the correct location rather than not throwing
an exception by fetching it from an incorrect location that happens to
be within the captured data.

Change-Id: I9f63afd4ef51f46c19b3afd2a651a5bb768fecaf
Reviewed-on: https://code.wireshark.org/review/4101
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-09-14 00:11:21 +00:00
Guy Harris 12778395d3 Clean up indentation.
Change-Id: Ie43c3a55aa954c1ec640ec90c74356b2b19e4156
Reviewed-on: https://code.wireshark.org/review/4100
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-09-13 23:50:42 +00:00
Michael Mann cd02af56a1 Eliminate (almost all) proto_tree_add_text calls from ASN.1 dissectors.
This mostly involved adding expert info capabilities to many of the dissectors so that they could correctly flag error conditions.

Only remaining proto_tree_add_text calls are in H248.cnf, which has a convoluted way of using hf_ data to make its tree.

Change-Id: I6412150c2ec1977d7fa38f3f0ed416680bdfb141
Reviewed-on: https://code.wireshark.org/review/3500
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-08-09 01:57:08 +00:00
Evan Huus 83da877fff Add back initializers dropped in g9356d5c689fa
They were actually necessary.

Bug:10224
Change-Id: I9973bf7bab670d12e5b90bb2a57e99f9125d6a07
Reviewed-on: https://code.wireshark.org/review/2632
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-24 22:28:11 +00:00
Michael Mann 9356d5c689 convert to proto_tree_add_subtree[_format] for ASN.1 dissectors
Change-Id: I753ca95e2e1b38bad2c09955317e648c525e40ef
Reviewed-on: https://code.wireshark.org/review/2509
Tested-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-22 21:08:21 +00:00
Evan Huus 37b903d7ab batch of tvb-length conversions
Change-Id: I76ca4d075756e3ac691070e0c05344a410ea2498
Reviewed-on: https://code.wireshark.org/review/2507
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-06-21 04:01:52 +00:00
Pascal Quantin d0ac937567 Revert "Update ASN.1 source files with the API changes done in g021e7af"
This reverts commit e308e7c4de.

Change-Id: I079616d63f643f79f1bc03ef5fdf724f36df4071
Reviewed-on: https://code.wireshark.org/review/2435
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-06-19 18:42:28 +00:00
Pascal Quantin e308e7c4de Update ASN.1 source files with the API changes done in g021e7af
Change-Id: I52ecfccbce423206242e3cf99401a8c9e1655d88
Reviewed-on: https://code.wireshark.org/review/2385
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-06-18 16:15:42 +00:00
Michael Mann 73217d9f3f tvb_new_subset -> tvb_new_subset_length when length parameters are equal.
tvb_new_subset -> tvb_new_subset_remaining it appears that's what the intention is.

Change-Id: I2334bbf3f10475b3c22391392fc8b6864454de2d
Reviewed-on: https://code.wireshark.org/review/1999
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-06-07 15:41:07 +00:00
Jeff Morriss 8c608e6e82 Remove $Id$ from the ASN.1 dissectors and regenerate them.
Change-Id: Ie476c6f82f318188b41ed922b92c6fec119ea954
Reviewed-on: https://code.wireshark.org/review/244
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
Tested-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2014-02-18 03:05:28 +00:00
Stig Bjørlykke 3ba10a7051 Apply g4cc69483 to asn1 templates.
Change-Id: Id44ef17e7293be5d713c5e9e5d55b25194b46016
Reviewed-on: https://code.wireshark.org/review/86
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-02-03 10:05:25 +00:00
Guy Harris e163578906 Another tvb_get_string() replacement.
svn path=/trunk/; revision=54890
2014-01-22 02:41:13 +00:00
Anders Broman 3a533ccc32 Omit assignment for not used types.
svn path=/trunk/; revision=54593
2014-01-04 12:03:02 +00:00
Jakub Zawadzki 33ef0c2600 isascii(x) && isprint(x) -> g_ascii_isprint(x)
svn path=/trunk/; revision=54328
2013-12-21 15:12:11 +00:00
Anders Broman 25ce6c262e - Forward declaration of register functions.
svn path=/trunk/; revision=53908
2013-12-10 17:41:57 +00:00
Anders Broman 4124b7aa17 - Forward declaration of register functions.
svn path=/trunk/; revision=53872
2013-12-08 22:02:12 +00:00
Jakub Zawadzki ae59b09443 Add missing includes in order to remove exceptions.h from proto.h (next commit).
svn path=/trunk/; revision=53230
2013-11-10 15:59:37 +00:00
Michael Mann 8081cf1d90 Add data parameter to tcp_dissect_pdus() as well as convert it to using "new" style dissectors.
Now that "bytes consumed" can be determined, should tcp_dissect_pdus() take advantage of that?

Should tcp_dissect_pdus return length (bytes consumed)?  There are many dissectors that just call tcp_dissect_pdus() then return tvb_length(tvb).  Seems like that could all be rolled into one.

svn path=/trunk/; revision=53198
2013-11-09 17:46:28 +00:00
Michael Mann d62f92b7f1 Make LDAP dissector use ASN.1 private_data instead of pinfo->private_data.
Cleanup a forgotten pinfo->private_data use in the H245 dissector.

svn path=/trunk/; revision=53160
2013-11-08 02:02:43 +00:00
Evan Huus 95f484a91e Add a very small hack to make the UAT update callback error string freeable, and
convert all existing UAT update callbacks to use glib memory instead of
ephemeral memory for that string.

UAT code paths are entirely distinct from packet dissection, so using ephemeral
memory was the wrong choice, because there was no guarantees about when it would
be freed.

The move away from emem still needs to be propogated deeper into the UAT code
itself at some point.

Net effect: remove another bunch of emem calls from dissectors, where replacing
with wmem would have caused assertions.

svn path=/trunk/; revision=52854
2013-10-25 22:14:25 +00:00
Pascal Quantin a0c53ffaa1 emem -> wmem conversion:
- ep_tvb_get_bits() -> wmem_packet_tvb_get_bits()
- tvb_g_memdup()/ep_tvb_memdup() -> tvb_memdup()
- tvb_fake_unicode()/tvb_get_ephemeral_faked_unicode() -> tvb_get_faked_unicode()
- tvb_get_g_string()/tvb_get_ephemeral_string()/tvb_get_seasonal_string() -> tvb_get_string()
- tvb_get_g_unicode_string()/tvb_get_ephemeral_unicode_string() -> tvb_get_unicode_string()
- tvb_get_ephemeral_string_enc() -> tvb_get_string_enc()
- update docs accordingly

svn path=/trunk/; revision=52172
2013-09-22 15:50:55 +00:00
Jörg Mayer 888650324b emem -> wmem
svn path=/trunk/; revision=52054
2013-09-15 13:24:14 +00:00
Evan Huus b5900e53d9 Make sure our ldap_call_response_t struct is always completely initialized,
fixing a "Conditional jump or move depends on uninitialised value" error found
by valgrind fuzzing.

svn path=/trunk/; revision=51516
2013-08-25 17:31:15 +00:00
Jakub Zawadzki 9cfac1227d Replace hfinfo pointer to same_name_prev, with same_name_prev_id.
svn path=/trunk/; revision=51175
2013-08-06 20:53:47 +00:00
Evan Huus 7c8530539c Ldap still needs to include wmem.h since it uses wmem during normal dissection,
just not for UAT purposes.

svn path=/trunk/; revision=50074
2013-06-20 14:01:54 +00:00
Evan Huus d63bd5330f Back out some of the wmem conversions (r50063 and r50057).
These dissectors allocate ephemeral or seasonal memory in UAT callbacks, which
really makes no sense because UAT callbacks can occur when there is no packet or
file in scope, making this effectively a leak if the user is fiddling with their
UAT and never opens a capture.

Emem let you get away with this, wmem forces an assertion. Back out the changes
so that the UATs are usable until the code can be properly fixed to not use
out-of-scope allocators.

svn path=/trunk/; revision=50073
2013-06-20 06:26:03 +00:00
Evan Huus b1e12ec925 Convert the rest of the ASN1 dissectors from emem to wmem.
svn path=/trunk/; revision=50063
2013-06-19 22:47:36 +00:00
Michael Mann 7fe5422c4b Convert ASN.1 dissectors to use filterable expert info.
NOTE: Kerberos ASN.1 template was updated, but not generated to source.

svn path=/trunk/; revision=49707
2013-06-03 03:42:36 +00:00
Bill Meier 1f083fd654 From beroset:
remove C++ incompatibilities
 https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 attachments #10423,#10424

svn path=/trunk/; revision=48450
2013-03-21 14:29:58 +00:00
Guy Harris c522bb09c2 The LDAP dissector uses register_frame_end_routine(), so it needs to
include packet-frame.h.

svn path=/trunk/; revision=47928
2013-02-28 00:09:26 +00:00
Guy Harris 6b629c4d92 Move show_exception() and show_reported_bounds_error() to
epan/show_exception.c, as it's used outside
epan/dissectors/packet-frame.c.  Update their callers to include
<epan/show_exception.h> to get their declaration.

Add a CATCH_NONFATAL_ERRORS macro that catches all exceptions that, if
there's more stuff in the packet to dissect after the dissector call
that threw the exception, doesn't mean you shouldn't go ahead and
dissect that stuff.  Use it in all those cases, including ones where
BoundsError was inappropriately being caught (you want those passed up
to the top level, so that the packet is reported as having been cut
short in the capture process).

Add a CATCH_BOUNDS_ERRORS macro that catches all exceptions that
correspond to running past the end of the data for a tvbuff; use it
rather than explicitly catching those exceptions individually, and
rather than just catching all exceptions (the only place that
DissectorError should be caught, for example, is at the top level, so
dissector bugs show up in the protocol tree).

Don't catch and then immediately rethrow exceptions without doing
anything else; just let the exceptions go up to the final catcher.

Use show_exception() to report non-fatal errors, rather than doing it
yourself.
 
If a dissector is called from Lua, catch all non-fatal errors and use
show_exception() to report them rather than catching only
ReportedBoundsError and adding a proto_malformed item.

Don't catch exceptions when constructing a trailer tvbuff in
packet-ieee8023.c - just construct it after the payload has been
dissected, and let whatever exceptions that throws be handled at the top
level.

Avoid some TRY/CATCH/ENDTRY cases by using checks such as
tvb_bytes_exist() before even looking in the tvbuff.

svn path=/trunk/; revision=47924
2013-02-27 22:43:54 +00:00
Bill Meier 96a24cc79f Fix spelling/typos found using a list of commonly misspelled words.
The misspellings were mostly in comments but some were
in text strings visible to the user.


svn path=/trunk/; revision=47899
2013-02-26 04:42:26 +00:00
Bill Meier d449c31d1d its ==> it's & it's ==> its as needed.
svn path=/trunk/; revision=47892
2013-02-26 01:22:18 +00:00
Guy Harris 29715ccc8f How can I get a new tvbuff that starts at an offset within a given
tvbuff and runs to the end of the tvbuff?  Let me count the ways....

Replace a bunch of different ways of doing that (some incorrect, in that
they're not properly handling tvbuffs where the captured and reported
lengths are different) with tvb_new_subset_remaining().

svn path=/trunk/; revision=47751
2013-02-19 23:17:07 +00:00
Jeff Morriss 3551a86c36 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45015
2012-09-20 01:29:52 +00:00
Jakub Zawadzki 5ad3e5331e MT: move global frame_end_routines to packet_info.
svn path=/trunk/; revision=44748
2012-09-03 12:00:40 +00:00
Guy Harris 659cf0527a UATs could be put into "categories". The categories were defined only
implicitly by the #define name and string they were defined to; not all
UATs neatly fit into any of the categories, so some of them were put
into categories that weren't obviously correct for them, and one - the
display filter macro UAT - wasn't put into any category at all (which
caused crashes when editing them, as the GUI code that handled UAT
changes from a dialog assumed the category field was non-null).

The category was, in practice, used only to decide, in the
aforementioned GUI code, whether the packet summary pane needed to be
updated or not.  It also offered no option of "don't update the packet
summary pane *and* don't redissect anything", which is what would be
appropriate for the display filter macro UAT.

Replace the category with a set of fields indicating what the UAT
affects; we currently offer "dissection", which applies to most UATs
(any UAT in libwireshark presumably affects dissection at a minimum) and
"the set of named fields that exist".  Changing any UAT that affects
dissection requires a redissection; changing any UAT that affects the
set of named fields that exist requires a redissection *and* rebuilding
the packet summary pane.

Perhaps we also need "filtering", so that if you change a display filter
macro, we re-filter, in case the display is currently filtered with a
display filter that uses a macro that changed.

svn path=/trunk/; revision=43603
2012-07-08 01:00:46 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Anders Broman a0910557c7 Get rid of a couple of warnings.
svn path=/trunk/; revision=43064
2012-06-04 12:20:37 +00:00
Anders Broman 10fe76d8a0 Get rid of a couple of warnings.
svn path=/trunk/; revision=43057
2012-06-04 08:56:48 +00:00