Commit Graph

288 Commits

Author SHA1 Message Date
Jakub Zawadzki be733f3041 Move epan/base64.[ch] to wsutil/ with function name change.
svn path=/trunk/; revision=54326
2013-12-21 14:38:51 +00:00
Bill Meier e2c5575e80 Cast result of strtol() to guint32;
svn path=/trunk/; revision=54266
2013-12-19 19:29:44 +00:00
Bill Meier 0afeb2ae95 Change editor modelines value for 'indent-tabs-mode' from 'true' to 't'
so emacs doesn't complainab 'unsafe value'.

svn path=/trunk/; revision=54153
2013-12-16 20:22:50 +00:00
Jakub Zawadzki c45475ab45 Fix [-Wmissing-prototypes]
svn path=/trunk/; revision=54135
2013-12-15 23:44:12 +00:00
Chris Maynard bc1b084ae1 Trivial: Spaces -> tabs.
svn path=/trunk/; revision=53975
2013-12-12 20:09:33 +00:00
Michael Mann 9b7fb8a811 Create the ability to have packet scoped "proto" data. Bug 9470 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9470)
I'm not sold on the name or module the proto_data functions live in, but I believe the function arguments are solid and gives us the most flexibility for the future.  And search/replace of a function name is easy enough to do.

The big driving force for getting this in sooner rather than later is the saved memory on ethernet packets (and IP packets soon), that used to have file_scope() proto data when all it needed was packet_scope() data (technically packet_info->pool scoped), strictly for Decode As.

All dissectors that use p_add_proto_data() only for Decode As functionality have been converted to using packet_scope().  All other dissectors were converted to using file_scope() which was the original scope for "proto" data.

svn path=/trunk/; revision=53520
2013-11-23 02:20:13 +00:00
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
Bill Meier c60d239123 From Claudio: header value always computed twice
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6592

svn path=/trunk/; revision=39975
2011-11-21 17:58:47 +00:00
Bill Meier 794757ae8f For proto_tree_add_item(..., proto_xxx, ...)use ENC_NA as the encoding arg.
Also: remove trailing whitespace for a number of files.

svn path=/trunk/; revision=39503
2011-10-21 02:10:19 +00:00
Bill Meier 126aa85393 Convert proto_tree_add_item() 'encoding' arg for field types FT_STRING, FT_STRINGZ, FT_UINT_STRING as follows:
1. If there's no character encoding (ENC_ASCII, ...) specified
    then use ENC_ASCII.
 2. For all but FT_UINT_STRING, always use ENC_NA
    (replacing any existing True/1/FALSE/0
    /ENC_BIG_ENDIAN/ENC_LITTLE_ENDIAN).



svn path=/trunk/; revision=39426
2011-10-15 18:46:26 +00:00
Stig Bjørlykke 7714898212 Cleanup the unregister loop to avoid freeing wrong data.
svn path=/trunk/; revision=39268
2011-10-05 11:44:29 +00:00
Stig Bjørlykke 19e87afd9d Free duplicated strings in hf entries.
svn path=/trunk/; revision=39258
2011-10-04 21:06:20 +00:00
Stig Bjørlykke 8c8cd4024c Unregister and delete allocated header fields when updating the UAT.
Avoid double loading the UAT.
Use the post update callback in uat_new for regenerating header_fields_hash.

svn path=/trunk/; revision=39251
2011-10-04 18:40:56 +00:00
Anders Broman 0d89708ab2 Add notes and links on SSDP
svn path=/trunk/; revision=38913
2011-09-07 09:02:09 +00:00
Gerald Combs 49b92440de More GLIB_CHECK_VERSION cleanups. Update the minimum GLib/GTK+ versions
in README.devloper. Remove g_gnuc.h since it's no longer needed. Remove
tvbuff_init(), tvbuff_cleanup(), reassemble_init(), and
reassemble_cleanup() since they were only used for older GLib versions
which didn't support GSlices. Assume we always support the "matches"
operator.

svn path=/trunk/; revision=37978
2011-07-11 20:32:19 +00:00
Guy Harris a3ae744636 Add port 2710 for the XBT BitTorrent tracker (and note why it's added;
the other unusual ports should be mentioned as well).

svn path=/trunk/; revision=37952
2011-07-10 18:34:15 +00:00
Jeff Morriss 7ad71a2d78 Treat TVBs as opaque: use the accessor functions instead of accessing the fields
directly.

svn path=/trunk/; revision=37420
2011-05-27 01:57:33 +00:00
Stig Bjørlykke c92938bbc0 Support content-type x-gzip and x-deflate, as described in RFC2616 as
equivalent to gzip and deflate.

This fixes bug 5882.

svn path=/trunk/; revision=36963
2011-05-02 14:06:33 +00:00
Alexis La Goutte 8b61d83f5e Fix Dead Store (Dead assignement/Dead increment) Warning found by Clang
svn path=/trunk/; revision=36700
2011-04-18 17:38:08 +00:00
Jeff Morriss dd9f86c38d The 'name's passed to tick_stat_node() do not need to be static.
svn path=/trunk/; revision=36341
2011-03-26 01:21:43 +00:00
Jeff Morriss bb61772be7 From Dirk: fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2930 :
Make the image (png, gif, jfif) dissectors "new style" so that they don't
dissect data that does not belong to them.

Modify the HTTP dissector to call heuristic dissectors on the body if the
registered subdissector does not accept/dissect the data.

From me: don't use assert() and don't add a preference to the HTTP dissector
for this behavior: it makes sense to behave like that by default.

svn path=/trunk/; revision=36305
2011-03-24 02:49:05 +00:00
Gerald Combs 1b4d847a90 Add 2869 to the list of HTTP ports: http://support.microsoft.com/kb/886257
svn path=/trunk/; revision=35461
2011-01-10 20:23:21 +00:00
Jaap Keuter 302d4c14df From Julien Kerihuel:
I've just finished to write a ncacn_http dissector for Wireshark which
provides the ability to dissect Outlook anywhere packets properly (as
specified by [MS-RPCH].pdf documentation.

svn path=/trunk/; revision=35259
2010-12-23 23:50:14 +00:00
Guy Harris a8bc4a0d13 Rename the routines that handle dissector tables with unsigned integer
keys to have _uint in their names, to match the routines that handle
dissector tables with string keys.  (Using _port can confuse people into
thinking they're intended solely for use with TCP/UDP/etc. ports when,
in fact, they work better for things such as Ethernet types, where the
binding of particular values to particular protocols are a lot
stronger.)

svn path=/trunk/; revision=35224
2010-12-20 05:35:29 +00:00
Anders Broman 738813862b From Robert Bullen:
Improve the HTTP dissection of the Response Status Line.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5338

svn path=/trunk/; revision=34712
2010-10-30 14:29:20 +00:00
Guy Harris 17d4d51b7d Make the third argument to a UAT copy callback a size_t (not that any of
the callbacks we have use that argument - is it really needed?).

svn path=/trunk/; revision=34694
2010-10-29 21:11:33 +00:00
Jaap Keuter 3db66ff53e Try to decode the unknown multipart subtype anyway.
svn path=/trunk/; revision=34658
2010-10-27 06:49:18 +00:00
Jeff Morriss 36390c306f From Yaniv Kaul via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5336 :
Attached patch:
1. Adds port 5985 as a HTTP traffic port (used by MS Powershell remoting over
HTTP)
2. Adds dissection of Kerberos authentication to HTTP.


svn path=/trunk/; revision=34641
2010-10-25 02:17:41 +00:00
Jeff Morriss 46ef82837f Add a cast
svn path=/trunk/; revision=34164
2010-09-21 03:06:54 +00:00
Jeff Morriss 79e39c7ecb Use size_t to keep the Windows compiler happy
svn path=/trunk/; revision=34163
2010-09-21 02:41:29 +00:00
Jeff Morriss f2d070f19e From Jakub Zawadzki via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3336 :
We parse host & request page from headers, so we easily can construct full http
uri.

I was thinking about making it as field, so we could filter, print in column
info, or do other fancy stuff, but for now this is imho enough.


From me: add it as a (filterable) item.  Clean up spacing and indentation in a
few places.

svn path=/trunk/; revision=34162
2010-09-21 02:12:21 +00:00
Stig Bjørlykke 42d0e5b2a8 Request-Line can contain an empty Request-URI.
I don't want to change get_token_len() to not skip multiple spaces,
because I don't know if other protocols depends on this behaviour.
We should maybe check this...

This fixes bug 5181.

svn path=/trunk/; revision=34063
2010-09-05 12:16:14 +00:00
Jeff Morriss 729de1a635 As suggested in http://www.wireshark.org/lists/wireshark-dev/200809/msg00075.html
(as referenced in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2907 ) and
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3411 :

Write a new convenience routine for finding a conversation and, if it is not
found, create it.  The frame number and addresses are taken from pinfo (as is
the common case).

Use this function in a bunch of dissectors.

svn path=/trunk/; revision=32790
2010-05-13 18:28:34 +00:00
Jeff Morriss c8cecb9133 From Dirk via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4758 :
The HTTP dissector uses strtoll() to convert the Content-Length string into a
64bit variable. But that string can contain a number larger (or less) than
64bit, which lets the strtoll() return INT_MAX (or INT_MIN). strtoll() then
indicates this with errno==ERANGE.

The attachted patch checks if errno is set this way and then treats that HTTP
Content-Length as unspecified, since we don't know the real size.

I haven't checked other occurences of strtoll() in the HTTP dissector if they
could benefit from the errno check, or if other dissectors could use it.

svn path=/trunk/; revision=32772
2010-05-12 13:24:42 +00:00
Guy Harris 17865148a1 Squelch compiler warnings. (We know that header.content_length is less
than a value that fits into an int, so we know its value will fit into
an int.)

svn path=/trunk/; revision=32434
2010-04-09 02:00:07 +00:00
Jeff Morriss 873a93c7b1 Use a 64-bit number to store the content length. This fixes:
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1958

Of course this doesn't mean we can reassemble that much data.

svn path=/trunk/; revision=32433
2010-04-09 01:42:12 +00:00
Stig Bjørlykke 2f8830b4d0 From LEGO via bug 3459:
Add a callback to UAT to be called after the table has being updated,
use it to renew the snmp_ue_cache.

svn path=/trunk/; revision=32112
2010-03-04 12:50:18 +00:00
Stig Bjørlykke c198fc6546 From Didier Gautheron via bug 4419:
se_alloc and ep_alloc never return NULL and se_alloc0 already initialized
data with 0.

svn path=/trunk/; revision=31654
2010-01-25 11:47:39 +00:00
Kovarththanan Rajaratnam 00810ff199 * Prefer col_append_str instead of col_append_fstr for constant strings
* Remove check_col guards

svn path=/trunk/; revision=30127
2009-09-24 20:21:23 +00:00
Jeff Morriss 5acb182178 Revert 29889 to stop the fuzz failures.
svn path=/trunk/; revision=29902
2009-09-14 17:36:15 +00:00
Anders Broman 120b410ac4 From Didier Gautheron:
optimizations patch http://wiki.wireshark.org/Development/Optimization
'patch.29854.diff.gz"

Use "g_realloc".

svn path=/trunk/; revision=29889
2009-09-14 06:00:53 +00:00
Kovarththanan Rajaratnam 8c48c6835f Rename address_to_str() to ep_address_to_str() because:
1) This indicates that the string has ephemeral lifetime
2) More consistent with its existing seasonal counterpart, se_address_to_str().

svn path=/trunk/; revision=29747
2009-09-06 14:25:47 +00:00
Bill Meier 94f28dd8f9 (FWIW) One step towards including stdio.h & stdlib.h only when req'd.
svn path=/trunk/; revision=29568
2009-08-26 19:27:49 +00:00
Bill Meier 1ab1e3889c Don't do dissector_add twice on TCP port 3689;
packet-daap requests registration on that port via http_dissector_add
 and thus packet-http does not need to do a default registration on that port.
Also: fix a typo in a comment.

svn path=/trunk/; revision=29265
2009-08-02 19:09:36 +00:00
Stig Bjørlykke b228488bc0 From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
    for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
    FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero

svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
Jörg Mayer c321f29518 Trivial warning fixes:
- Might be used uninitialized
- not a prototype
- comma at end of enum


svn path=/trunk/; revision=28730
2009-06-15 02:34:53 +00:00
Guy Harris cf91fdf16b Have tap listeners specify whether the "packet" routine requires
a protocol tree;

	the column values.

This includes stats-tree listeners.

Have the routines to build the packet list, and to retap packets, honor
those requirements.  This means that cf_retap_packets() no longer needs
an argument to specify whether to construct the column values or not, so
get rid of that argument.

This also means that there's no need for a tap to have a fake filter
to ensure that the protocol tree will be built, so don't set up a fake
"frame" filter.

While we're at it, clean up some cases where "no filter" was represented
as a null string rather than a null pointer.

Have a routine to return an indication of the number of tap listeners
with filters; use that rather than the global num_tap_filters.

Clean up some indentation and some gboolean vs. gint items.

svn path=/trunk/; revision=28645
2009-06-05 22:42:47 +00:00
Stig Bjørlykke fc3f1b5283 From Artem Tamazov (bug 3472):
Save/Restore pinfo->private_data when used.

svn path=/trunk/; revision=28412
2009-05-19 17:16:14 +00:00
Gerald Combs d797045341 From Abhik Sarkar via bug 3242:
Add a UAT for custom HTTP header fields.
  
From me:

  Use se_alloc0 to initialize a struct. Use g_strdup(...) instead of
  g_strdup_printf("%s"...). Add a missing UAT_END_FIELDS.

svn path=/trunk/; revision=28406
2009-05-19 00:17:23 +00:00
Anders Broman c91a384702 Apply some of the patches from:
http://wiki.wireshark.org/Development/Optimization

svn path=/trunk/; revision=28356
2009-05-13 19:46:11 +00:00
Gerald Combs ef0e74e533 More size_t casts.
svn path=/trunk/; revision=27897
2009-03-30 18:40:33 +00:00
Bill Meier c0e92cbc04 Fix various typos and spelling errors (mostly in text strings)
svn path=/trunk/; revision=27065
2008-12-20 00:09:02 +00:00
Gerald Combs 4948a597c4 Partial support for RFC 2324.
svn path=/trunk/; revision=26931
2008-12-08 18:01:13 +00:00
Jaap Keuter d6556ed5a2 Add the Content-Length header as a header string, while maintaining the content-length filter option.
svn path=/trunk/; revision=26522
2008-10-23 06:57:31 +00:00
Bill Meier ffa7320de2 Minor cleanup related to proto_register & proto_reg_handoff
svn path=/trunk/; revision=26280
2008-09-26 20:06:40 +00:00
Anders Broman 2b9d63a4b5 Move common code to base64.c
svn path=/trunk/; revision=25908
2008-08-03 14:27:22 +00:00
Jeff Morriss c50b4aec09 More (mostly stats tree) unsigned->signed char cleanup
svn path=/trunk/; revision=25717
2008-07-12 01:48:24 +00:00
Jeff Morriss 71c1e4faf0 Change the stats tree API to use signed chars instead of guint8s for all its
strings; this should fix a number of signed/unsigned char warnings.
Reindent a bunch, too.

svn path=/trunk/; revision=25716
2008-07-11 21:13:39 +00:00
Bill Meier 65bcd0d67f Display "Decompression failed" when appropriate (& Fix some src spacing)
svn path=/trunk/; revision=25681
2008-07-08 22:36:35 +00:00
Guy Harris d1275537c0 Get rid of #defines that are no longer being used (we now have a port
range list preference for HTTP, which we initialize to the default list).

svn path=/trunk/; revision=25667
2008-07-03 19:50:15 +00:00
Bill Meier 33af75a599 Fix some warnings reported by gcc -Wshadow ...
svn path=/trunk/; revision=25628
2008-06-28 21:09:57 +00:00
Bill Meier 9ca142b160 Fix some of the Errors/warnings detected by checkapi.
svn path=/trunk/; revision=25282
2008-05-13 01:23:37 +00:00
Anders Broman 63c5c71cf8 Remove:
#ifdef NEED_G_ASCII_STRCASECMP_H
#include "g_ascii_strcasecmp.h"
#endif

svn path=/trunk/; revision=24859
2008-04-09 05:36:08 +00:00
Stephen Fisher 726a1caaf1 - Remove GLIB1 code
- Change ugly GLIB version checking statements to GLIB_CHECK_VERSION
- Remove ws_strsplit files because we no longer need to borrow GLIB2's
  g_strsplit code for the no longer supported GLIB1 builds


svn path=/trunk/; revision=24829
2008-04-07 05:22:54 +00:00
Jeff Morriss 0bb7de356a Fix http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=383 : show multiple (pipelined) HTTP packets in the Info column.
svn path=/trunk/; revision=24586
2008-03-08 21:17:43 +00:00
Jeff Morriss bb323055b2 match_strval() may return NULL so don't blindly pass its return value into col_add_*() or proto_add_*(); use val_to_str() (returning "Unknown (%d)" if no match is found) instead.
svn path=/trunk/; revision=24557
2008-03-04 21:05:21 +00:00
Sake Blok 9ad27ce239 Fix for bug 1586: When proxying a tcp connection (mostly used with ssl over an
http proxy), let the proxied protocol take care of reassembly itself.


svn path=/trunk/; revision=23949
2007-12-26 18:28:31 +00:00
Anders Broman 95d8c7e2da Apply yet another of the optimization patches:
- Only call functions if they are needed or once.

svn path=/trunk/; revision=23628
2007-11-27 21:24:39 +00:00
Guy Harris 9c89cdaaa3 strcasecmp(), strncasecmp(), g_strcasecmp(), and g_strncasecmp() delenda
est.  Use g_ascii_strcasecmp() and g_ascii_strncasecmp(), and supply our
own versions if they're missing from GLib (as is the case with GLib
1.x).

In the code to build the list of named fields for Diameter, don't use
g_strdown(); do our own g_ascii_-style upper-case to lower-case mapping
in the hash function and use g_ascii_strcasecmp() in the compare
function.

We do this because there is no guarantee that toupper(), tolower(), and
functions that use them will, for example, map between "I" and "i" in
all locales; in Turkish locales, for example, there are, in both
upper case and lower case, versions of "i" with and without a dot, and
the upper-case version of "i" is "I"-with-a-dot and the lower-case
version of "I" is "i"-without-a-dot.  This causes strings that should
match not to match.

This finishes fixing bug 2010 - an earlier checkin prevented the crash
(as there are other ways to produce the same crash, e.g. a bogus
dictionary.xml file), but didn't fix the case-insensitive string matching.

svn path=/trunk/; revision=23623
2007-11-27 18:52:51 +00:00
Gerald Combs 8e45bbf506 Don't call tvb_set_child_real_data_tvbuff() + add_new_data_source() twice
for the same tvb.  This keeps us from freeing the same memory twice and
crashing on some systems.

This might be the same bug Brian Vandenberg was looking for in
http://www.wireshark.org/lists/wireshark-dev/200705/msg00406.html .

svn path=/trunk/; revision=23415
2007-11-09 20:04:40 +00:00
Jeff Morriss 3dec62b85c - s/ntohs/g_ntohs
- s/ntohl/g_ntohl
- s/free/g_free
- Change some tvb_get_string()+g_free()'s into tvb_get_ephemeral_string()
- Change some tvb_fake_unicode()+g_free()'s into tvb_get_ephemeral_faked_unicode()
- Change some tvb_get_string() calls that were clearly memory leaks (like
  atoi(tvb_get_string(...))) into tvb_get_ephemeral_string()

svn path=/trunk/; revision=22515
2007-08-15 22:27:52 +00:00
Tomas Kukosa 652b2503c9 add missing initial registration to TCP and SSL ports
svn path=/trunk/; revision=22469
2007-08-08 14:01:28 +00:00
Tomas Kukosa e7a40dbb61 make TCP and SSL/TLS ports configurable for HTTP
svn path=/trunk/; revision=22322
2007-07-16 12:51:42 +00:00
Stephen Fisher c38acbae0e From Sake Blok:
While looking into the http-dissector I improved a few things on
how it dissects a proxy CONNECT session. This is what I have changed:

- added the fields hf_http_proxy_connect_host and -port

- changed proto_tree_add_text to proto_tree_add_string and -uint
  so that it's possible to filter on them

- make these two fields "PROTO_ITEM_SET_GENERATED"

- removed the alteration of the ports within pinfo, now the
  ports in the column info are not changed to the port used to
  connect to the backend server. It is now possible to use
  follow-tcp-stream again on proxied ssl sessions.


svn path=/trunk/; revision=21618
2007-04-28 23:52:12 +00:00
Jeff Morriss 59159fe03e Fix bug 1452: Don't pass a null pointer to g_strsplit().
svn path=/trunk/; revision=21165
2007-03-24 10:07:20 +00:00
Jörg Mayer a8f4da5ead Sebastien Tandel:
some warning fixes

packet-http.c
    set headers.content_length = 0 before the first potential use of it.
packet-kink.c
    "ifdef kerberos" around one function declaration
packet-nbns.c
    set headers.{dgm_length|pkt_offset|error_code} = 0
packet-pflog.c
    delete capture_pflog and
capture_old_pflog which aren't used anymore in the code.

svn path=/trunk/; revision=21120
2007-03-22 15:19:49 +00:00
Stephen Fisher 4eeb29a8a7 Fix bug #1394: Runtime error crash after clicking on HTTP packet
The capture file the user supplied had a HTTP chunked response
in it with no actual chunks other than the zero length chunk
indicating the end of the chunks.  The fix is to only create
a new_tvb and copy it over the tvb going into the
chunked_encoding_dissector() function if the chunk size is > 0.
 

svn path=/trunk/; revision=21034
2007-03-16 00:47:26 +00:00
Jörg Mayer a00dc2564e strncmp(NULL, ...) isn't such a good idea.
svn path=/trunk/; revision=21033
2007-03-14 22:58:09 +00:00
Stephen Fisher eeea95ccbe HTTP Export Object updates:
- Split the HTTP tap into two taps: one for the HTTP statistics
   and the other for the export object function.  This allows the
   HTTP statistics to work again (they seem to have been
   partially broken since SVN rev 18901).
 - Pass the conversation data (conv_data) between functions now
   instead of using the global variable stat_info (now only used
   for the HTTP stats)
 - Pass only pointers from the HTTP dissector to the Export Object
   tap, where we'll then copy the values and insert into the slist.
 - Make sure we free all memory allocated by this feature when
   we're done with it.
 - Various other minor improvements


svn path=/trunk/; revision=21021
2007-03-13 20:42:04 +00:00
Stephen Fisher 2865e52843 Export Object code/documentation updates:
- Note in the user's guide that export object is not available 
   in GTK1 builds of Wireshark.
 - Make scanning through the slists more efficient
 - Use new tap.c function called have_tap_listener() to only save
   object payload data when the export object listener is actively
   listening for it.
 - Save objects in the HTTP dissector with g_malloc() instead of
   se_malloc() and free it when we're done with it - when the
   export object window is closed (Fixes bug #1412)
 - Various minor improvements


svn path=/trunk/; revision=20980
2007-03-06 00:36:25 +00:00
Stephen Fisher 2c5ccc66ef Update object export code:
- Add to User's Guide
 - Add a help button
 - Move a lot of code into the shared export_object.c file and out of
   dissector specific file export_object_http.c.  This will make adding
   additional protocols much easier.
 - Change comment in packet-http.c to reflect new name (Export Object)
 - Various other minor improvements 


svn path=/trunk/; revision=20961
2007-03-03 03:14:00 +00:00
Stephen Fisher 7a2bfb7a61 Initial version of the new Statistics -> Content List -> HTTP feature. This
feature lists all of the content found in an HTTP stream (images, http, etc.)
and displays it in a list that allows the user to save each one as a file that
is already reassembled by the dissectors.


svn path=/trunk/; revision=20867
2007-02-19 22:37:45 +00:00
Stephen Fisher d4fffce05f Add comments to the statistics functions to tell which is which
svn path=/trunk/; revision=20852
2007-02-19 05:21:12 +00:00
Stephen Fisher 0ebc01dc03 From Sebastien Tandel:
Create two new files (ws_strsplit.[ch]) that use GTK2 code to override
the buggy g_strsplit() function when compiling for GTK1.  Include this
work-around function (ws_strsplit) in libwireshark.def.  Add notes on usage
to README.developer.  Include epan/ws_strsplit.h in all files that use
g_strsplit().


svn path=/trunk/; revision=20804
2007-02-13 20:57:22 +00:00
Stephen Fisher 2cca9d7f55 Fix for bug #646: show the end of HTTP chunked encoding (a chunk with size 0)
as described in RFC 2616.

-This line, and those below, will be ignored--

M    packet-http.c

svn path=/trunk/; revision=19968
2006-11-24 02:59:43 +00:00
Stephen Fisher 3193603d78 Fix problem reported on -dev list by Frank Maerz with Wireshark crashing
when it encountered a proxy http connect to port 80.  This was caused by
the dissector calling itself over and over.  Now if the connect to port is
one of the defined http ports, it calls the data dissector.


svn path=/trunk/; revision=19899
2006-11-15 06:46:11 +00:00
Ronnie Sahlberg 961ff01149 teach the http header dissector how to handle integer fields instead of just assuming everything is a string field
change http.content_length to be FT_UINT32


svn path=/trunk/; revision=19654
2006-10-21 22:17:43 +00:00
Ulf Lamping ee8abeec9e fix a typo
svn path=/trunk/; revision=19386
2006-09-30 18:30:43 +00:00
Ronnie Sahlberg b61e42bc3a from bryant eastham
Also, there is still an outstanding issue regarding the default use of
the "media" dissector. The way it is currently coded there is no way to
have a heuristic decoder when a content-type header is specified.


In this way if there is a decoder for a specific content-type then it
will be used, then the heuristic decoders have a chance, and finally the
default of either the media-type decoder of the http_payload decoder.



svn path=/trunk/; revision=19208
2006-09-12 11:39:51 +00:00
Ronnie Sahlberg 52c827f1d1 fix for bug 1079
verify that stat_info->request_uri is non null before doing string manipulations on it
so that we dont try to dereference a null pointer further down the code


svn path=/trunk/; revision=19153
2006-09-05 14:32:15 +00:00
Gerald Combs 07f798ed37 Make sure a string pointer exists before we try to use it. Fixes bug 1050.
svn path=/trunk/; revision=19022
2006-08-24 22:05:26 +00:00
Jörg Mayer b21579abef Stephen Fisher <stephentfisher@yahoo.com>
Could you apply the attached patch also to finish it off - I
failed to include it in the original e-mail.

svn path=/trunk/; revision=18906
2006-08-15 06:40:26 +00:00
Jörg Mayer d291a92109 Stephen Fisher <stephentfisher@yahoo.com>
Attached is a patch to packet-http.c that calls a subdissector for
traffic flowing through a proxy via the HTTP CONNECT method.  Most
protocols, especially SSL, can be tunneled through an HTTP proxy.
Wireshark currently says this traffic is "Continuation or non-HTTP
traffic" but this patch turns the payload over to the dissector for the
protocol being tunneled.  This is similar to how the Socks dissector
works.


svn path=/trunk/; revision=18901
2006-08-14 21:46:05 +00:00
Ronnie Sahlberg 5dd51dc735 fix a tiny memory leak where we would lose a few kbyte once when wireshark is starting up
svn path=/trunk/; revision=18579
2006-06-27 12:05:05 +00:00
Ronnie Sahlberg b945d54c9f remove some dead code coverity 17
svn path=/trunk/; revision=18567
2006-06-24 00:01:33 +00:00
Ronnie Sahlberg 617227fe2a change a comment to #if to make it clearer the code is disabled
svn path=/trunk/; revision=18566
2006-06-23 23:51:55 +00:00
Gerald Combs 8958bab6de Tethereal/tethereal -> TShark/tshark.
svn path=/trunk/; revision=18268
2006-05-31 17:38:42 +00:00
Anders Broman 996d4db495 Ethereal->Wireshark
svn path=/trunk/; revision=18234
2006-05-28 19:49:07 +00:00
Anders Broman 1814821adc From Martin Mathieson:
- Many DCT2000 protocols can be embedded within an IP primitive 
message.  Add a heuristic to see if we can find the protocol payload 
within in IP primitive message, and look for an ethereal dissector 
matching the DCT2000 protocol name (this is useful for simple protocol 
testing where no physical links are involved)
- Make some more of these protocols (diameter, http, mgcp) findable by name
- Adds protocol 'variant' number to stub and dissector
- Break the duplicated writing of the stub header out into a separate 
function

svn path=/trunk/; revision=18212
2006-05-23 05:48:00 +00:00
Ronnie Sahlberg feab79e328 change a whole bunch of ethereal into wireshark
svn path=/trunk/; revision=18196
2006-05-21 04:49:01 +00:00
Jaap Keuter d53b9d7205 Update status codes from RFC 2616 and RFC 2518
svn path=/trunk/; revision=17769
2006-03-30 10:16:35 +00:00