Commit Graph

46 Commits

Author SHA1 Message Date
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
Gerald Combs d84577fe1a Yell at the user less.
Our user-facing messages should have a helpful (or at the very least
neutral) tone. In English, exclamation points are neither. Replace a
bunch of them with periods.

Change-Id: I29c3b2f84c25e06aae5b559860224559053a0378
Reviewed-on: https://code.wireshark.org/review/20189
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-02-20 16:53:17 +00:00
Michał Skalski 16b7128d1a UAT gtk-ui, Qt-ui: Fixed copying records when no cp callback is defined
According to documentation of uat_copy_cb_t, if uat->copy_cb is NULL,
memcpy() should be used.

This affected IKEv1 and IKEv2 UAT tables (possibly others).


Change-Id: I27ebdc08385d260945699f101e714d3abb288b22
Reviewed-on: https://code.wireshark.org/review/17245
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>
2016-08-28 16:08:05 +00:00
João Valverde 146c4b7016 uat: Fix warnings [-Wcast-qual]
uat_fld_tostr_cb_t callback *out_ptr argument is g_mallocated and
is to be freed by the caller so drop constness requirement to fix
the corresponding g_free warnings.

Change-Id: I1be25fa3e2f54fb32058ac0b5c1631b193b07701
Reviewed-on: https://code.wireshark.org/review/12943
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-31 22:56:34 +00:00
Balint Reczey 9a9b1c9bba Spelling fixes for errors found by lintian
Change-Id: I889283902875193f4d3f3fd59788f59f8d9bcc20
Reviewed-on: https://code.wireshark.org/review/11945
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-12-07 07:11:54 +00:00
Guy Harris 859511db14 Make UAT record update callbacks return a success/failure indication.
Have them return TRUE on success and FALSE on failure.  Check the return
value rather than whether the error string pointer is null or not.

Change-Id: I800a03bcd70a6bbb7b217cf7c4800e9cdcf2189c
Reviewed-on: https://code.wireshark.org/review/7222
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-18 00:41:09 +00:00
Peter Wu 4f3646fe62 Fix handling of invalid UAT items
If the UAT file failed a field check, then the user_data pointer may be
empty. As a result uat_save() triggers an invalid write.

(Discovered while working with a dfilter_macros file having duplicate
names for bug 10957, caught by ASAN.)

The second issue fixed in this patch is that the validity of an item is
only calculated when a new record is added. So even if the user edits
the UAT and makes the entry valid, it would not be saved. This is solved
by adding a new uat_update_record() function which got wires up into GTK
and Qt.

Some open-coded g_array_index and UAT[_USER]_INDEX_PTR are also
converted.

Even after this patch, Qt has some issues with UAT handling. In
particular, it saves new, but empty/invalid, items. It also it does not
check individual fields when saving all fields (unlike Gtk). This patch
focused on getting Gtk fixed first so ignores those existing issues.

Change-Id: Ia35cfe9d2b793c65144ae7e29a1ed706b6668d99
Reviewed-on: https://code.wireshark.org/review/7120
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-15 23:52:24 +00:00
Bill Meier bfde04b845 ui/gtk/*.c: Add editor modelines; As needed: Fix indentation
Change-Id: I8cd9d9fe5f12c284f46b8f725766f681faccd753
Reviewed-on: https://code.wireshark.org/review/7138
Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-02-15 19:02:30 +00:00
Guy Harris e601e01ffd Remove some apparently-unnecessary includes of emem.h.
Also update a comment to no longer speak of ep_ allocation, and add an
include of <glib.h> to ui/profile.c, which was formerly relying on the
include of emem.h to drag it in.

Change-Id: I08926699ee96cf66672836b6ee3bbb405b507ce8
Reviewed-on: https://code.wireshark.org/review/6633
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-18 19:47:20 +00:00
Guy Harris 9f5e4fb7a5 uat_load() and uat_save() return a success indication; use it.
Instead of always ignoring the return value, always check it, and only
report an error if it returns FALSE.

(Alternative: have it return NULL on success and a pointer to a
g_malloc()ed string on failure.)

Fix a comment while we're at it.

Change-Id: Icb72c9f47775b6552e3eb4fe5ddcc85482bfb5fb
Reviewed-on: https://code.wireshark.org/review/6528
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-13 21:01:28 +00:00
Guy Harris bc23f79729 UAT error string pointers should not be const pointers.
UAT error strings are usually allocated by g_strdup() or
g_strdup_printf(), and must ultimately be freed by the caller.

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

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

Add a missing free of an error string.

Remove some no-longer-necessary casts.

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

Change some variable declarations to match.

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

Change-Id: I40297746a2ef729c56763baeddbb0842386fa0d0
Reviewed-on: https://code.wireshark.org/review/6525
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-13 20:20:03 +00:00
Michael Mann 7967ef9510 Remove emem APIs from UAT functionality.
Change-Id: I009c09f25d170e5c9aaaef713eaacb3252817856
Reviewed-on: https://code.wireshark.org/review/6460
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-12 14:25:12 +00:00
Martin Mathieson 43f09e67b4 Remove unneeded includes from ui folder
Change-Id: Ifd1eebff9080cd3867e44e4dcb2d2681370ed60a
Reviewed-on: https://code.wireshark.org/review/6128
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2015-01-01 23:11:10 +00:00
Stig Bjørlykke ea167053ff Improved deregistering fields.
This improvement avoids use of deallocated memory (crash) if using a
deregistered field in display filter, color filter, custom column and
other cases when the field is used as "interesting field".

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

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

Change-Id: I043e3bf7a98bd773c9801e712a012d1eab8a7f94
Reviewed-on: https://code.wireshark.org/review/5161
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-11-10 08:01:12 +00:00
Gerald Combs 5e3a8fa852 Work around an apparent bug in GtkFileChooserButton.
It looks like some versions of GTK+ intialize GtkFileChooserButton with a
location set to NULL and crash when you select an item from the dropdown
menu. Make sure we have a valid location set in that case.

Change-Id: If2556ef939b95d8af12581a7116a48fb46586f57
Bug: 10434
Reviewed-on: https://code.wireshark.org/review/3977
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-09-03 21:57:57 +00:00
Guy Harris 1c297771c3 Rename and move ui/stat_menu.h to epan/stat_groups.h.
The groups are, technically, independent of the notion of a menu, and,
if we have mechanisms by which taps that are not only GUI
toolkit-independent but independent of the *existence* of a GUI can be
registered, they might want to register themselves in a group just in
case they're running in a program that has a GUI.

Also, this might fix the Debian package build.

Change-Id: I29435681e79748fd4f2e0c5ac872cd11f831d172
Reviewed-on: https://code.wireshark.org/review/2830
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-03 20:30:42 +00:00
Guy Harris 5e28386540 Move stat_menu.h to libui.
Change-Id: I7bed7f7931845bc41035535cc62e1fe17c71047d
Reviewed-on: https://code.wireshark.org/review/2726
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-30 21:37:34 +00:00
Alexis La Goutte 3170f2e418 Continue to remove $Id$ from top of file
(Using sed : sed -i '/^ \*  \$Id\$/,+1 d') (Double space between star and $Id$)

Change-Id: If9b8f345e3b6493de0b573600e60005c8b0b33c3
Reviewed-on: https://code.wireshark.org/review/877
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-03-31 15:59:51 +00:00
Balint Reczey 00be1d31ce Migrate GTK icon handling to GTK 3.10 API
GtkStockItem usage is deprecated with all the GTK_STOCK_.* stock ids.
We keep a stock id based approach but without relying on GTK's
GtkStockItem system.

We create our own internal stock ids for {icon, label} tuples and keep
the original GTK stock id #define-s and values to preserve backward
compatibility.

Change-Id: Ia0b35a5903f079e92c8026e3df21bbf0be2d06b0
Reviewed-on: https://code.wireshark.org/review/302
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-11 05:38:01 +00:00
Jakub Zawadzki e0e86bab5a Fix const warnings.
svn path=/trunk/; revision=54092
2013-12-14 14:33:46 +00:00
Irene Rüngeler 85d84776b8 Use PT_TXTMOD_NONE for columns that should not be editable.
svn path=/trunk/; revision=53906
2013-12-10 15:33:07 +00:00
Guy Harris db25270df8 Move the epan/filesystem.c routines to wsutil; they're not specific to
packet dissection, they're specific to the entire Wireshark suite of
programs.

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

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

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

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

svn path=/trunk/; revision=52854
2013-10-25 22:14:25 +00:00
Michael Mann 1554929862 Only allow one popup dialog in UAT dialog. Editing/copying/deleting can modify the uat list and other open dialogs will not be aware of it and lead to unexpected behavior (including crashes). Fixes bug 9129 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9129)
#BACKPORT(1.10)

svn path=/trunk/; revision=52683
2013-10-19 02:45:01 +00:00
Martin Kaiser 67bae105de in a uat dialogue, allow only one popup for confirming a deletion of an
element

this should at least partially fix bug 9129

svn path=/trunk/; revision=52357
2013-10-04 12:52:36 +00:00
Jeff Morriss 54bb2e7a5c Move report_err.{h,c} from epan into wsutil: there's nothing epan-specific there and moving it avoids having to recompile the file for use in editcap and capinfos (which don't link against libwireshark).
svn path=/trunk/; revision=50598
2013-07-15 02:48:26 +00:00
Michael Mann 4a1bd75b60 Add a "hidden" array of UAT entry data to allow separation between UAT file syntax errors and "syntactically correct, but invalid field". Now UAT files load all entries into the "hidden" array (raw_data), but only adds valid ones to the user_data, which is used by the dissectors.
This is a start to fixing bug 7471 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7471) and is being committed to get the new ABI/API in before the 1.10 release.
What remains is the "GUI portion" (GTK+qt) to indicate to users which UAT entries are invalid.

svn path=/trunk/; revision=48960
2013-04-22 02:10:49 +00:00
Alexis La Goutte 101489f386 Use also const char to uat_save (identical to uat_load)
svn path=/trunk/; revision=48902
2013-04-17 19:39:11 +00:00
Evan Huus c4a36c513f Redissect extra packet windows in all cases (that I know of) where we
redissect normal packet list.

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

svn path=/trunk/; revision=48528
2013-03-24 16:47:38 +00:00
Bill Meier 8112ecc321 From beroset:
remove C++ incompatibilities
 https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 attachment #10404

Note: The following parts of the patch had been previously done:
 asn1/snmp/packet-snmp-template.c
 epan/dissectors/packet-snmp.c
 epan/dissectors/packet-x11.c

Also; hostlist_table.c: code under '#ifdef HAVE_GEOIP'
 didn't compile and needed a few additional patches.


svn path=/trunk/; revision=48447
2013-03-21 02:29:09 +00:00
Guy Harris 922a57753b Constify the second argument to uat_load(), to squelch some warnings.
svn path=/trunk/; revision=47560
2013-02-08 09:06:08 +00:00
Bill Meier 4670080829 Use ws_gtk_grid...() in place of gtk_table...();
Also: minor cleanup:
- use gtk_window_set_default_size() iso gtk_window_resize();
- change grid row numbers to start at 0 (not 1);
- fix some formatting/whitespace.

svn path=/trunk/; revision=47260
2013-01-24 18:28:31 +00:00
Michael Mann 86d690880f replace "unsigned" datatype with "guint". Some mpeg files needed "unsigned int" instead.
bugs 7825-7827 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7825)

svn path=/trunk/; revision=46928
2013-01-04 05:22:43 +00:00
Anders Broman 45e9735b09 Enhance error output.
svn path=/trunk/; revision=46076
2012-11-18 18:10:48 +00:00
Jeff Morriss 3729335973 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45016
2012-09-20 01:48:30 +00:00
Gerald Combs 8967d312ad Move the UI-independent help URL code to ui/help_url.[ch].
svn path=/trunk/; revision=44987
2012-09-18 21:51:22 +00:00
Jörg Mayer 12a0aa4849 - Replace packet_list_recreate_visible_rows -> packet_list_recreate_visible_rows_list
- Replace new_packet_list_ -> packet_list_


svn path=/trunk/; revision=44765
2012-09-04 02:35:25 +00:00
Jörg Mayer 380fe63a6d Rename new_packet_list.[ch] to packet_list.[ch]
svn path=/trunk/; revision=44764
2012-09-04 01:57:36 +00:00
Jakub Zawadzki d1500622fc Fix bug #7377 for:
- UAT
 - Packet in new window
 - Supported protocols dialog.

svn path=/trunk/; revision=43861
2012-07-20 15:21:40 +00:00
Guy Harris 659cf0527a UATs could be put into "categories". The categories were defined only
implicitly by the #define name and string they were defined to; not all
UATs neatly fit into any of the categories, so some of them were put
into categories that weren't obviously correct for them, and one - the
display filter macro UAT - wasn't put into any category at all (which
caused crashes when editing them, as the GUI code that handled UAT
changes from a dialog assumed the category field was non-null).

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

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

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

svn path=/trunk/; revision=43603
2012-07-08 01:00:46 +00:00
Guy Harris 1b1fbd24e7 From Evan Huus:
There is no guarantee that uat->category is non-null, so check whether
it's null before checking whether it's UAT_CAT_FIELDS or not.

Fixes bug 7444.

#BACKPORT

svn path=/trunk/; revision=43602
2012-07-07 22:40:02 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Anders Broman 8bab40a99e More GTK3 adaptations
svn path=/trunk/; revision=42187
2012-04-21 21:13:13 +00:00
Anders Broman 03e3fdd79c Replace gtk_vbox_new() and gtk_hbox_new() with ws_gtk_box_new().
svn path=/trunk/; revision=42176
2012-04-21 16:40:14 +00:00
Stig Bjørlykke 019008548b Recreate the packet list when changing UAT for header fields.
This fixes a crash when changing settings for fields used as a custom column.

svn path=/trunk/; revision=41840
2012-03-30 08:57:57 +00:00
Jörg Mayer be706c6380 Move gtk to ui/gtk.
This looses the last checkin to gtk, will add this manually back.

svn path=/trunk/; revision=40518
2012-01-15 21:59:11 +00:00