Commit Graph

182 Commits

Author SHA1 Message Date
Guy Harris 4302292936 You have to cast void pointers to another type in C++; implicit
conversions aren't valid.

svn path=/trunk/; revision=53037
2013-11-02 00:50:24 +00:00
Michael Mann f8f1f48371 Pass struct tcpinfo into all TCP subdissectors instead of through pinfo->private_data.
svn path=/trunk/; revision=53036
2013-11-02 00:36:30 +00:00
Evan Huus a3648730a6 Replace some proto_tree_add_string_format with proto_tree_add_item +
proto_tree_set_text - the string was not the important part, the formatting was.
We were passing the string directly from tvb_get_ptr, but this meant that if the
packet didn't contain a null-terminator we would run off the end. Since the
string comes straight from the packet, just let _add_item handle the length
calculations etc efficiently, and set the display later.

Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9323

I'm a bit confused honestly why most of these are being set hidden after being
added and formatted, but at least there are no memory errors anymore.

svn path=/trunk/; revision=52979
2013-10-30 02:09:34 +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
Michael Mann 9e494dbe18 Be able to search through HTTP request and HTTP response lines. Bug 9134 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9134)
From Edwin Groothuis

svn path=/trunk/; revision=52656
2013-10-17 01:23:12 +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
Pascal Quantin 868b345eea Convert a few more dissectors to wmem API
svn path=/trunk/; revision=52053
2013-09-15 10:29:49 +00:00
Chris Maynard 0b0cb31ac4 Test the return value of tvb_reported_length_remaining() as > 0 rather than != 0. While in these cases, I don't see any actual bugs due to other protections, I don't think it hurts to make this change and should help avoid others from copying/pasting this code elsewhere, where similar protections may not be in place.
svn path=/trunk/; revision=51959
2013-09-11 21:44:13 +00:00
Michael Mann 9e3f9b449f expert_add_info_format_text -> expert_add_info_format
svn path=/trunk/; revision=51852
2013-09-09 00:44:09 +00:00
Evan Huus 808d594087 Add an expert info if we see content-length header and chunked encoding
together.

The other part of https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9101

Also fix modelines.

svn path=/trunk/; revision=51786
2013-09-05 16:05:32 +00:00
Pascal Quantin ac5619426a Deactivate debug code
svn path=/trunk/; revision=51596
2013-08-30 12:31:14 +00:00
Alexis La Goutte b7d30a72a5 HTTP2 Upgrade heuristic for HTTP (Work with HTTP-draft-XX/2.0 and HTTP/2.0)
svn path=/trunk/; revision=51592
2013-08-30 11:14:18 +00:00
Anders Broman f6b9c18eed Use dissector_delete_uint_range/dissector_add_uint_range
svn path=/trunk/; revision=51567
2013-08-28 19:10:33 +00:00
Pascal Quantin b46f9bebe2 Change some dissectors to use pinfo memory pool instead of malloc if it can trigger an exception between between buffer allocation and tvb_set_free_cb call
svn path=/trunk/; revision=51427
2013-08-19 14:55:41 +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
Jakub Zawadzki 5fa2a99087 Keep result of [new_]register_dissector in some dissectors.
svn path=/trunk/; revision=51156
2013-08-05 18:09:43 +00:00
Michael Mann 0f0c111119 Remove check_col() and the occasional tree.
svn path=/trunk/; revision=49920
2013-06-14 01:02:11 +00:00
Sake Blok dea156c3d5 Rename "http.response_ts" to "http.time" to be inline with other response time fiels (like dns.time and smb.time etc)
svn path=/trunk/; revision=49630
2013-05-30 07:16:04 +00:00
Jeff Morriss 34230e736d Fix the infinite recursion problem reported in
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8733 :

We can't solely rely on the port in the URI to determine whether we will be
recursively called by decode_tcp_ports().  Instead also check the conversation
entry too: if we find that we are the subdissector for this conversation
(which we might be--without the port being in our list of ports--if we
heuristically picked up the conversation or the user did Decode-As),
just bail out and dissect the payload as data.

svn path=/trunk/; revision=49623
2013-05-29 22:43:20 +00:00
Michael Mann 5bc22a25df Batch of filterable expert infos.
svn path=/trunk/; revision=49584
2013-05-26 03:29:07 +00:00
Anders Broman 85a8e304dd Add the posibillity to use a key for per-packet-data.
svn path=/trunk/; revision=49259
2013-05-12 18:11:02 +00:00
Guy Harris 3295912210 Try to handle lines with NULs in them. They aren't valid lines, but at
least one fuzzed capture contains them, and using ep_strndup() to copy
the line means that the actual amount of memory allocated for the copy
will be less than the length of the line, and code that parses the line
assuming that there are value_len+1 bytes in the buffer (including the
terminating NUL), such as the current parsing code, will break.

We should really have code in Wireshark to handle counted strings, and
have those be what we extract from packets.  (And we should handle
non-UTF-8/non-UTF-16 encodings, and octet sequences that aren't valid
strings for their encoding, and handle display of invalid strings and
non-printable characters, and....).

Use g_ascii_ versions of various isXXX() and to{upper,lower}(), so we
don't get surprised by the behavior of the user's locale.

svn path=/trunk/; revision=48490
2013-03-22 23:18:30 +00:00
Anders Broman 81e80f2c0b From beroset:
remove C++ incompatibilities 
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416

svn path=/trunk/; revision=48355
2013-03-17 16:48:47 +00:00
Anders Broman 30a9b4855d Detect HTTP/1.1 heuristically.
svn path=/trunk/; revision=48263
2013-03-12 19:15:39 +00:00
Anders Broman 2cc00294c7 Use explicit casts.
svn path=/trunk/; revision=48260
2013-03-12 06:41:00 +00:00
Evan Huus 0f8735b8a3 From Dirk via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8287
Request-response tracking and response-time calculation for HTTP.

svn path=/trunk/; revision=47694
2013-02-16 14:59:00 +00:00
Guy Harris a4714f643a Add a routine to allow dissectors to specify ports that carry HTTP
traffic *without* claiming all that traffic for themselves; they might
want, instead, to register for a particular media type.

Not all traffic to or from port 3689 is DAAP - not even traffic between
two Apple machines doing media stuff (e.g., some FairPlay traffic
isn't).  Register for the media type application/x-dmap-tagged, and just
say port 3689 is HTTP.  This means we can get rid of the FPLY hack, as
that traffic is application/octet-stream.  Update some comments.

Leave it up to the DAAP dissector to tag traffic as DAAP in the protocol
column.

svn path=/trunk/; revision=47376
2013-01-30 21:49:33 +00:00
Guy Harris 8ed7a73e22 Fix a bunch of warnings.
Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
sizeof.

Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
strtol() and strtoul().

Change some data types to avoid those implicit conversion warnings.

When assigning a constant to a float, make sure the constant isn't a
double, by appending "f" to the constant.

Constify a bunch of variables, parameters, and return values to
eliminate warnings due to strings being given const qualifiers.  Cast
away those warnings in some cases where an API we don't control forces
us to do so.

Enable a bunch of additional warnings by default.  Note why at least
some of the other warnings aren't enabled.

randpkt.c and text2pcap.c are used to build programs, so they don't need
to be in EXTRA_DIST.

If the user specifies --enable-warnings-as-errors, add -Werror *even if
the user specified --enable-extra-gcc-flags; assume they know what
they're doing and are willing to have the compile fail due to the extra
GCC warnings being treated as errors.

svn path=/trunk/; revision=46748
2012-12-26 05:57:06 +00:00
Alexis La Goutte 94ae27661e From vanviegen via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7934 WebSocket dissector improvements
- Now works for WebSocket packets not aligned with IP packets.
- Support subdissectors.

From me :
- Fix checkAPIs warning (about comments)
- Remove some whitespace

svn path=/trunk/; revision=45875
2012-11-02 20:35:24 +00:00
Jeff Morriss 2552c750e5 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45017
2012-09-20 02:03:38 +00:00
Jakub Zawadzki 9f92dc93c5 Add data parameter to call_dissector_only.
svn path=/trunk/; revision=44872
2012-09-11 08:28:07 +00:00
Jakub Zawadzki dee4443809 Add data parameter to dissector_try_heuristic
svn path=/trunk/; revision=44871
2012-09-11 08:26:48 +00:00
Sake Blok 66115d1200 Enhance the http dissector to correctly reassemble http
headers when the first tcp segment does not contain a
full line.


svn path=/trunk/; revision=44593
2012-08-19 23:52:37 +00:00
Michael Mann 5dd7371960 more ephemeral memory cleanup
svn path=/trunk/; revision=44496
2012-08-14 17:58:41 +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 4f2c3a8e86 len is no longer used.
svn path=/trunk/; revision=43200
2012-06-11 08:07:48 +00:00
Anders Broman 34cb6f96d3 From Michael Mann:
NUL terminate the decoded string.  
Updated only dissector that uses epan_base64_decode() (packet-http.c) to assume
NULL termination.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7349

svn path=/trunk/; revision=43196
2012-06-11 07:09:11 +00:00
Bill Meier 3523b34d65 Add new HTTP Status Codes from RFC 6585;
Also: Add codes 226 & 426 as specified in the IANA HTTP Status Code Registry

svn path=/trunk/; revision=42372
2012-05-01 02:42:51 +00:00
Alexis La Goutte 284405d5eb From me for https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6843
Make WebSocket HTTP Header (Sec-WebSocket-*) filterable

svn path=/trunk/; revision=42164
2012-04-20 15:32:45 +00:00
Alexis La Goutte 456d6fbb53 From me for https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6843
Add WebSocket Protocol dissector (RFC6455)
* Support Base Framing Protocol
* Support of major opcode (Text, Binary, Close, Ping, Pong...)
* Support of unmask Payload (Client-to-Server Masking)

TODO 
* Add fragmentation support
* Add WebSocket Extensions

svn path=/trunk/; revision=42163
2012-04-20 15:31:15 +00:00
Anders Broman 84e8250146 From Pascal Quantin:
Ignore Content-Length if Transfer-Encoding is present

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5182

svn path=/trunk/; revision=42046
2012-04-13 13:10:38 +00:00
Stig Bjørlykke 019008548b Recreate the packet list when changing UAT for header fields.
This fixes a crash when changing settings for fields used as a custom column.

svn path=/trunk/; revision=41840
2012-03-30 08:57:57 +00:00
Jeff Morriss c13c14429b Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6982 :
Check the user-provided custom header string for invalid characters before
trying to register it in an hf; registering invalid characters in an hf will
lead to an assertion.

svn path=/trunk/; revision=41787
2012-03-27 01:43:20 +00:00
Stig Bjørlykke 377ea887bb Improved a if-check to avoid a analyzis warning.
svn path=/trunk/; revision=41508
2012-03-12 17:18:54 +00:00
Guy Harris 7e51e80fe0 To quote section "7.2.1 Type" of RFC 2068, "Hypertext Transfer Protocol
-- HTTP/1.1":

   Any HTTP/1.1 message containing an entity-body SHOULD include a
   Content-Type header field defining the media type of that body. If
   and only if the media type is not given by a Content-Type field, the
   recipient MAY attempt to guess the media type via inspection of its
   content and/or the name extension(s) of the URL used to identify the
   resource. If the media type remains unknown, the recipient SHOULD
   treat it as type "application/octet-stream".

To quote section "4. Encoding of Transport Layer" of RFC 2565, "Internet
Printing Protocol/1.0: Encoding and Transport":

   HTTP/1.1 [RFC2068] is the transport layer for this protocol.

	...

   Note: even though port 631 is the IPP default, port 80 remains the
   default for an HTTP URI.  Thus a URI for a printer using port 631
   MUST contain an explicit port, e.g. "http://forest:631/pinetree".  An
   HTTP URI for IPP with no explicit port implicitly reference port 80,
   which is consistent with the rules for HTTP/1.1. Each HTTP operation
   MUST use the POST method where the request-URI is the object target
   of the operation, and where the "Content-Type" of the message-body in
   each request and response MUST be "application/ipp". The message-body
   MUST contain the operation layer and MUST have the syntax described
   in section 3.2 "Syntax of Encoding". A client implementation MUST
   adhere to the rules for a client described for HTTP1.1 [RFC2068]. A
   printer (server) implementation MUST adhere the rules for an origin
   server described for HTTP1.1 [RFC2068].

So, when choosing a subdissector for HTTP request bodies, search based
on the media type first, and only if we *don't* find a dissector for the
media type, do other stuff such as heuristics or choosing a subdissector
based on the port number.

This fixes a number of problems; in particular, it fixes bug 6765
"non-IPP packets to or from port 631 are dissected as IPP" without
requiring the IPP dissector to attempt to determine whether an entity
body looks like IPP.  It also ensures that the default dissector for
HTTP entity bodies, the "media" dissector, will get the media type
passed to it in pinfo->match_string.

Don't use "!str*cmp()" while we're at it - it's valid C, but the "!" can
make it look as if it's checking for something not being the case when,
in fact, you're checking for equality rather than inequality.  (The
str*cmp() routines don't return Boolean results.)

svn path=/trunk/; revision=41025
2012-02-14 06:00:14 +00:00
Chris Maynard 3db18f185e Fix some typos.
svn path=/trunk/; revision=40787
2012-02-01 02:05:19 +00:00
Anders Broman 20881c49bb From Claudio:
linear white space (LWS) not ignored after HTTP header field content.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6591

svn path=/trunk/; revision=40753
2012-01-28 17:04:48 +00:00
Bill Meier dda0d791c9 Use correct reported_length for a tvb_new_subset() (not that it makes a difference in this case).
svn path=/trunk/; revision=40257
2011-12-21 03:44:23 +00:00
Bill Meier a0731cfeb8 Create "Dehunked Entity Body" with O(N) rather than O(N^2) efffort.
[Actually 1 g_malloc() + N tvb_memcpy() instead of
~ N g_malloc()/g_free() + N*(N+1)/2 tvb_memcpy() where N = number of chunks].

svn path=/trunk/; revision=40242
2011-12-18 18:31:30 +00:00