Commit Graph

870 Commits

Author SHA1 Message Date
Gerald Combs 5639b8014a Use an enum for plugin types.
Make plugins.c the source of truth for plugin names. Where plugins
reside and what they do are two different things, so split the plugin
directory and description into two separate elements.

CMake creates portable[1] builds on Windows and macOS. That is, the
build-time directory layout is the same as the installation directory
layout. Adjust various plugin paths macOS accordingly.

[1] You have to run osx-app.sh on macOS to prepare the application
bundle, but the goal is to create a directory/bundle that can be moved
or copied to a different system and run in the new location.

Change-Id: Icf9d02e61918fdf1404468baf52542910edf2743
Reviewed-on: https://code.wireshark.org/review/25166
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-01-11 00:58:43 +00:00
Dario Lombardo e80b40adbe extcap: remove conditional compilation.
Change-Id: Ia54bba388755cf27a343fe6d69d244bf1ab897f9
Reviewed-on: https://code.wireshark.org/review/25186
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-08 05:50:15 +00:00
Dario Lombardo e0d04a752a wsutil: return false if NULL is asked as profile name (CID: 1405202).
Better not rely on the fact that the caller won't pass NULL. A NULL
profile would be lead to a wrong behaviour.

Change-Id: I281f0d2364af9f7b78268580dd73024b07bcba83
Reviewed-on: https://code.wireshark.org/review/25124
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2018-01-03 16:00:52 +00:00
Uli Heilmeier 5dc7ce6ccc ws_pipe: fix format error for size_t buffer_size
Fix error: format '%ld' expects argument of type 'long int', but argument 4 has type 'size_t'

Change-Id: I86ec4076bb7e8c11d5cf82187a46a528bf43c514
Reviewed-on: https://code.wireshark.org/review/25109
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2018-01-02 14:47:33 +00:00
Roland Knall 07e8707d73 wsutil: Add missing include
Otherwise gboolean is undeclared in files depending on the functionality,
like extcap.c for instance

Change-Id: I329715b2bb7bfd5d12ce3f1a035ecda6dff16a2d
Reviewed-on: https://code.wireshark.org/review/25110
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2018-01-02 13:30:08 +00:00
Dario Lombardo 098fbc70ee ws_pipe: provide a null terminated string anyway (CID: 1364684).
Change-Id: I4143b499986cbd31db524db73dde72ddbe26077d
Reviewed-on: https://code.wireshark.org/review/25072
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-01-02 03:38:16 +00:00
Stig Bjørlykke 564a3fae12 Happy New Year 2018!
Change-Id: I61ece8256384786c718fe2c1bc8813560fa372eb
Reviewed-on: https://code.wireshark.org/review/25094
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2018-01-01 11:25:19 +00:00
Peter Wu bad83f249f Fix build and thread runtime compat with older GLib
CentOS 6 ships with glib 2.28.8 which do not support
g_ptr_array_new_full (make-taps/make-dissectors) and need to link with
wsutil for glib-compat.

g_thread_new was only introduced with GLib 2.32 (not 2.31), so adjust
the check accordingly. Abort in case thread creation fails (as
documented). Properly initialize threads or it will abort on runtime
(this also requires linking epan with gthreads in CMake, autotools
already includes it with GLIB_LIBS).

Change-Id: Ie81d6df7b3b26aaa4eb25e23719a220755e2c13c
Reviewed-on: https://code.wireshark.org/review/24978
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-12-24 20:22:58 +00:00
Guy Harris 6a949ed155 Put special pipe-handling code into libwsutil.
Ask, in a comment, why we're doing PeekNamedPipe() when we're trying
to read everyting in the pipe, up to the EOF, into a string.

On UN*X, do the same "read up to an EOF and then NUL-terminate the
result" stuff that we did on Windows; nothing guarantees that, on all
UN*Xes, in all circumstances, until the end of time, world without end,
amen, we can do one read and get the entire string.

Change-Id: I578802b23fec1051139eaefd9a09fe2a6de06a11
Reviewed-on: https://code.wireshark.org/review/24959
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-12-23 20:43:32 +00:00
Gerald Combs 6a5e90f2d9 Log output updates.
Add a Qt message handler that calls g_log. Add milliseconds to the
g_log_message_handler timestamp.

Change-Id: I5b1c1d902b6b05cd8daa01741b19d6c2048dfb9a
Reviewed-on: https://code.wireshark.org/review/24865
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-12-17 02:30:40 +00:00
João Valverde 995812c5f1 Refactor plugin registration and loading
Put different types of plugins (libwiretap, libwireshark) in different
subdirectories, give libwiretap and libwireshark init routines that
load the plugins, and have them scan the appropriate subdirectories
so that we don't even *try* to, for example, load libwireshark plugins
in programs that only use libwiretap.

Compiled plugins are stored in subfolders of the plugin folders, with
the subfolder name being the Wireshark minor version number (X.Y). There is
another hierarchical level for each Wireshark library (libwireshark, libwscodecs
and libwiretap).

The folder names are respectively plugins/X.Y/{epan,codecs,wiretap}.

Currently we only distribute "epan" (libwireshark) plugins.

Change-Id: I3438787a6f45820d64ba4ca91cbe3c8864708acb
Reviewed-on: https://code.wireshark.org/review/23983
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2017-12-14 08:43:57 +00:00
Michael Mann 3d673da88c Convert to using use SPDX identifier on wsutil directory
Change-Id: Id73e641499e75bc1afc1dea29682418156f461fe
Reviewed-on: https://code.wireshark.org/review/24751
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-12-10 04:36:29 +00:00
Dario Lombardo 42b191a657 wsjsmn: use SPDX identifier.
Change-Id: Iefdfd06b3b063a0d497587142996f2cd986d413f
Reviewed-on: https://code.wireshark.org/review/24724
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-12-07 19:25:18 +00:00
AndersBroman 290fd76af6 [glib-compat] #include "ws_attributes.h" needed to handle _U_
Change-Id: Ie7aa8ef0a2ec8e65947e214488809d0df0ee015b
Reviewed-on: https://code.wireshark.org/review/24670
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-12-01 12:02:16 +00:00
Gerald Combs 67ffa3cf7d Threads: Set lifetimes and add a compatibility routine.
Join the protocol registration threads so that they call g_thread_unref
which in turn detaches/terminates the thread. This gets rid of many TSan
and DRD errors here. The remaining ones appear to be false positives.

Add g_thread_new to glib-compat (untested).

Change-Id: I4beb6746ed08656715cf7870ac63ff80cf1ef871
Reviewed-on: https://code.wireshark.org/review/24619
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-11-29 04:43:41 +00:00
AndersBroman 243fa8c441 [glib-compat] g_async_queue_timeout_pop() needed for older glibs
(2.31.18)

Change-Id: I727c8548c29b3409fab819dce072e86153232911
Reviewed-on: https://code.wireshark.org/review/24550
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-11-23 14:46:20 +00:00
AndersBroman db811a699d [glib-compat] Add g_ptr_array_new_full().
Change-Id: Ic0e054cbb28106cc02f229ad4f2476b39e544378
Reviewed-on: https://code.wireshark.org/review/24544
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-11-23 11:41:37 +00:00
João Valverde 262a84c384 Fix (and chop) static build option
This sets the scope of the static build option to Wireshark support
libraries only.

Before the patch:

Static plugins don't work with CMake and autotools.

autotools static build is broken, and most likely will always be, as
building Wireshark all-static is difficult and time-consuming.

After the patch:

For CMake Wireshark will be built with static or shared libraries and
dynamic plugins. Everything just works. CMake apparently doesn't want
you building static and shared libraries at the same time.

For autotools Wireshark will be built with shared libraries by default.
--disable-shared and --enable-static options work as usual. Dlopened
plugins are not built if --disable-shared is given to configure (to
disable shared libraries). This is a limitations imposed by libtool.

Tested on Linux. This removes broken support for building plugins
statically.

Change-Id: Ib8e8176976f136eea93a2ce8f9857b6cf9bec64c
Reviewed-on: https://code.wireshark.org/review/24241
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2017-11-19 20:16:50 +00:00
João Valverde 3996701183 Replace inet_addr() with our inet_pton() wrapper
Error checking omitted like in original code.

Change-Id: If8b4181d30ddf5717951aaf7ec61db25c0bc5322
Reviewed-on: https://code.wireshark.org/review/24309
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2017-11-09 16:08:25 +00:00
João Valverde 9a464fd9bd Avoid asserting with EAFNOSUPPORT
We require support for AF_INET/AF_INET6 to run and assume this is available
on all supported platforms. If and when reality clashes with that assumption just
avoid aborting. Errors are to be expected as long as they don't produce a crash.

Change-Id: I5c107b1a8fd64441eb96f48381412e180b66feb7
Reviewed-on: https://code.wireshark.org/review/24187
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-30 19:38:37 +00:00
Guy Harris 39ba9d4e7f Add wsutil/inet_ipv4.h.
It defines a ws_in4_addr type, which is intended to hold IPv4 addresses
in network byte order, and some macros to test for IPv4 addresses in the
local network control block and multicast IPv4 addresses.

Use those macros in places where dissectors had their own code for that
purpose.

Change-Id: I4252b410e37207157be85119a332e2a6913b332f
Reviewed-on: https://code.wireshark.org/review/24178
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-10-30 02:11:22 +00:00
João Valverde 62b870a722 Do not assert in ws_inet_ntop()
Change-Id: I9d420c5f6bc29ce94855017739169dc8e8ce4d48
Reviewed-on: https://code.wireshark.org/review/24173
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-29 21:10:23 +00:00
João Valverde de1b26a3c6 More ws_inet_ntop() tweaks.
Change-Id: I8f77f189337f9299e566a4149ae6ea481d3dbed6
Reviewed-on: https://code.wireshark.org/review/24162
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-29 15:15:20 +00:00
Guy Harris ce25b358a9 Go with the RFC 2133-and-successors values for IPv4 and IPv6 address strings.
Add a comment explaining why Windows has different, larger values for
INET_ADDRSTRLEN and INET6_ADDRSTRLEN.

Change-Id: I4ad53c6cffae46d108f778460ce653dcc9343c64
Reviewed-on: https://code.wireshark.org/review/24155
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-10-29 05:31:31 +00:00
João Valverde ac804b59e2 Improve our inet_ntop() wrapper
Also fix buffer length define, as it is not guaranteed to be 46 on
Windows (it never was guaranteed anyway for the libc implementation,
but the likelyhood of being greater was small).

Change-Id: I2db705d86f825765ed32ec70b8d22058b5d629e8
Reviewed-on: https://code.wireshark.org/review/24074
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-26 14:39:00 +00:00
Guy Harris b1147a6033 Rename some IPv6 address test functions.
They test where the address is XXX, for various values of XXX, so name
them accordingly.

Change-Id: I437175f02b3f97fecee77e8bb9416bb5b71cd0d0
Reviewed-on: https://code.wireshark.org/review/24075
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-10-26 09:24:06 +00:00
Guy Harris 458c3c026e Add a ws_in6_addr typedef for struct e_in6_addr.
That allows a parallel typedef of ws_in4_addr for guint32.

Change-Id: I03b230247065e0e3840eb87635315a8e523ef562
Reviewed-on: https://code.wireshark.org/review/24073
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-10-26 08:50:34 +00:00
Gerald Combs bfad9c56f9 CMake: Don't check for windows.h or winsock2.h.
If we're building on Windows we're going to have windows.h and
winsock2.h. Don't bother checking for them.

Change-Id: I0004c44d7364ab3f41682f34b8c84cd8617c9603
Reviewed-on: https://code.wireshark.org/review/24068
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-10-26 07:08:41 +00:00
João Valverde eae216ef1d Remove replacement inet_pton/inet_ntop
Should be available on every platform we support.

Change-Id: Ib65d78e351d22d581b427e5e93fc8d5e5348b260
Reviewed-on: https://code.wireshark.org/review/24047
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-10-25 21:03:56 +00:00
João Valverde 90644c8372 Remove inet_aton() usage everywhere
Including where it says not to in comments. Use IPv4 dotted-decimal
notation.

Change-Id: Iafe1f6fbd2bd5867c41642dc27411f47dff8ce6a
Reviewed-on: https://code.wireshark.org/review/24044
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-25 19:10:57 +00:00
João Valverde e1ef8e5f75 Test g_printf() thousands grouping flag at runtime
This tests the runtime environment so avoid hard-coding it during the build.

For now we avoid messing with locales for the test, unless it turns out to
be necessary (ISO C printf behaviour with invalid conversion specifier is
undefined).

Change-Id: I341c2ab5e716973689cf9002f13435404a41369f
Reviewed-on: https://code.wireshark.org/review/24038
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-24 22:00:46 +00:00
João Valverde 14e687c1dd Make plugin support a runtime property
Keep the option to disable at compile-time but use AC_ARG_ENABLE instead.

Change-Id: Ie8c3f5ba0db1eb6d9d4ffd742cd3aa049ead5007
Reviewed-on: https://code.wireshark.org/review/24026
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-23 20:04:14 +00:00
Pascal Quantin c23e3761a5 file_util.c: do not leak service handle
Follow-up of gd64c30052

Change-Id: I620b3fb44fe3090120f2d29809961623e00d55a4
Reviewed-on: https://code.wireshark.org/review/23999
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2017-10-20 10:25:16 +00:00
Pascal Quantin d64c300522 Do not add Npcap path if npf.sys service is found
Otherwise you can end with 2 Packet.dll (the one from WinPcap and the one
from Npcap) being loaded at the same time, which can create incompatibilities.

Bug: 14134
Change-Id: Ia06066fd54b60296e55dbfce6c6f2ddd99367479
Reviewed-on: https://code.wireshark.org/review/23969
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-10-20 04:18:09 +00:00
João Valverde 2196fcb008 Refresh wsutil/Makefile.am
Change-Id: I6a70a2dc45257826c930f57a59cdd9bf5b4c3c73
Reviewed-on: https://code.wireshark.org/review/23973
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-18 18:37:26 +00:00
João Valverde 45fbb287b4 autotools: Remove abi-compliance-checker code
It's been broken for over a year, needs to be modernized and as
implemented it's a maintenance nightmare. Get rid of it.

Ping-Bug: 13036
Change-Id: I34a6e4c28b6d3b96dd6550dd21e9cbeaf050d58f
Reviewed-on: https://code.wireshark.org/review/23967
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-18 17:19:18 +00:00
João Valverde 55b0c251a0 autotools: remove macOS Frameworks support
This treats macOS/OSX like any other Unix-like build target (Darwin),
thus removing autotools support for macOS-specific build options.

Anyone needing that is advised to use the fully-supported-on-macOS CMake
build.

Change-Id: I88e2fa7a8eea42241efcf84223ac2362d38b1e12
Reviewed-on: https://code.wireshark.org/review/23951
Petri-Dish: João Valverde <j@v6e.pt>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-17 18:50:09 +00:00
João Valverde a8a0d5ff98 autotools: Fix bogus checkAPI targets
Change-Id: Ifc8884fc0f0e4548db79a68e3fbc35c7e5fb9be9
Reviewed-on: https://code.wireshark.org/review/23947
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-17 15:33:52 +00:00
João Valverde 9764cd0a83 autotools: make maintainer-clean should allow rerunning 'configure'
Change-Id: Iedae94ffefe27b13b1967d69cacb757b5aa4576d
Reviewed-on: https://code.wireshark.org/review/23928
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>
2017-10-15 14:17:20 +00:00
Ahmad Fatoum 9d49e13166 Remove superfluous null-checks before strdup/free
NULL checks were removed for following free functions:

- g_free "If mem is NULL it simply returns"
  https://developer.gnome.org/glib/stable/glib-Memory-Allocation.html#g-free

- g_slist_free(_full)? "NULL is considered to be the empty list"
  https://developer.gnome.org/glib/stable/glib-Singly-Linked-Lists.html

- g_strfreev "If str_array is NULL, this function simply returns."
  https://developer.gnome.org/glib/stable/glib-String-Utility-Functions.html#g-strfreev

- g_slice_free "If mem is NULL, this macro does nothing."
  https://developer.gnome.org/glib/stable/glib-Memory-Slices.html#g-slice-free

- g_match_info_free "not NULL... otherwise does nothing"
  https://developer.gnome.org/glib/stable/glib-Perl-compatible-regular-expressions.html#g-match-info-free

- dfilter_free defined in Wireshark code. Returns early when passed NULL
  epan/dfilter/dfilter.c

They were also removed around calls to g_strdup where applicable:

- g_strdup "If str is NULL it returns NULL."
  https://developer.gnome.org/glib/stable/glib-String-Utility-Functions.html#g-strdup

Change-Id: Ie80c2db89bef531edc3aed7b7c9f654e1d654d04
Reviewed-on: https://code.wireshark.org/review/23406
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-15 12:38:51 +00:00
João Valverde 9bba3866ff CMake: Allow user build flags to override default build flags
Autotools has the very useful feature by design of allowing the user
to override the default build flags (you break it you keep it).

Apparently CMake applies COMPILE_OPTIONS target property after
CMAKE_{C,CXX}_FLAGS so that doesn't work here. Prepend our flags to those
variables instead to make it work then.

Specific target flag overrides can still be added with COMPILER_OPTIONS
(e.g: generated files with -Wno-warning) but this is less effective and
then we're back at the point where this overrides user flags. It's less
of a concern though.

Change-Id: I44761a79be4289238e02d4e781fef0099628817b
Reviewed-on: https://code.wireshark.org/review/23675
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>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-10-13 21:32:18 +00:00
João Valverde 2777003e12 Add version check for plugin compatibility
Only plugins built for the same feature release (X.Y) are assured binary
compatibility. Make sure we don't try to run unsuitable code and, if so,
warn the user. This might happen for example if the user manually copies
a binary plugin to the wrong folder, intentionally or by accident.

I'm using "release version" to loosely mean not a patch release
(i.e: a feature release).

Change-Id: I896e9cbbd2d3843623fff6af8ef51002ec06f1f8
Reviewed-on: https://code.wireshark.org/review/23807
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>
2017-10-03 10:09:24 +00:00
João Valverde 5c2a5dbdcd plugins: Improve output format
And some minor code style changes.

Change-Id: I97e53848db42c3981af69152b171b3a77f831da5
Reviewed-on: https://code.wireshark.org/review/23806
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-01 21:13:45 +00:00
João Valverde 0e63979730 plugins: Move the build dir scanning code to a separate function
Change-Id: Iee476ac84d530810e5b70547c462050f1c03ee1b
Reviewed-on: https://code.wireshark.org/review/23755
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>
2017-09-26 20:56:03 +00:00
João Valverde a1969dd6f6 plugins: No need to allocate a new struct
Change-Id: Ic39cf1c7f199dc5e4879d954a649d21453dcc5e5
Reviewed-on: https://code.wireshark.org/review/23753
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>
2017-09-26 19:52:30 +00:00
João Valverde f2404376f8 plugins: Build the description string while loading
Change-Id: Ia67133c1c9d005fc4a81b0727a7b1849571ab29c
Reviewed-on: https://code.wireshark.org/review/23742
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>
2017-09-26 11:33:09 +00:00
João Valverde 0b76a4957d plugins: Sort the descriptions
Change-Id: I8113ba9782962856ce86475cddf40d69ed267fb4
Reviewed-on: https://code.wireshark.org/review/23733
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>
2017-09-26 09:50:14 +00:00
João Valverde f022a629f1 plugins: Use hash table for book-keeping
Avoid having to walk the list to check for existence on every file
load.

Now the binary plugin description list in About Wireshark is randomized
instead of sorted by load order. We may want to change that.

Add missing "const" to plugin->version.

Fix an apparent trivial leak where the GModule handle was not closed on
exit.

Change-Id: I774215a84b080bbe889f88cc6a9b777bcf60b335
Reviewed-on: https://code.wireshark.org/review/23732
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-09-26 04:11:07 +00:00
João Valverde 8615081a09 plugins: Fix crash loading binary module twice
If a plugin is repeated we destroy the GModuleHandle in plugins_scan_dir()
but we have already added the entry points to the list of registered
plugins.

Check for repeated plugins before adding it to the list of registered
plugins, not after.

Don't check for both name and version, check only for repeated names.

Give the plugin callback a more descriptive name.

Change-Id: I22cbbb059b8029877580fc33517310496c93e5d5
Reviewed-on: https://code.wireshark.org/review/23726
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>
2017-09-25 16:45:23 +00:00
João Valverde d7ec2cbc38 autotools: Use package flags to configure libpcap
Change-Id: Icd64014b597a8e60d2aff9d180c441c6ffccff26
Reviewed-on: https://code.wireshark.org/review/23329
Reviewed-by: João Valverde <j@v6e.pt>
2017-09-24 12:58:06 +00:00
João Valverde fd4dc6f115 plugins: Fixups for g9260461f4f
Put plugins in CMake build dir with a version subdir. This avoids some
weird special cases, however running with autotools from build dir
displays the wrong global folder in about->folders. Unfortunately
the hack to run from the autotools build dir is troublesome.

Various fixes for Windows builds.

Try to fix also build dir issue loading plugins on macOS with
ENABLE_APPLICATION_BUNDLE (blind).

Change-Id: Ic3c7c21f5850c12a53844202d61fa0592b45739c
Reviewed-on: https://code.wireshark.org/review/23657
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: João Valverde <j@v6e.pt>
2017-09-23 17:49:08 +00:00
João Valverde 25ba538bc5 plugins: Be more descriptive in "about wireshark"->"folders"
Display separate entries for binary plugins and lua scripts.

This is explained in the user guide, that the binary folder is
a subfolder of the lua folder, but it's probably a good idea to be more
explicit about it, at the risk of cluttering the interface a bit.

Move GeoIP information down because it seems the least important.

Add helper functions to provide plugin version subdir.

Change some #ifdefs while at it for legibility.

Change-Id: Ieb8665df029b3c14de19e2c973bd9b1cc4ec4621
Reviewed-on: https://code.wireshark.org/review/23609
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>
2017-09-20 16:41:21 +00:00
João Valverde 8db4ddd40c Rename get_plugin_dir() for consistency
WS_DLL_PUBLIC const char *get_plugin_dir(void);
WS_DLL_PUBLIC const char *get_plugins_pers_dir(void);

Opt for the plural form consistently (for public functions at least).

Change-Id: I8a5861ad7f90f9c87168bd3275bd9dbc5c83b749
Reviewed-on: https://code.wireshark.org/review/23608
Petri-Dish: João Valverde <j@v6e.pt>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-09-20 01:00:37 +00:00
João Valverde 0bfafb3e7a plugins: Change personal plugin dir path on Unix
Installing machine code to XDG_CONFIG_HOME is problematic.

Use ~/.local/lib/wireshark/plugins instead.

XDG_CONFIG_HOME should be architecture independent. This allows copying the
configuration between different architectures safely.

Reference: https://www.freedesktop.org/software/systemd/man/file-hierarchy.html

Change-Id: I1b18f64aab4dd351d611cfbea3b9333f23c98bfa
Reviewed-on: https://code.wireshark.org/review/23498
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>
2017-09-17 16:56:06 +00:00
João Valverde 9260461f4f plugins: Use minor version number for plugin install path
Wireshark patch releases (X.Y.Z) are binary compatible so reflect
that in the plugin installation path.

By installing to $pkglibdir/plugins/X.Y out-of-tree plugins don't
need to be reinstalled with every patch release.

Change-Id: I9d1728e6fb12bcb51d2a723af22c750cb7a966cf
Reviewed-on: https://code.wireshark.org/review/23497
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>
2017-09-17 16:55:51 +00:00
João Valverde 978f6b4e1a plugins: Fix paths to match WSUG
The Wireshark User Guide seems to say:

Global lua plugins are in $pkglibdir/plugins
Personal lua plugins are in XDG_CONFIG_HOME/plugins

Global binary plugins are in $pkglibdir/plugins/$version
Personal binary plugins are in XDG_CONFIG_HOME/plugins/$version

Fix code to match that. This is a backward-incompatible change
for global lua plugins and personal binary plugins.

Adds a version subfolder to the personal plugin folder for binary plugins.

This allows for safe upgrades and side-by-side installations
with different prefixes (they no longer use the same personal dir).

Change-Id: Ie0f039113628a257625a9a9fb2cb30e532f5dd47
Reviewed-on: https://code.wireshark.org/review/23516
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>
2017-09-17 16:54:52 +00:00
João Valverde 21d2158a0b CMake: Initial work to install headers for the benefit of plugins
To be continued incrementally to fix gaps and omissions.

If we are willing to reorganize the source tree to have one or two header
include folders this could be simplified considerably.

It would also force developers to give more consideration to API issues,
which is a good thing.

See also e7ef19efc0.

Bug: 14062
Change-Id: I0759da2f9793cfb5cf92c9e231457bba43df4353
Reviewed-on: https://code.wireshark.org/review/23548
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>
2017-09-17 07:22:16 +00:00
Jakub Zawadzki 7c23f56a4d Fix compilation errors when configured --without-plugins and without lua.
filesystem.c: In function ‘init_plugin_pers_dir’:
filesystem.c:1041:5: error: ‘plugin_pers_dir’ undeclared (first use in this function)
     plugin_pers_dir = get_persconffile_path(PLUGINS_DIR_NAME, FALSE);
     ^~~~~~~~~~~~~~~
filesystem.c:1041:5: note: each undeclared identifier is reported only once for each function it appears in
filesystem.c: In function ‘get_plugins_pers_dir’:
filesystem.c:1062:10: error: ‘plugin_pers_dir’ undeclared (first use in this function)
     if (!plugin_pers_dir)
          ^~~~~~~~~~~~~~~

Change-Id: I9ace17da42665d135b9432b1f19970491589e3bf
Reviewed-on: https://code.wireshark.org/review/23545
Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-09-15 13:07:48 +00:00
João Valverde e7ef19efc0 autotools: Initial work to install headers for the benefit of plugins
Install public headers required to build plugins for libwireshark (taps and
dissectors).

The source tree is organized to serve the CLI/GUI parts of wireshark.
Plugins are built in tree. This change is intende to allow plugins to be built
out-of-tree but we want to avoid dumping all headers into /usr/include.

To be continued incrementally to fix errors and omissions.

Change-Id: Iaa0def0ba3de4b456a29114c315544d2d64fa748
Reviewed-on: https://code.wireshark.org/review/23374
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>
2017-09-15 10:11:55 +00:00
João Valverde 69f0cb0cef wsutil: Initialize and store plugin personal dir
Obviate allocation on every call to get_plugins_pers_dir().

Change-Id: I089ae499f93739d490d4552f59b5db5996f7d26f
Reviewed-on: https://code.wireshark.org/review/23495
Petri-Dish: João Valverde <j@v6e.pt>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: João Valverde <j@v6e.pt>
2017-09-11 16:48:49 +00:00
Uli Heilmeier 26a5cd2d78 ws_cpuid: include ws_attributes
Otherwise _U_ is not defined.

Change-Id: I221f64c7d89c221e5a63a573e06457699d0a177e
Reviewed-on: https://code.wireshark.org/review/23440
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-09-09 12:57:56 +00:00
Jakub Zawadzki 1c6f6c691f sharkd: implement proper JSON string unescaping, based on JSON dissector.
Change-Id: I749b78b759f98c78526840b8bb1cbccfc17a5611
Reviewed-on: https://code.wireshark.org/review/23365
Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl>
Tested-by: Jakub Zawadzki <darkjames-ws@darkjames.pl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Jakub Zawadzki <darkjames-ws@darkjames.pl>
2017-09-08 18:14:59 +00:00
João Valverde d0a91b27f2 plugins: config.h must not be included by public headers
For a sane plugin build environment. Include config.h as the first
header in the .c file instead.

Fix by moving required compiler attribute macros to a new
"ws_attributes.h" API header.

Change-Id: I34f58a927f68c1a0e59686c14d214825149749e1
Reviewed-on: https://code.wireshark.org/review/23400
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>
2017-09-06 08:10:56 +00:00
Guy Harris b66bdbd426 More explanation in the comments.
Change-Id: I1e5597ac291d38370e8b1537a75f3ba1d9a86bc9
Reviewed-on: https://code.wireshark.org/review/23156
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-08-21 00:38:57 +00:00
Ahmad Fatoum aa2117a8f2 Include xtea.[hs] in CMakeLists.txt and Makefile.am
CMake part was missing. Autotools part didn't include header.

Change-Id: I5a642a80d30b02bb16eb48e0e4e1f8e0e8332a75
Reviewed-on: https://code.wireshark.org/review/23051
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-08-12 23:18:36 +00:00
Guy Harris 3bcd0e142a Fix a comment.
\, not /, is the standard pathname separator on Windows.

Change-Id: Ia1f1be5e4bd76519e27df430e8ef46967ffe35f5
Reviewed-on: https://code.wireshark.org/review/23024
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-08-08 21:05:26 +00:00
Guy Harris f63b68f707 Further cleanups.
If a variable is initialized in a loop body or an if clause or a switch
clause, declare it inside the loop body/clause, and de-initialize it
before leaving the loop body/clause.

De-initialize the gnutls_pkcs12_t before leaving rsa_load_pkcs12(), so
as not to leak it.

Always leave the per-bag loop by "goto done", even if we're not within
an inner loop, to make it clearer what we're doing.

We initialize the bag structure at the beginning of that loop body;
de-initialize it at the end.

If we leave the loop without a private key, and we don't have an error
message, the error is "we didn't find a PKCS8 key"; report that.

Change-Id: I87cf296876c8f1879f69d01ce67ca2829b4f8d16
Reviewed-on: https://code.wireshark.org/review/22958
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-08-05 22:51:37 +00:00
Michael Mann 1d457701c5 rsa.c: strerror -> g_strerror
Pacify checkAPIs.pl

Change-Id: I637a6cd678b99d05cd1b26fd3cba6ad4dd19e8d2
Reviewed-on: https://code.wireshark.org/review/22957
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-08-05 18:32:35 +00:00
Guy Harris 1cabeea9b8 Fix up indentation.
Change-Id: I99445d9934dbb4c97c4c41192c8fe908441f2843
Reviewed-on: https://code.wireshark.org/review/22942
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-08-04 22:27:12 +00:00
Guy Harris a25d477fa7 Clean up private key file error reporting.
Ensure that rsa_load_pem_key() and rsa_load_pkcs12() always return an
error message string if they fail, so that

	1) they don't return NULL without supplying an error string;

	2) they don't supply an error string if they succeed.

If either of them fails, report the error; if there's no error string,
report an unknown error (that shouldn't happen, but the wsutil/rsa.c
code needs more cleanup before I'll believe it can't happen).

While we're at it, clean up some of those error strings, return NULL
rather than 0 as the failure case from rsa_load_pkcs12() as we do in
rsa_load_pem_key() (they mean the same thing, but NULL makes it a bit
clearer), and de-initialize the private key structure in
rsa_load_pem_key() if we fail (so that we don't leak memory).

Change-Id: Id9dd331800d87b017a500a6f579df446057f555b
Reviewed-on: https://code.wireshark.org/review/22941
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-08-04 22:25:53 +00:00
Olivier Verriest 97dcf87a86 SNMP: add support for USM SHA-2 algorithms (RFC 7860)
Generlize the USM handling and add support for HMAC-SHA-2 authentication
protocols.

Change-Id: I7cca2f24db61620423fded078c680322aff86400
Reviewed-on: https://code.wireshark.org/review/22846
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-08-04 05:57:20 +00:00
João Valverde fb052a637f Use g_build_filename() instead, fix indentation
Change-Id: I459208eed4a76b104bc28aa44ab05374e57043de
Reviewed-on: https://code.wireshark.org/review/22873
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-08-01 21:20:37 +00:00
Alexis La Goutte b1c993df0f xtea[.ch] (wsutil): Add Modelines info
Change-Id: I32823df7a6ad543fd7912f64169050534b6ff3a4
Reviewed-on: https://code.wireshark.org/review/22532
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-07-05 18:06:40 +00:00
Stig Bjørlykke 3b5c88ea4b wsutil: Back out profile_write_info_file
Change-Id: I89a9aaeeba1689cce04f239dafdc9003492aba16
Reviewed-on: https://code.wireshark.org/review/22346
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-06-22 14:59:45 +00:00
Stig Bjørlykke 7af770dfa7 wsutil: Return error from profile_write_info_file
Change-Id: I1d91cef01ced6cceaa75d1618ffcb59eae5b8e6f
Reviewed-on: https://code.wireshark.org/review/22325
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-06-22 02:41:59 +00:00
Stig Bjørlykke 6117ff496b wsutil: Check return from ws_write
Change-Id: I73f65222dc23ebcb484f2598a12f43b284654420
Reviewed-on: https://code.wireshark.org/review/22321
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-06-21 20:09:52 +00:00
Stig Bjørlykke 6e0bc30a95 wsutil: Ignore return from ws_write
Change-Id: Idad4dd84538e3ccb7b258775704db8b6bd6c301e
Reviewed-on: https://code.wireshark.org/review/22319
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-06-21 20:04:43 +00:00
Anders 48a6487116 [filesystem.c] Add a cast to aviod a warning with VisualStudio 2017.
Change-Id: I95186bd54ae487e112fcb533c62bb8f9b210dc24
Reviewed-on: https://code.wireshark.org/review/22309
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-06-21 16:13:05 +00:00
Stig Bjørlykke 99c3c6d908 wsutil: Free files in reset_default_profile
This plugs a memory leak.

Change-Id: Ic989a89353d10de6f8f07df6a734d2b912facb7e
Reviewed-on: https://code.wireshark.org/review/22305
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-06-21 15:46:22 +00:00
Stig Bjørlykke a14ef98540 Qt: Write a list of profile files at startup
This file will contain all personal config files which will be
fetched from a profile.

Change-Id: I430ca84ccefc17f0e21c8efb93a92602ab8d5661
Reviewed-on: https://code.wireshark.org/review/22303
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-06-21 15:23:58 +00:00
Stig Bjørlykke 4f1053c546 Qt: Create the user profiles dir at startup
Ensure the user profiles directory is created at startup so that
users can put downloaded profiles without creating the directory.

Change-Id: Ib06bb3055daef8fd9e78d7887ce56f8fe50e48bf
Reviewed-on: https://code.wireshark.org/review/22275
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-06-20 19:45:03 +00:00
Guy Harris 435c68cd2b Fix SURROGATE_VALUE() to match what RFC 2781 says.
While we're at it, note in the comment for get_utf_16_string() the
"decoding UTF-16" algorithm in RFC 2781.

Change-Id: I5d7dc5c09af0474c055796e49e0c7b94fa87d2ad
Reviewed-on: https://code.wireshark.org/review/22171
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-06-16 18:41:00 +00:00
Guy Harris 5039d0e576 Change some names to reflect Apple's new UNIX-for-Macs name.
{OS_X,os_x} -> {MACOS,macos}.

Change-Id: Icebea6ab566c65996ee97bacb88fac7e84ec32de
Reviewed-on: https://code.wireshark.org/review/22161
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-06-16 08:50:22 +00:00
Guy Harris 63b91ad311 Rename a routine to match the OS name.
It's now "macOS".

While we're at it, note that the property list from which it fetches
version information still calls it "Mac OS X".

Change-Id: I438ef9dc65c2619d7378b0deb5efc84734a2ac6d
Reviewed-on: https://code.wireshark.org/review/22159
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-06-16 07:58:25 +00:00
Guy Harris b01c85c17a Fix indentation.
Change-Id: I9ea3947a4100d4d566c0d6815de5336214f9f581
Reviewed-on: https://code.wireshark.org/review/22062
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-06-10 03:00:08 +00:00
Guy Harris 0480a0be81 Put the non-filter part of epan/color_filters.h into wsutil/color.h.
Places that only need color_t, such as certain preferences, don't need
the color filter stuff.

Change-Id: I88fc2858454d04e659b323a8bc28b21d362ca3fb
Reviewed-on: https://code.wireshark.org/review/22060
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-06-10 02:56:31 +00:00
Michael Mann 844c7863a3 rsa.h: include <stdio.h>
Pacify OS/X buildbot

Change-Id: Icbf49b747473adfa16c1a08c81489b68a88d9a93
Reviewed-on: https://code.wireshark.org/review/21979
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-06-06 12:00:31 +00:00
Ahmad Fatoum 502cc61711 Move RSA key loading and decryption functions to wsutil
Loading PEM and PKCS#11 keys was being done in static functions
in packet-ssl-utils.c. These were moved to wsutil, with prototypes
in a new <wsutil/rsa.h> header. This adds gnutls as optional
dependency to wsutil.

The RSA decryption helper was also moved and is now provided in
<wsutil/wsgcrypt.h>.

This allows more dissectors to access this functionality.

Change-Id: I6cfbbf5203f2881c82bad721747834ccd76e2033
Reviewed-on: https://code.wireshark.org/review/21941
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-06-05 23:43:03 +00:00
Ahmad Fatoum 345046c83d wsutil: Add XTEA block cipher
XTEA is a 64-bit block Feistel cipher with a 128-bit key and a suggested
64 rounds. It's used by the MMORPG Tibia for encrypting game server traffic.

Usual XTEA treats the blocks as big-endian. Tibia treats them as little
endian, therefore both versions are provided.

Change-Id: I9ad0c8e066f848b20772ce4e1d3df19deff307b8
Reviewed-on: https://code.wireshark.org/review/21942
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-06-05 16:10:58 +00:00
Guy Harris 7321183716 Put the HAVE_REMOTE hack into wsutil/wspcap.h, and include that file.
Have a header file that defines HAVE_REMOTE if HAVE_PCAP_REMOTE is
defined, and then includes pcap.h.  Replace all other includes of
pcap.h, and the definition of HAVE_REMOTE, with includes of that file.
Check for anything other than wspcap.h including pcap.h in checkAPIs.pl.

Change-Id: I3cbee8208944ad6f006f568b3fe3134e10b2a883
Reviewed-on: https://code.wireshark.org/review/21605
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-05-11 19:58:15 +00:00
Martin Mathieson 8638eb91c7 Add g_get_monotonic_time() to glib-compat and use
Change-Id: If41dab19692516270e8b4bcf1a8a954bb8dc3ccc
Reviewed-on: https://code.wireshark.org/review/21480
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-05-04 03:45:07 +00:00
Max Dmitrichenko d1c0f2b95a Fix memory leak in create_persconffile_profile
found by valgrind

Change-Id: I15aef9d78dffac44e36849349dc57b4b36f23de1
Reviewed-on: https://code.wireshark.org/review/21228
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-04-19 22:27:27 +00:00
Guy Harris 720705091c Check the result of localtime().
Unlikely to fail, but it squelches CID 1398220.

Change-Id: I0e40146f0a32c1082e84052c6b3e382fe6a15ae7
Reviewed-on: https://code.wireshark.org/review/21177
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-04-18 05:43:54 +00:00
Guy Harris 2c44a7f930 Clean up handling of enabled/disabled protocols/heuristic dissectors.
Add a "report a warning message" routine to the "report_err" code in
libwsutil, and rename files and routines appropriately, as they don't
only handle errors any more.

Have a routine read_enabled_and_disabled_protos() that reads all the
files that enable or disable protocols or heuristic dissectors, enables
and disables them based on the contents of those files, and reports
errors itself (as warnings) using the new "report a warning message"
routine.  Fix that error reporting to report separately on the disabled
protocols, enabled protocols, and heuristic dissectors files.

Have a routine to set up the enabled and disabled protocols and
heuristic dissectors from the command-line arguments, so it's done the
same way in all programs.

If we try to enable or disable an unknown heuristic dissector via a
command-line argument, report an error.

Update a bunch of comments.

Update the name of disabled_protos_cleanup(), as it cleans up
information for disabled *and* enabled protocols and for heuristic
dissectors.

Support the command-line flags to enable and disable protocols and
heuristic dissectors in tfshark.

Change-Id: I9b8bd29947cccdf6dc34a0540b5509ef941391df
Reviewed-on: https://code.wireshark.org/review/20966
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-04-08 20:40:08 +00:00
Guy Harris 357cfd3b03 A bunch of "{Mac} OS X" -> "macOS" changes.
Avoid anachronisms, however; there was no "macOS 10.0" or even "OS X
10.0", for example.  It was "Mac OS X" until 10.8 (although 10.7 was
sometimes called "OS X" and sometimes called "Mac OS X"), and it was "OS
X" from 10.8 to 10.11.

Change-Id: Ie4a848997dcc6c45c2245c1fb84ec526032375c3
Reviewed-on: https://code.wireshark.org/review/20933
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-04-05 19:16:22 +00:00
Pascal Quantin cabd7d8293 wsutil: fix a NULL pointer dereference when there is a single plugin registered
Rework loop to avoid dereferencing a NULL pointer. Bug introduced in g6d79055

Change-Id: I88a9f2d045b633cc2365ff6ce939f3315e7d42cc
Reviewed-on: https://code.wireshark.org/review/20751
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: Anders Broman <a.broman58@gmail.com>
2017-03-28 05:05:13 +00:00
Michael Mann 618ca466aa Add support for verifying CIP Safety CRC values.
Change-Id: I44f7ff6980f27b1a0d4199a91f9b217aec7e4652
Reviewed-on: https://code.wireshark.org/review/20557
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-03-16 05:51:04 +00:00
erikdejong fe285c640b Replace aes.c and des.c by Libgcrypt
Follow-up of https://code.wireshark.org/review/20095

Rewritten functions:
- crypt_des_ecb

crypt_des_ecb verified against previous crypt_des_ecb implementation with
4294967295 random keys and input buffers from /dev/random as I cannot find a
suitable pcap which uses DES

Change-Id: I21ec2572451e0ded4299ffadd8dd687817bc6318
Reviewed-on: https://code.wireshark.org/review/20429
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-03-10 02:54:51 +00:00
Erik de Jong f1c75cf6ef Rewrite dissectors to use Libgcrypt functions.
As discussed on the mailinglist, rewriting dissectors to use Libgcrypt
functions as Libgcrypt will be mandatory after change 20030.
Removal of following functions:
- crypt_md4
- crypt_rc4*
- aes_cmac_encrypt_*
- md5_*
- sha1_*
- sha256_*

Further candidates:
- aes_*
- rijndael_*
- ...

Added functions:
- ws_hmac_buffer

Added const macros:
- HASH_MD5_LENGTH
- HASH_SHA1_LENGTH

Changes on epan/crypt/* verified with captures from
https://wiki.wireshark.org/HowToDecrypt802.11
Changes on packet-snmp.c and packet-radius.c verified with captures from
https://wiki.wireshark.org/SampleCapture
Changes on packet-tacacs.c verified with capture from
http://ccie-in-3-months.blogspot.nl/2009/04/decoding-login-credentials-regardless.html

Change-Id: Iea6ba2bf207cf0f1bf2117068fb1abcfeaafaa46
Link: https://www.wireshark.org/lists/wireshark-dev/201702/msg00011.html
Reviewed-on: https://code.wireshark.org/review/20095
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-03-02 23:58:05 +00:00
Dario Lombardo 2de30dd18d wsutil: fix bugs in plugins_cleanup().
If plugin_list was NULL, plugin_types didn't get cleaned.
Add test and set of open_info_arr.

Change-Id: I7669e3ba86039fb2b26ff2da64f51896053c5e68
Reviewed-on: https://code.wireshark.org/review/20195
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-26 18:00:23 +00:00
Jakub Zawadzki dfc26accc0 Fix compilation without plugins:
filesystem.c: In function ‘free_progdirs’:
filesystem.c:2209:12: error: ‘plugin_dir’ undeclared (first use in this function)
     g_free(plugin_dir);

Change-Id: Ib52b86d41be79b8ed7e42f5fdfaddcae6b0ca5c8
Reviewed-on: https://code.wireshark.org/review/20270
Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-25 13:36:40 +00:00
Guy Harris 0327078837 Only do save_errno = errno and errno = save_errno around g_free();
There is *no* need to do it around an assignment statement.  (We
*probably* don't need to do it around g_free(), but better safe than
sorry - maybe some memory allocator makes system calls to hand regions
of the address space back.)

Change-Id: Ib57540cc36b505aadf4a5e8885b9a744a35b1f75
Reviewed-on: https://code.wireshark.org/review/20236
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-02-22 01:42:35 +00:00
Gerald Combs 012a179785 Fix a double free.
In create_persconffile_profile, pf_dir_path_copy needs to be allocated
separately since the subsequent call to get_dirname is destructive. Add
back a call to g_strdup. This should hopefully fix a crash in the Win32
buildbot.

Change-Id: I591b5845032c9b8a5324bf6ac60fc43d1e92ac2e
Reviewed-on: https://code.wireshark.org/review/20231
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-02-21 19:03:43 +00:00
AndersBroman e2e4415c9f Add some glib functions not available in older glibs
Change-Id: I6526d799447a3b6c0b9bb42f8d0f8c3415299ed0
Reviewed-on: https://code.wireshark.org/review/20158
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2017-02-20 12:55:49 +00:00
Michael Mann 897c750127 Clean up some memory leaks in wsutil/filesystem.c
The fixes involve functions always returning a string that needs to be
freed by the caller.  That way the static string pointers within the functions
don't end up leaking at program end.

Change-Id: I35a8dc37536c2927d88f33217887f62efafcc8ca
Reviewed-on: https://code.wireshark.org/review/20175
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-19 01:27:14 +00:00
Dario Lombardo 64d0133e88 plugins: free list on cleanup.
Change-Id: Idff606297f72238f8539cb00ea394ee80fcb502c
Reviewed-on: https://code.wireshark.org/review/20074
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-18 14:13:26 +00:00
Dario Lombardo f792625b1d epan/wsutil: free memory on exit.
Change-Id: I1cf3a4ce3b21b2e10887cbef5576e5e028e55bab
Reviewed-on: https://code.wireshark.org/review/20052
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-18 14:11:45 +00:00
Dario Lombardo 6d79055ba6 wsutil: remove leaks from filesystem and plugins code.
Change-Id: Iac2805c0130bd2ba6cdb3c9dd997050274d58d99
Reviewed-on: https://code.wireshark.org/review/20020
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-18 13:45:14 +00:00
Stig Bjørlykke c01cdd4e47 Qt: Reset Default profile support
Add support for resetting the Default profile by deleting it in
the Profile Dialog.  All profile files will be deleted and all
other files will be kept.

Change-Id: I795a6db3ee7b2c29e7aba461183e6cc411798b75
Reviewed-on: https://code.wireshark.org/review/20097
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2017-02-14 18:15:12 +00:00
Dario Lombardo 7c0c580c4b wiretap: add cleanup routine.
The cleanup routine has been added to exit section of the applications.
Those which required a exit restyle have been patched as well.

Change-Id: I3a8787f0718ac7fef00dc58176869c7510fda7b1
Reviewed-on: https://code.wireshark.org/review/19949
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2017-02-14 10:22:20 +00:00
Peter Wu 6b84ddee83 Make Libgcrypt a mandatory dependency
Removed all guards for HAVE_LIBGCRYPT, change autotools and CMake to
error out if it is not available. Update release notes, developer
documentation and README with the new status. Clarify relation with
GnuTLS in macosx-setup.sh. Install Libgcrypt via brew script.

Motivation for this change is that many dissectors depend on Libgcrypt
and having it optional increases the maintenance burden (there have been
several compile issues in the past due to the optional status).
Furthermore, wsutil has crypto code that can be replaced by Libgcrypt.

Change-Id: Idf0021b8c4cd5db70b8766f7dcc2a8b3acbf042f
Link: https://www.wireshark.org/lists/wireshark-dev/201702/msg00011.html
Reviewed-on: https://code.wireshark.org/review/20030
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-02-13 18:35:47 +00:00
Guy Harris 0e74fbb428 Make sure pid_t is defined.
Just as we include <windows.h> on Windows to get HANDLE defined, include
<sys/types.h> on UN*X to get pid_t defined.

We don't seem to need this (yet) on the master and 2.2 branches, but it
looks as if it might be necessary on the 2.0 branch.  Do it everywhere.

Change-Id: I9535fa9944265746d332f8dc337e42a020b503d3
Reviewed-on: https://code.wireshark.org/review/19998
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-02-07 21:36:10 +00:00
Michael Mann c7622c9559 pint(.h): Add Modelines and fix indent (use spaces)
Change-Id: Icadbf65ad186c775b2a0ca8596d5bf4ba66e4c68
Reviewed-on: https://code.wireshark.org/review/19873
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-05 13:19:46 +00:00
Peter Wu 7893ffa478 wsutil/sober128: remove unused macros and functions
Removed unused macros/functions that are apparently imported from
LibTomCrypt, only LOAD32L and STORE32L are needed. Remove code that
tries to distinguish between little/big endian, since WORDS_BIGENDIAN
was never defined, this would never have worked on big endian anyway.

Remove the special ROR "optimization" for GCC on i386, modern compilers
are able to optimize it to exactly the same thing. The generic
LOAD32L/STORE32L macros are less optimized (as can be seen in the
generated code), but this was not noticable in the mean running time.

Tested with the packet capture from bug 3232, the result is the same:

    tshark -ocorosync_totemnet.private_keys:example.com -r corosync-totemsrp--key:example.com--2nodes.pcap -Vx

Bug: 13368
Change-Id: I59bf27d7dd990bbcd5ad34a1797f4a6c8a04512d
Reviewed-on: https://code.wireshark.org/review/19894
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-02-02 21:13:55 +00:00
Peter Wu b3035df887 (D)TLS: fix type of record sequence number
The record sequence number is 64-bit, not 32-bit. This applies to all
SSLv3/TLS/DTLS versions. Without this fix, after about four million
records, the wrong MAC is calculated (for TLS 1.2) or decryption will
fail (for TLS 1.3).

Change-Id: I05e5e8bc4229ac443a1b06c5fe984fb885eab1ca
Reviewed-on: https://code.wireshark.org/review/19824
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-01-29 23:31:29 +00:00
Guy Harris 5fbcfd632a Clean up some UN*X-vs-Windows socket issues.
Have a wsutil/socket.h file, for inclusion by everything that uses
sockets, that contains the UN*X-vs-Windows #includes and #defines to
hide some UN*X-sockets vs. Winsock API differences.  That stuff mostly
comes from from extcap/extcap-base.h; have that file just include
wsutil/socket.h rather than defining that stuff itself.

Include it in sharkd_daemon.c.  Use socklen_t for the size of things to
pass to bind() as the last argument; wsutil/socket.h defines it as int
on Windows.

Ignore sharkd in Git.

Change-Id: I3f2171b7aa613717f52305f62bfd7d43e0172dc6
Reviewed-on: https://code.wireshark.org/review/19796
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-01-26 07:00:06 +00:00
Jakub Zawadzki e2930f3b78 Add sharkd - daemon variant
sharkd listens on UNIX socket and allows external clients
to run commands like: loading file, analysing frames or running TAP(s).

Change-Id: I443b2865e4adfd1c11f4f57d09ff7fce6b1e8766
Reviewed-on: https://code.wireshark.org/review/18208
Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Jakub Zawadzki <darkjames-ws@darkjames.pl>
2017-01-25 07:19:05 +00:00
Alexis La Goutte d7ac90bfab Happy new Year 2017 !
Change-Id: I8ae8a1fdc8d0df0779ef119c527f41dac9e0dbdb
Reviewed-on: https://code.wireshark.org/review/19476
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.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>
2017-01-01 14:14:18 +00:00
Gerald Combs 795f4eb106 Qt+Win32: Make software updates more friendly.
Add WinSparkle can_shutdown and shutdown_request callbacks which are
called prior to running the installer. Reject updates when we have
unsaved information. Add notes about possible improvements.

Ping-Bug: 9687
Ping-Bug: 12989
Change-Id: Ia126244b311417aa3105ea8136f186adc2745445
Reviewed-on: https://code.wireshark.org/review/19244
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-12-20 14:18:14 +00:00
Peter Wu d5fdbef7f4 cmake,wslua,wsutil: load files from run/ instead of source tree
Fixes Lua on macOS, tested with an out-of-tree build:

    WS_BIN_PATH=$PWD/run ../wireshark/test/test.sh -s wslua

Previously programs that were ran from the build directory would load
data files (radius/, diameter/, init.lua) from the source directory.
Then in the case of Lua, files were loaded from the program directory
($BUILDDIR/run/init.lua on Linux) or source directory
(sSOURCEDIR/epan/wslua/console.lua).

On macOS, this does not work for Lua since files are installed into
$BUILDDIR/run/Wireshark.app/Contents/Resources/share/wireshark/init.lua
instead. Since CMake always copies data files (radius, console.lua,
etc.) into the build directory, make get_datafile_dir() return this
"run" directory instead.

Change-Id: If97d2f5686271caf9ad4d4e4fc58e902dc592a98
Reviewed-on: https://code.wireshark.org/review/19330
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-12-20 13:16:57 +00:00
João Valverde 166e129e7e Improve some unit strings with unicode characters
Change-Id: Ic6812fd266832743962e020cfc8f0af2d4742fdf
Reviewed-on: https://code.wireshark.org/review/19308
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: João Valverde <j@v6e.pt>
2016-12-16 22:49:30 +00:00
Jiri Novak 9090afbfe9 Save RTP audio to file: RTP Stream Analysis dialog allows save audio for non G.711 codecs and mixed codecs
- spaghetti code for save was split into separate functions
- code saves G.711 only, all other codecs are saved as silence with correct duration
  - code is ready to include other codecs
  - code supports 8000 Hz sampling rate only, other rates are rejected with warning
  - bidirectional stream (forward and reverse) creates stereo .au file
- output is based on timestamps in RTP streams
  - save operation is slower than before because it is set of seek() - one per each codec sample
- code allows align of save audio:
  - as it is - each stream is saved from its beginning, no aling
  - to start of each other - later stream is prepended with silence
  - align saved audio to beginning of capture file - each stream is prepended with silence
- save to raw works correctly now - only payload is saved
  - old code was inserting G.711 silence time to time to raw data

Bug: 13242
Change-Id: I74d02a1cc1c75acf9ffe930d078c00a0555cbfb6
Reviewed-on: https://code.wireshark.org/review/19245
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-12-15 05:16:29 +00:00
Stig Bjørlykke fc8f787565 Skip loading the Nordic BLE Sniffer dll on WIN32
The dissector for the Nordic BLE Sniffer was added as internal in
g7844a118, so ensure we don’t load this third party dll on WIN32.

Change-Id: I74c200d42793f3c1e764bc9f6c3a9a795d38a5a7
Reviewed-on: https://code.wireshark.org/review/19259
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-12-14 11:49:45 +00:00
Dario Lombardo 43000acd74 ui: move filesystem code to wsutil/filesystem.c
This function can be used by code outside ui (eg. extcap).

Ping-Bug: 13218
Change-Id: Ic11f7acebefeaf777692df044ebff9b1bc387aa3
Reviewed-on: https://code.wireshark.org/review/19178
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-12-09 15:50:04 +00:00
Guy Harris 037c64aa34 Clean up initialization code for programs.
Make the init_progfile_dir() call unconditionally, even if plugins
aren't supported, as that doesn't necessarily mean nobody uses the
directory containing the executable.

Report the error the same way in all programs, and free the error string
after we're finished with it.

Make the error - and the comment before the code - reflect what
init_progfile_dir() is actually doing (the goal is to get the full
pathname of the directory *containing* the executable; that's generally
done by getting the pathname of the executable and stripping off the
name of the executable, but that's won't necessarily always be the
case).  Also note for TShark that we won't be able to capture traffic,
just as we do for Wireshark (if we don't have the pathname of the
program file, we don't have a pathname to use to find dumpcap).

Have the plugin scanner just fail silently if we weren't able to get the
plugin directory path, so we don't have to worry about calling it if
init_progfile_dir() fails.

Clean up white space while we're at it.

Change-Id: I8e580c719aab6fbf74a764bf6629962394fff7c8
Reviewed-on: https://code.wireshark.org/review/19076
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-12-05 04:27:49 +00:00
Guy Harris faf70602a8 Update a comment to reflect current reality.
Change-Id: Ied84e0363161ebc42c8cf24e7ade4b1b4e536448
Reviewed-on: https://code.wireshark.org/review/19074
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-12-05 03:21:59 +00:00
Guy Harris 6ac40522af Make sure config.h is included before inet_addr.h.
Otherwise, _FILE_OFFSET_BITS might be defined by a header file included
by inet_addr.h before it gets defined by config.h.

Change-Id: I5987b3f1493b81fd2d427d9792b9606117b255d0
Reviewed-on: https://code.wireshark.org/review/19018
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-12-02 10:33:42 +00:00
Gerald Combs 1431b97430 Add more information about UTF 8 in our source code.
Change-Id: I81d41fdc1aa66dd904160508c4a2e634337b5ba0
Reviewed-on: https://code.wireshark.org/review/18833
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-11-15 19:09:47 +00:00
Dario Lombardo 4863d813e9 wsutil: add initializer (found by clang ccc).
Warning:

wireshark/wsutil/strtoi.c:113:1: warning: The left operand of '<' is a garbage value
DEFINE_WS_STRTOI_BITS(32)
^~~~~~~~~~~~~~~~~~~~~~~~~
wireshark/wsutil/strtoi.c:83:12: note: expanded from macro 'DEFINE_WS_STRTOI_BITS'
                        if (val < 0) \
                            ~~~ ^
wireshark/wsutil/strtoi.c:114:1: warning: The left operand of '<' is a garbage value
DEFINE_WS_STRTOI_BITS(16)
^~~~~~~~~~~~~~~~~~~~~~~~~
wireshark/wsutil/strtoi.c:83:12: note: expanded from macro 'DEFINE_WS_STRTOI_BITS'
                        if (val < 0) \
                            ~~~ ^
wireshark/wsutil/strtoi.c:115:1: warning: The left operand of '<' is a garbage value
DEFINE_WS_STRTOI_BITS(8)
^~~~~~~~~~~~~~~~~~~~~~~~
wireshark/wsutil/strtoi.c:83:12: note: expanded from macro 'DEFINE_WS_STRTOI_BITS'
                        if (val < 0) \
                            ~~~ ^
3 warnings generated.

Change-Id: I9eef0f2c0d4500531655a8b43509205a1f4e0684
Reviewed-on: https://code.wireshark.org/review/18640
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2016-11-03 08:32:18 +00:00
Michael Mann 26e883a75c Move Base32_encode from packet-fc00.c to wsutil (as ws_base32_decode)
There could be some reuse out of it, so but it with the rest of the
general utilities.

Change-Id: I404c135b933660a82678510b9ca2701985c5632a
Reviewed-on: https://code.wireshark.org/review/18589
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: Anders Broman <a.broman58@gmail.com>
2016-11-02 04:34:44 +00:00
Dario Lombardo 94b4617aca wsutil: add check for input pointers to ws_strtoi functions.
Change-Id: I7353a3b00392aa606fad04ef76e8b18ffbabbf5e
Reviewed-on: https://code.wireshark.org/review/18449
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2016-10-27 12:33:41 +00:00
Dario Lombardo d3b2ee9b0c wsutil: add statements for c++ calls.
Change-Id: I082eb462b0a6ce77f9ca82c51d79d65516c92b53
Reviewed-on: https://code.wireshark.org/review/18401
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-10-22 23:27:26 +00:00
Guy Harris 10ca4c7527 More checks for localtime() and gmtime() returning NULL.
And some comments in the case where we're converting the result of
time() - if your machine's idea of time predates January 1, 1970,
00:00:00 UTC, it'll crash on Windows, but that's not a case where a
*file* can cause the problem due either to a bad file time stamp or bad
time stamps in the file.

Change-Id: I837a438e4b875dd8c4f3ec2137df7a16ee4e9498
Reviewed-on: https://code.wireshark.org/review/18369
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-10-22 02:27:32 +00:00
Gerald Combs 13139a9853 dumpabi: Fix log paths.
Make sure the paths we pass to "cat" and "abi-compliance-checker
-log-path" match.

Change-Id: Ie68b445b9d92d85c0ed1eb508a78c0bcc960d061
Reviewed-on: https://code.wireshark.org/review/18156
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-10-11 21:48:45 +00:00
Alexis La Goutte 5c55c42eaf jsmn(.h): fix warning: '@param' command used in a comment that is not attached to a function declaration [-Wdocumentation]
Change-Id: Ia03fc0d1d0d4af430055f2ae3c66416922b62fd1
Reviewed-on: https://code.wireshark.org/review/18009
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2016-10-06 14:20:16 +00:00
Alexis La Goutte 0a9e74e532 wsjsmn(.h): fix no newline at end of file [-Wnewline-eof]
Change-Id: If99fa78b20cdc9d2180652f7e4331fe2f8aacbff
Reviewed-on: https://code.wireshark.org/review/18008
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2016-10-01 20:18:23 +00:00
Dario Lombardo 11c10244ef wsutil: split libjsmn.
The libjsmn was imported into the tree and enhanced with a new
function. This change splits it into the "original" libjsmn and
an addictional module wsjsmn that contains the new function.
This will make easier to port within the tree future versions
of the library.

Change-Id: I3f1caa91bee462e0767e5e18d0b6a10f0b1cad32
Reviewed-on: https://code.wireshark.org/review/17963
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-09-30 20:12:00 +00:00
Peter Wu 534787e402 cmake: make WERROR_COMMON_FLAGS a normal string
Instead of checking for the boolean "FALSE", just set an empty string.
This avoids the need to check for WERROR_COMMON_FLAGS before using it.

The transformation is the same for all files, remove
"if (WERROR_COMMON_FLAGS)" and "endif()", reindent and add quotes (since
we have a string here and not a list).

Modelines have been added where missing.

Change-Id: I0ab05ae507c51fa77336d49a99a226399cc81b92
Reviewed-on: https://code.wireshark.org/review/17997
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Tested-by: Dario Lombardo <lomato@gmail.com>
2016-09-30 20:08:02 +00:00
Stig Bjørlykke cc50515e57 Show memory info on macOS and Linux
Added support for showing memory information (amount of physical memory)
in version information on macOS and Linux.

Moved CPU info and memory info right after OS version info.

Change-Id: I305d1b7d015d50ed137f2c80b31d698e9315d735
Reviewed-on: https://code.wireshark.org/review/17884
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-09-23 11:59:59 +00:00
Stig Bjørlykke 0703c7b414 dumpcap: Include CPU info as hardware description in SHB
Add CPU info as hardware description in session header block when
using pcapng.

Use capture_comment from the capture_options structure when using
ring buffer.

Change-Id: I5e688fc2d6ab61de1f64ad9a8a96e6e39e8cf708
Reviewed-on: https://code.wireshark.org/review/17862
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-09-23 08:13:43 +00:00
Guy Harris 770a8737d7 Add ws_hexstrtou{bits} and use ws_hexstrtou32 in androiddump.
Make the reply length unsigned - there's no reason for it to be signed.

Change-Id: I5f4d1f027eeddee939547c052220efb89800f4b1
Reviewed-on: https://code.wireshark.org/review/17740
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-16 17:42:03 +00:00
Peter Wu cea1737bd2 Let strtoi with NULL endptr require no invalid characters
If the caller is not interested in checking its end, then it probably
wants a valid number only if the string contains a valid number. Add a
shortcut for this.

Change-Id: I39701bd445e29fb2606720b18ca3764c74a7255b
Reviewed-on: https://code.wireshark.org/review/17658
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2016-09-12 16:00:52 +00:00
Guy Harris e09b03e9b1 Add get_ routines to get a guint32, and use them.
By analogy to get_natural_int() and get_positive_int(), add routines to
get a guint32 and to get a non-zero guint32, doing all the necessary
error checks, and use it.

Change-Id: I65a9ac8a3d136886df3588806ae7af5bdc7b8cb6
Reviewed-on: https://code.wireshark.org/review/17586
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-08 18:27:21 +00:00
Guy Harris c7fc280222 Make the ws_strto* routines more like the strto* routines.
Not all uses of atoi() or various strto* routines in Wireshark expect
the string to contain *only* a number, so not all uses should require
that the byte after the number be a '\0'.  Have the ws_strto* routines
take a "pointer a pointer set to point to the character after the
number" argument, and have the callers do the appropriate checks of the
character after that.

This fixes the VMS trace reading code so that it can read those files
again.

The get_ routines are handed command-line arguments, so they *do* expect
the string to contain only a number; have them check to make sure the
byte after the number is a '\0'.

Change-Id: I46fc1bea7912b9278e385fe38491a0a2ad60d697
Reviewed-on: https://code.wireshark.org/review/17560
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-07 20:41:53 +00:00
Guy Harris 595610f9cc Always set *cint before returning.
Change-Id: I333aef7d3fe4ad3bf7c2a4d7318766fcbd2e4cd2
Reviewed-on: https://code.wireshark.org/review/17539
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-06 18:01:34 +00:00
Guy Harris 295dbc609d Suppress another warning if told not to report failures.
That's another failure that can occur if you're trying to load a
libwireshark plugin in a program that doesn't use libwireshark if, for
example, references to an undefined symbol don't prevent the module from
being loaded in the first place.

Change-Id: I21629c0094fdca7dfbd88f39b7e6c10fb600b401
Reviewed-on: https://code.wireshark.org/review/17537
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-06 17:14:45 +00:00
Alexis La Goutte 36c8065cc3 strtoi(.c): fix extra ';' outside of a function [-Wextra-semi]
Change-Id: I2d92678b2117da732be309c2d430d0c97c7a7eed
Reviewed-on: https://code.wireshark.org/review/17528
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-09-06 12:41:19 +00:00
Guy Harris 5eb9170227 Use ws_strtoi32() in get_natural_int().
Change-Id: I9a95239de8db18cff0f6c62cb526f3ef0cb29f01
Reviewed-on: https://code.wireshark.org/review/17513
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-06 02:24:24 +00:00
Guy Harris 9ef70fce3c Return the maximum or minimum value for ERANGE.
That way, for signed values, the caller knows whether ERANGE means "too
large" or "too small"; this is analogous to what the C routines return.

Change-Id: Ifc1fc4723733be606487093f8aa77ae2d89d2c40
Reviewed-on: https://code.wireshark.org/review/17512
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-06 02:05:41 +00:00
Guy Harris 97103d40e3 Check for signs in unsigned numbers and fail if we see one.
-1 is not an unsigned number.  For that matter, neither is +1;
"unsigned" means "without a sign", and they both have signs.

ANSI C's strto{whatever} routines - even the ones that supposedly are
for "unsigned" values - and the GLib routines modeled after them allow a
leading sign, so we have to check ourselves.

Change-Id: Ia0584bbf83394185cde88eec48efcdfa316f1c92
Reviewed-on: https://code.wireshark.org/review/17511
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-06 01:08:42 +00:00