From ff1e16055fb21ddbf1cb06f193b0cd5622b5edef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= Date: Sat, 8 Sep 2018 16:02:06 +0100 Subject: [PATCH] epan: Add argument to epan_init() to disable plugins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I8dc76e6bf8c4d5a3081cbdc1d47b88e857415d29 Reviewed-on: https://code.wireshark.org/review/29498 Petri-Dish: João Valverde Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde --- debian/libwireshark0.symbols | 2 +- dftest.c | 2 +- epan/epan.c | 6 ++++-- epan/epan.h | 2 +- rawshark.c | 2 +- sharkd.c | 2 +- tfshark.c | 2 +- tools/oss-fuzzshark/fuzzshark.c | 2 +- tshark.c | 2 +- ui/qt/main.cpp | 2 +- 10 files changed, 13 insertions(+), 11 deletions(-) diff --git a/debian/libwireshark0.symbols b/debian/libwireshark0.symbols index 3fdfd83570..97719e729d 100644 --- a/debian/libwireshark0.symbols +++ b/debian/libwireshark0.symbols @@ -545,7 +545,7 @@ libwireshark.so.0 libwireshark0 #MINVER# epan_get_user_comment@Base 1.99.2 epan_get_version@Base 1.9.1 epan_get_version_number@Base 2.5.0 - epan_init@Base 1.9.1 + epan_init@Base 2.9.0 epan_load_settings@Base 2.3.0 epan_memmem@Base 1.9.1 epan_new@Base 1.12.0~rc1 diff --git a/dftest.c b/dftest.c index 8ee0e09e51..d2c6857808 100644 --- a/dftest.c +++ b/dftest.c @@ -77,7 +77,7 @@ main(int argc, char **argv) "-g" flag, as the "-g" flag dumps a list of fields registered by the dissectors, and we must do it before we read the preferences, in case any dissectors register preferences. */ - if (!epan_init(NULL, NULL)) + if (!epan_init(NULL, NULL, FALSE)) return 2; /* set the c-language locale to the native environment. */ diff --git a/epan/epan.c b/epan/epan.c index ed6373e6e0..f590a0529c 100644 --- a/epan/epan.c +++ b/epan/epan.c @@ -176,7 +176,7 @@ void epan_register_plugin(const epan_plugin *plug) #endif gboolean -epan_init(register_cb cb, gpointer client_data) +epan_init(register_cb cb, gpointer client_data, gboolean load_plugins) { volatile gboolean status = TRUE; @@ -198,9 +198,11 @@ epan_init(register_cb cb, gpointer client_data) except_init(); + if (load_plugins) { #ifdef HAVE_PLUGINS - libwireshark_plugins = plugins_init(WS_PLUGIN_EPAN); + libwireshark_plugins = plugins_init(WS_PLUGIN_EPAN); #endif + } /* initialize libgcrypt (beware, it won't be thread-safe) */ gcry_check_version(NULL); diff --git a/epan/epan.h b/epan/epan.h index e29fb83903..80d9b6f4e4 100644 --- a/epan/epan.h +++ b/epan/epan.h @@ -100,7 +100,7 @@ Ref2 for further edits - delete when done * Returns TRUE on success, FALSE on failure. */ WS_DLL_PUBLIC -gboolean epan_init(register_cb cb, void *client_data); +gboolean epan_init(register_cb cb, void *client_data, gboolean load_plugins); /** * Load all settings, from the current profile, that affect epan. diff --git a/rawshark.c b/rawshark.c index 09bd6bc58d..ebc95cb105 100644 --- a/rawshark.c +++ b/rawshark.c @@ -519,7 +519,7 @@ main(int argc, char *argv[]) "-G" flag, as the "-G" flag dumps information registered by the dissectors, and we must do it before we read the preferences, in case any dissectors register preferences. */ - if (!epan_init(NULL, NULL)) { + if (!epan_init(NULL, NULL, TRUE)) { ret = INIT_ERROR; goto clean_exit; } diff --git a/sharkd.c b/sharkd.c index 66fd41b8f1..569bfc7681 100644 --- a/sharkd.c +++ b/sharkd.c @@ -167,7 +167,7 @@ main(int argc, char *argv[]) "-G" flag, as the "-G" flag dumps information registered by the dissectors, and we must do it before we read the preferences, in case any dissectors register preferences. */ - if (!epan_init(NULL, NULL)) { + if (!epan_init(NULL, NULL, TRUE)) { ret = EPAN_INIT_FAIL; goto clean_exit; } diff --git a/tfshark.c b/tfshark.c index fd59dc25be..552588e92d 100644 --- a/tfshark.c +++ b/tfshark.c @@ -490,7 +490,7 @@ main(int argc, char *argv[]) "-G" flag, as the "-G" flag dumps information registered by the dissectors, and we must do it before we read the preferences, in case any dissectors register preferences. */ - if (!epan_init(NULL, NULL)) { + if (!epan_init(NULL, NULL, TRUE)) { exit_status = INIT_ERROR; goto clean_exit; } diff --git a/tools/oss-fuzzshark/fuzzshark.c b/tools/oss-fuzzshark/fuzzshark.c index 281dfcac39..e31d8219a5 100644 --- a/tools/oss-fuzzshark/fuzzshark.c +++ b/tools/oss-fuzzshark/fuzzshark.c @@ -269,7 +269,7 @@ fuzz_init(int argc _U_, char **argv) "-G" flag, as the "-G" flag dumps information registered by the dissectors, and we must do it before we read the preferences, in case any dissectors register preferences. */ - if (!epan_init(NULL, NULL)) + if (!epan_init(NULL, NULL, FALSE)) { ret = EPAN_INIT_FAIL; goto clean_exit; diff --git a/tshark.c b/tshark.c index 9314ac1a7b..a0fcb43ba4 100644 --- a/tshark.c +++ b/tshark.c @@ -923,7 +923,7 @@ main(int argc, char *argv[]) "-G" flag, as the "-G" flag dumps information registered by the dissectors, and we must do it before we read the preferences, in case any dissectors register preferences. */ - if (!epan_init(NULL, NULL)) { + if (!epan_init(NULL, NULL, TRUE)) { exit_status = INIT_FAILED; goto clean_exit; } diff --git a/ui/qt/main.cpp b/ui/qt/main.cpp index 9a6094d311..3582f1fa14 100644 --- a/ui/qt/main.cpp +++ b/ui/qt/main.cpp @@ -618,7 +618,7 @@ int main(int argc, char *qt_argv[]) "-G" flag, as the "-G" flag dumps information registered by the dissectors, and we must do it before we read the preferences, in case any dissectors register preferences. */ - if (!epan_init(splash_update, NULL)) { + if (!epan_init(splash_update, NULL, TRUE)) { SimpleDialog::displayQueuedMessages(main_w); ret_val = INIT_FAILED; goto clean_exit;