Commit Graph

80 Commits

Author SHA1 Message Date
Dario Lombardo 0c4eb2779f ftp: use ws_strtou function.
Change-Id: Idd0496f5afe41506ae3b5e22bc0aec09b737be6c
Reviewed-on: https://code.wireshark.org/review/18146
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-10-17 14:34:31 +00:00
Michael Mann 268841f3e0 Combine Decode As and port preferences for tcp.port dissector table.
This patch introduces new APIs to allow dissectors to have a preference for
a (TCP) port, but the underlying data is actually part of Decode As functionality.
For now the APIs are intentionally separate from the regular APIs that register a
dissector within a dissector table.  It may be possible to eventually combine the
two so that all dissectors that register with a dissector table have an opportunity
to "automatically" have a preference to adjust the "table value" through the
preferences dialog.

The tcp.port dissector table was used as the guinea pig.  This will eventually be
expanded to other dissector tables as well (most notably UDP ports).  Some
dissectors that "shared" a TCP/UDP port preference were also converted. It also
removed the need for some preference callback functions (mostly when the callback
function was the proto_reg_handoff function) so there is cleanup around that.

Dissectors that has a port preference whose default was 0 were switched to using
the dissector_add_for_decode_as_with_preference API rather than dissector_add_uint_with_preference

Also added comments for TCP ports used that aren't IANA registered.

Change-Id: I99604f95d426ad345f4b494598d94178b886eb67
Reviewed-on: https://code.wireshark.org/review/17724
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-10-08 02:44:53 +00:00
João Valverde e4c059f67f Add free_address_wmem(), fix warnings [-Wcast-qual]
Try to improve address API and also fix some constness warnings
by not overloading the 'data' pointer to store malloc'ed buffers
(use private pointer for that instead).

Second try, now passing test suite.

Change-Id: Idc101cd866b6d4f13500c9d59da5c7a38847fb7f
Reviewed-on: https://code.wireshark.org/review/13946
Petri-Dish: João Valverde <j@v6e.pt>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2016-02-26 23:09:43 +00:00
João Valverde ef929dc8eb Revert "Add free_address_wmem() and other extensions to address API"
This reverts commit 13ec77a9fc.

This commit introduces a segmentation fault for Lua code (uncovered by the test suite).

Change-Id: Ibc273d1915cda9632697b9f138f0ae104d3fb65e
Reviewed-on: https://code.wireshark.org/review/13813
Reviewed-by: João Valverde <j@v6e.pt>
2016-02-08 00:44:22 +00:00
João Valverde 13ec77a9fc Add free_address_wmem() and other extensions to address API
Try to improve 'address' API (to be easier/safer) and also avoid
some constness warnings by not overloading the 'data' pointer to
store malloc'ed buffers (use private pointer for that instead).

Change-Id: I7456516b12c67620ceadac447907c12f5905bd49
Reviewed-on: https://code.wireshark.org/review/13463
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2016-02-07 23:22:30 +00:00
Guy Harris bc5a0374bf Add the packet number to the packet_info structure, and use it.
That removes most of the uses of the frame number field in the
frame_data structure.

Change-Id: Ie22e4533e87f8360d7c0a61ca6ffb796cc233f22
Reviewed-on: https://code.wireshark.org/review/13509
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-24 03:41:28 +00:00
Michael Mann 31a54708f4 new_register_dissector -> register_dissector for dissector directory.
Change-Id: Ie39ef054a4a942687bd079f3a4d8c2cc55d5f22c
Reviewed-on: https://code.wireshark.org/review/12485
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-09 12:38:06 +00:00
Michael Mann 2fe0fc5a1a Convert some TCP subdissectors to "new" style.
Change-Id: I28ce51f3c06f78b85792bce4a13ef39eb75d7890
Reviewed-on: https://code.wireshark.org/review/11648
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-09 15:59:59 +00:00
Guy Harris f385922d77 More needed <stdlib.h>. Note why it and <stdio.h> are needed.
Change-Id: Id3f5eb3740fbc66202311f1d7d7933193cf4da2d
Reviewed-on: https://code.wireshark.org/review/11633
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-08 01:13:22 +00:00
Guy Harris 8e689a9d4a Remove some unnecessary includes.
Either remove them completely, or put them inside an #ifdef.

Change-Id: Iceff4909e250c17812f38d94e067f7c37ab72e1b
Reviewed-on: https://code.wireshark.org/review/11630
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-07 23:12:50 +00:00
Gerald Combs 86fe2be4dc Use address functions instead of ADDRESS macros in asn1 and epan
Replace CMP_ADDRESS, COPY_ADDRESS, et al with their lower-case
equivalents in the asn1 and epan directories.

Change-Id: I4043b0931d4353d60cffbd829e30269eb8d08cf4
Reviewed-on: https://code.wireshark.org/review/11200
Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-10-22 11:45:56 +00:00
João Valverde a643d14187 Change proto_tree_add_ipv6() to take a struct e_in6_addr pointer
tvb_get_ipv6() takes a struct e_in6_addr *, use that here too.

Change-Id: Id8b368daa05c151a61d4bc01dc88c00da13e9c88
Reviewed-on: https://code.wireshark.org/review/10953
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Balint Reczey <balint@balintreczey.hu>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-10-14 12:18:00 +00:00
João Valverde 41c94bfa7a FTP: Fix EPRT IPv6 set address
Change-Id: I944b3e6667027b251d0f3d894294bfda331abce2
Reviewed-on: https://code.wireshark.org/review/10898
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-10-09 12:18:20 +00:00
Evan Huus 9723c7a2f8 Remove more deprecated tvb_length calls
Change-Id: Ie40a195db622ebfb096fa5088c5467a1385e69bf
Reviewed-on: https://code.wireshark.org/review/9062
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-06-23 18:13:41 +00:00
Martin Mathieson 48db2548a9 Deleting unneccessary #includes from dissectors.
Second batch (packet-eth.c -> packet-icmpv6.d).

Will look at cleaning up and committing script afterwards.

Change-Id: I14295758b81a59115d8c88899f166cc3d5d17594
Reviewed-on: https://code.wireshark.org/review/6013
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2014-12-23 12:22:54 +00:00
Bill Meier b5d7b7ab6e Cleanup use of #includes in non-generated epan/dissector/*.c
Specifically:
- Set packet.h to be the first wireshark #include after
   config.h and "system" #includes.
   packet.h added as an #include in some cases when missing.
- Remove some #includes included (directly/indirectly) in
   packet.h. E.g., glib.h.
   (Done only for those files including packet.h).
- As needed, move "system" #includes to be after config.h and
   before wireshark #includes.
- Rework various #include file specifications for consistency.
- Misc.

Change-Id: Ifaa1a14b50b69fbad38ea4838a49dfe595c54c95
Reviewed-on: https://code.wireshark.org/review/5923
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-12-21 05:46:22 +00:00
Michael Mann 4f9af8608c Use proto_tree_add_bitmask for groups of proto_tree_add_boolean.
Part 2 of many

Change-Id: I50815e7738b011382392f3078a7107d3d9eec4ec
Reviewed-on: https://code.wireshark.org/review/5542
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-12-01 08:52:03 +00:00
Guy Harris 80e6f6251e Get rid of calls to ctype.h functions.
They don't handle values outside the range -1 to 127, and their behavior
is locale-dependent.  Use g_ascii_isXXX() and g_ascii_toXXX() instead of
isXXX() and toXXX().

If you're checking for printable ASCII, don't use isascii() and don't
use iscntrl(), use g_ascii_isprint().  If you're checking for graphical
ASCII, i.e. printable ASCII except for a space, use g_ascii_isgraph().

Use ws_xton() to convert a hex digit character to the corresponding
numeric value.

Change-Id: Id3039bc586fbf66d8736c2df248c790c0d7a2330
Reviewed-on: https://code.wireshark.org/review/4851
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-20 06:15:19 +00:00
Guy Harris 0cc027cc26 Note why strlen(args) could be < linelen.
Change-Id: I8fb3c35be0aa80895b8a917af8a9fd2542fbd9d6
Reviewed-on: https://code.wireshark.org/review/4393
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-09-30 21:32:59 +00:00
Martin Kaiser 514c101cb1 correct the line length if it was longer than the actual string supplied
by the caller

Bug: 10516
Change-Id: Ib2c9ab449b95da92cc889d0992fad30f432a2836
Reviewed-on: https://code.wireshark.org/review/4386
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Martin Kaiser <wireshark@kaiser.cx>
2014-09-30 21:13:14 +00:00
Michael Mann a22b7075f8 Eliminate proto_tree_add_text from some dissectors.
Change-Id: I6f1710a093fc548c718defa9b40ab68877ede977
Reviewed-on: https://code.wireshark.org/review/3470
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-08-08 05:51:52 +00:00
Michael Mann 14824e6adf Revert "Fixup: tvb_* -> tvb_captured"
https://www.wireshark.org/lists/wireshark-dev/201406/msg00131.html

This reverts commit 246fe2ca4c.

Change-Id: Ib24bae0198c13a84bd7f731bf4af921212109a8f
Reviewed-on: https://code.wireshark.org/review/2430
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-06-19 18:25:59 +00:00
Dario Lombardo 246fe2ca4c Fixup: tvb_* -> tvb_captured
Change-Id: I9209c1271967405c34c1b6fa43e1726a4d3a5a3f
Reviewed-on: https://code.wireshark.org/review/2377
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-06-18 14:14:58 +00:00
Jakub Zawadzki d7bd2ecf9f Add new proto_tree_add_format_text() function
There are lot of text dissectors which want just to add escaped (not filtrable) text,
add new function proto_tree_add_format_text() which just do this in optimized way.

Change-Id: Ia0e189b620cc0a5b74cfdaef1ad4571d766bb2ab
Reviewed-on: https://code.wireshark.org/review/1678
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-05-19 02:27:12 +00:00
AndersBroman 3157bf6ba5 isprint() -> g_ascii_isprint()
Change-Id: Ia586ef8ce500d5fc7578c52014206fa7a7eaea41
Reviewed-on: https://code.wireshark.org/review/1624
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-13 16:14:07 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(Using sed : sed -i '/^ \* \$Id\$/,+1 d')

Fix manually some typo (in export_object_dicom.c and crc16-plain.c)

Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8
Reviewed-on: https://code.wireshark.org/review/497
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04 14:27:33 +00:00
Jakub Zawadzki 4cf7cdd387 fix some warnings.
svn path=/trunk/; revision=54334
2013-12-21 17:34:41 +00:00
Jakub Zawadzki 1fbc6102dc include header file.
svn path=/trunk/; revision=54331
2013-12-21 16:22:44 +00:00
Jakub Zawadzki 3d6fdc55d0 New functions: str_to_ip6(), str_to_ip()
This way we can avoid including lot of system header files in some dissectors
and it might fix bug #9581

svn path=/trunk/; revision=54330
2013-12-21 16:16:56 +00:00
Jakub Zawadzki c45475ab45 Fix [-Wmissing-prototypes]
svn path=/trunk/; revision=54135
2013-12-15 23:44:12 +00:00
Chris Maynard e45b95fa02 Try to appease Visual Studio Code Analysis to avoid a false warning (as far as I can tell), namely: warning C6054: String 'forbidden' might not be zero-terminated
svn path=/trunk/; revision=54009
2013-12-13 02:04:39 +00:00
Bill Meier 721b5d266a Do one or more of the following:
- Convert "4 space tabs" to spaces;
- Remove some unneeded initializers;
- 'offset++' --> 'offset += 1' for consistency;
- Reformat hf[] entries;
- Rework/add whitespace;
- Adjust editor modelines (set tab-width to 8).

svn path=/trunk/; revision=54005
2013-12-13 00:44:32 +00:00
Bill Meier 2ac134b3c5 whitespace fixes; mostly: remove trailing blanks
svn path=/trunk/; revision=52591
2013-10-13 19:56:52 +00:00
Martin Kaiser a17cf67635 emem -> wmem
svn path=/trunk/; revision=52044
2013-09-14 18:30:43 +00:00
Chris Maynard 91ecc2334f "man inet_pton" only says that it returns a negative value, zero or a postive value, and not specifically -1, 0, or 1, so even though we know that's what wsutil's inet_pton will return, we shouldn't test against those exact values.
svn path=/trunk/; revision=50670
2013-07-16 16:23:31 +00:00
Michael Mann 5bc22a25df Batch of filterable expert infos.
svn path=/trunk/; revision=49584
2013-05-26 03:29:07 +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
Martin Kaiser 3ccd739fc6 removed a last if (tree) check in dissect_ftpdata()
svn path=/trunk/; revision=46460
2012-12-07 22:00:56 +00:00
Martin Kaiser dbaf194b10 EPRT parameters are mandatory, flag up an error if they're missing
remove if (linelen!=0) check

svn path=/trunk/; revision=46459
2012-12-07 21:54:20 +00:00
Martin Kaiser cf032504d3 remove some more if (tree) checks
svn path=/trunk/; revision=46457
2012-12-07 21:50:22 +00:00
Martin Kaiser 6a6babe5b0 at one place, offset was incremented depending on if (tree)
this created a bug when offset was used later on
remove the if (tree) check

svn path=/trunk/; revision=46456
2012-12-07 21:46:59 +00:00
Martin Kaiser 48f3309e14 dissect_ftp() start at the beginning of the tvb
make this clear by not using a variable offset which is always 0

svn path=/trunk/; revision=46455
2012-12-07 21:42:30 +00:00
Martin Kaiser 8f81b0fafe remove some more unnecessary if (tree) checks
svn path=/trunk/; revision=46454
2012-12-07 21:37:50 +00:00
Martin Kaiser 43f3eb63dc remove some unnecessary if (tree) checks in the ftp dissector
svn path=/trunk/; revision=46452
2012-12-07 21:31:03 +00:00
Martin Kaiser bbe9e06964 fix compliation on Win64
svn path=/trunk/; revision=45780
2012-10-24 21:45:50 +00:00
Martin Kaiser b60c69dc14 From Alexander Koeppe
parse EPSV response

from me
- no expert info under if(tree)
- use hf_ftp_epsv_port instead of hf_ftp_pasv_port
- don't use isdigit(), this is C99
- use temporary variable for IPv4 address

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

svn path=/trunk/; revision=45778
2012-10-24 20:59:27 +00:00
Martin Kaiser c44fadc3a8 From Alexander Koeppe
use inet_pton() for address parsing in FTP's EPRT command
support IPv6 addresses

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

svn path=/trunk/; revision=45565
2012-10-15 20:48:22 +00:00
Martin Kaiser e8205fb955 From Alexander Koeppe
support for EPRT command as defined in RFC 2428 (IPv4 addresses only)

from me
simplify the code, expert info must not be under if(tree)

based on the submission in
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7729

svn path=/trunk/; revision=45308
2012-10-04 14:35:09 +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
Martin Kaiser cc9feb9857 fix compilation on Win7x64 (I hope)
svn path=/trunk/; revision=44783
2012-09-05 20:31:52 +00:00