summaryrefslogtreecommitdiff
path: root/wsutil/plugins.c
AgeCommit message (Collapse)AuthorFilesLines
2017-04-08Clean up handling of enabled/disabled protocols/heuristic dissectors.Guy Harris1-1/+1
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-03-28wsutil: fix a NULL pointer dereference when there is a single plugin registeredPascal Quantin1-16/+6
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-02-26wsutil: fix bugs in plugins_cleanup().Dario Lombardo1-11/+10
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-18plugins: free list on cleanup.Dario Lombardo1-0/+9
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-18wsutil: remove leaks from filesystem and plugins code.Dario Lombardo1-1/+28
Change-Id: Iac2805c0130bd2ba6cdb3c9dd997050274d58d99 Reviewed-on: https://code.wireshark.org/review/20020 Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-12-14Skip loading the Nordic BLE Sniffer dll on WIN32Stig Bjørlykke1-1/+8
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-05Clean up initialization code for programs.Guy Harris1-2/+7
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-09-06Suppress another warning if told not to report failures.Guy Harris1-2/+17
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-05Have scan_plugins() take an argument specify what to do on load failures.Guy Harris1-8/+21
That's a less gross hack to suppress load failures due to not having libwiretap than providing a no-op failure-message routine, as it at least allows other code using a failure-message routine, such as cmdarg_err() and routines that call it, to be used. We really should put libwiretap and libwireshark plugins into separate subdirectories of the plugin directories, and avoid even looking at libwireshark plugins in programs that don't use libwireshark. Change-Id: I0a6ec01ecb4e718ed36233cfaf638a317f839a73 Reviewed-on: https://code.wireshark.org/review/17506 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-07-25Fix checkAPI.pl warnings about printfMichael Mann1-1/+2
Many of the complaints from checkAPI.pl for use of printf are when its embedded in an #ifdef and checkAPI isn't smart enough to figure that out. The other (non-ifdef) use is dumping internal structures (which is a type of debug functionality) Add a "ws_debug_printf" macro for printf to pacify the warnings. Change-Id: I63610e1adbbaf2feffb4ec9d4f817247d833f7fd Reviewed-on: https://code.wireshark.org/review/16623 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-01-31plugins: do not import symbols globallyPeter Wu1-1/+1
Clang's ASAN reported an ODR violation when plugins were loaded. Sure enough, symbols did actually get loaded twice: ==5898==ERROR: AddressSanitizer: odr-violation (0x7fffd95a35e0): [1] size=7 'version' plugins/mate/plugin.c:19:31 [2] size=6 'version' plugins/opcua/plugin.c:19:31 After this change, plugins cannot insert new symbols in the global namespace. Change-Id: Ib11f7263e9c586f8e7c1f8f5fb239b20d46ddd2f Reviewed-on: https://code.wireshark.org/review/13260 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>
2015-12-12Avoid breaking output string mid-sentenceJoão Valverde1-2/+2
Change-Id: I463f93e515ebe12ed30b1f08cca7d29a7bd535ae Reviewed-on: https://code.wireshark.org/review/12552 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>
2015-11-07Clean up includes of unistd.h, fcntl.h, and sys/stat.h.Guy Harris1-4/+0
Have wsutil/file_util.h include them on UN*X, just as it includes io.h on Windows, so we can have a rule of "if you do file operations, include <wsutil/file_util.h> and use the routines in it". Remove includes of unistd.h, fcntl.h, and sys/stat.h that aren't necessary (whether because of the addition of them to wsutil/file_util.h or because they weren't needed in the first place). Change-Id: Ie241dd74deff284e39a5f690a297dbb6e1dc485f Reviewed-on: https://code.wireshark.org/review/11619 Petri-Dish: Guy Harris <guy@alum.mit.edu> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-03-31wsutil: Fix commentRoland Knall1-1/+1
Comment was, although accurate on the subject, not very well formulated Change-Id: I4e6a4bdbc40f75b6bca72de4e71451c441d70d08 Reviewed-on: https://code.wireshark.org/review/7863 Reviewed-by: Roland Knall <rknall@gmail.com> Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-14We use GLib's directory-reading routines, so we don't need <dire[cn]t.h>.Guy Harris1-8/+0
Change-Id: Id86e5d6d0ab24adb1bfff0688f33a40f2fdaed8d Reviewed-on: https://code.wireshark.org/review/7108 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>
2015-01-20CMake: Set an output directory for plugins.Gerald Combs1-5/+5
Redefine PLUGIN_DIR similar to DATAFILE_DIR and use it on all platforms. Add WiresharkPlugin.cmake so that we can start defining common macros for plugins/*/CMakeLists.txt. Load plugins in out-of-tree builds. Change-Id: I8c1359ed3cf8a71788b8320ff89dfe2d3969def2 Reviewed-on: https://code.wireshark.org/review/6640 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-08-21plugins.c: cleanup plugins_scan_dir()Bill Meier1-10/+6
add_plugin() no longer returns ENOMEM. Remove code in plugins_scan_dir() which printed an error message if ENOMEM returned by add_plugin(). Fix comment re add_plugin() return values. Change-Id: Id5170c28e2a55884d41ceebc4e07f16389b75a2a Reviewed-on: https://code.wireshark.org/review/3774 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-03-04Remove all $Id$ from top of fileAlexis La Goutte1-2/+0
(Using sed : sed -i '/^ \* \$Id\$/,+1 d') Fix manually some typo (in export_object_dicom.c and crc16-plain.c) Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8 Reviewed-on: https://code.wireshark.org/review/497 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-02-25Remove trailing whitespaceBill Meier1-2/+2
Change-Id: I8116f63ff88687c8db3fd6e8e23b22ab2f759af0 Reviewed-on: https://code.wireshark.org/review/385 Reviewed-by: Bill Meier <wmeier@newsguy.com> Tested-by: Bill Meier <wmeier@newsguy.com>
2013-12-02Move most of the plugin code from epan to wsutil and remove allGuy Harris1-0/+415
knowledge of particular types of plugins. Instead, let particular types of plugins register with the common plugin code, giving a name and a routine to recognize that type of plugin. In particular applications, only process the relevant plugin types. Add a Makefile.common to the codecs directory. svn path=/trunk/; revision=53710