aboutsummaryrefslogtreecommitdiffstats
path: root/extcap
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2019-04-07 19:56:22 -0700
committerGuy Harris <guy@alum.mit.edu>2019-04-08 02:57:53 +0000
commitbbc8cbfb9c0f4b43834af43e518de085cc39fd6b (patch)
tree34dce617ae902a9569862f3fee19cf21f8d7bd89 /extcap
parent9f575c8dc9a04c1eb4634cf525815ff226a5e1bf (diff)
If you use data_file_url(), you must first call init_progfile_dir().
And if you call init_progfile_dir(), you must call init_process_policies() before that. And even if you *don't* use data_file_url(), you might use it in the future, or you might use other calls to get data file paths, so make *all* the extcap programs make those calls. (Yes, this is important on macOS, for example; it may also be important on Windows. On other UN*Xes we may just compile in the data file path, but that's not true on *all* our platforms.) Change-Id: I99265ed69ec24096884ec067feddd7d7f3855436 Reviewed-on: https://code.wireshark.org/review/32775 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'extcap')
-rw-r--r--extcap/androiddump.c18
-rw-r--r--extcap/ciscodump.c18
-rw-r--r--extcap/dpauxmon.c18
-rw-r--r--extcap/randpktdump.c18
-rw-r--r--extcap/sdjournal.c18
-rw-r--r--extcap/sshdump.c18
-rw-r--r--extcap/udpdump.c18
7 files changed, 126 insertions, 0 deletions
diff --git a/extcap/androiddump.c b/extcap/androiddump.c
index 62b37b1d37..676a02fde9 100644
--- a/extcap/androiddump.c
+++ b/extcap/androiddump.c
@@ -20,6 +20,7 @@
#include <time.h>
#include <wsutil/strtoi.h>
#include <wsutil/filesystem.h>
+#include <wsutil/privileges.h>
#include <ui/cmdarg_err.h>
#include <wsutil/inet_addr.h>
@@ -2481,6 +2482,7 @@ static int capture_android_tcpdump(char *interface, char *fifo,
}
int main(int argc, char *argv[]) {
+ char *init_progfile_dir_error;
int ret = EXIT_CODE_GENERIC;
int option_idx = 0;
int result;
@@ -2511,6 +2513,22 @@ int main(int argc, char *argv[]) {
cmdarg_err_init(failure_warning_message, failure_warning_message);
+ /*
+ * Get credential information for later use.
+ */
+ init_process_policies();
+
+ /*
+ * Attempt to get the pathname of the directory containing the
+ * executable file.
+ */
+ init_progfile_dir_error = init_progfile_dir(argv[0]);
+ if (init_progfile_dir_error != NULL) {
+ g_warning("Can't get pathname of directory containing the captype program: %s.",
+ init_progfile_dir_error);
+ g_free(init_progfile_dir_error);
+ }
+
extcap_conf = g_new0(extcap_parameters, 1);
help_url = data_file_url("androiddump.html");
diff --git a/extcap/ciscodump.c b/extcap/ciscodump.c
index e6028ac697..9a75d82813 100644
--- a/extcap/ciscodump.c
+++ b/extcap/ciscodump.c
@@ -16,6 +16,7 @@
#include <wsutil/interface.h>
#include <wsutil/strtoi.h>
#include <wsutil/filesystem.h>
+#include <wsutil/privileges.h>
#include <extcap/ssh-base.h>
#include <writecap/pcapio.h>
@@ -517,6 +518,7 @@ static int list_config(char *interface, unsigned int remote_port)
int main(int argc, char *argv[])
{
+ char* init_progfile_dir_error;
int result;
int option_idx = 0;
ssh_params_t* ssh_params = ssh_params_new();
@@ -532,6 +534,22 @@ int main(int argc, char *argv[])
WSADATA wsaData;
#endif /* _WIN32 */
+ /*
+ * Get credential information for later use.
+ */
+ init_process_policies();
+
+ /*
+ * Attempt to get the pathname of the directory containing the
+ * executable file.
+ */
+ init_progfile_dir_error = init_progfile_dir(argv[0]);
+ if (init_progfile_dir_error != NULL) {
+ g_warning("Can't get pathname of directory containing the captype program: %s.",
+ init_progfile_dir_error);
+ g_free(init_progfile_dir_error);
+ }
+
help_url = data_file_url("ciscodump.html");
extcap_base_set_util_info(extcap_conf, argv[0], CISCODUMP_VERSION_MAJOR, CISCODUMP_VERSION_MINOR,
CISCODUMP_VERSION_RELEASE, help_url);
diff --git a/extcap/dpauxmon.c b/extcap/dpauxmon.c
index f16ec80d12..2058f96477 100644
--- a/extcap/dpauxmon.c
+++ b/extcap/dpauxmon.c
@@ -17,6 +17,7 @@
#include <wsutil/strtoi.h>
#include <wsutil/filesystem.h>
#include <wsutil/netlink.h>
+#include <wsutil/privileges.h>
#include <writecap/pcapio.h>
#include <netlink/netlink.h>
@@ -478,6 +479,7 @@ close_out:
int main(int argc, char *argv[])
{
+ char* init_progfile_dir_error;
int option_idx = 0;
int result;
unsigned int interface_id = 0;
@@ -485,6 +487,22 @@ int main(int argc, char *argv[])
extcap_parameters* extcap_conf = g_new0(extcap_parameters, 1);
char* help_header = NULL;
+ /*
+ * Get credential information for later use.
+ */
+ init_process_policies();
+
+ /*
+ * Attempt to get the pathname of the directory containing the
+ * executable file.
+ */
+ init_progfile_dir_error = init_progfile_dir(argv[0]);
+ if (init_progfile_dir_error != NULL) {
+ g_warning("Can't get pathname of directory containing the captype program: %s.",
+ init_progfile_dir_error);
+ g_free(init_progfile_dir_error);
+ }
+
extcap_base_set_util_info(extcap_conf, argv[0], DPAUXMON_VERSION_MAJOR, DPAUXMON_VERSION_MINOR, DPAUXMON_VERSION_RELEASE,
NULL);
extcap_base_register_interface(extcap_conf, DPAUXMON_EXTCAP_INTERFACE, "DisplayPort AUX channel monitor capture", 275, "DisplayPort AUX channel monitor");
diff --git a/extcap/randpktdump.c b/extcap/randpktdump.c
index c31e01ed79..28de98f64f 100644
--- a/extcap/randpktdump.c
+++ b/extcap/randpktdump.c
@@ -17,6 +17,7 @@
#include "randpkt_core/randpkt_core.h"
#include <wsutil/strtoi.h>
#include <wsutil/filesystem.h>
+#include <wsutil/privileges.h>
#include <cli_main.h>
@@ -123,6 +124,7 @@ static int list_config(char *interface)
int main(int argc, char *argv[])
{
+ char* init_progfile_dir_error;
int option_idx = 0;
int result;
guint16 maxbytes = 5000;
@@ -144,6 +146,22 @@ int main(int argc, char *argv[])
char* help_url;
char* help_header = NULL;
+ /*
+ * Get credential information for later use.
+ */
+ init_process_policies();
+
+ /*
+ * Attempt to get the pathname of the directory containing the
+ * executable file.
+ */
+ init_progfile_dir_error = init_progfile_dir(argv[0]);
+ if (init_progfile_dir_error != NULL) {
+ g_warning("Can't get pathname of directory containing the captype program: %s.",
+ init_progfile_dir_error);
+ g_free(init_progfile_dir_error);
+ }
+
help_url = data_file_url("randpktdump.html");
extcap_base_set_util_info(extcap_conf, argv[0], RANDPKTDUMP_VERSION_MAJOR, RANDPKTDUMP_VERSION_MINOR,
RANDPKTDUMP_VERSION_RELEASE, help_url);
diff --git a/extcap/sdjournal.c b/extcap/sdjournal.c
index cca467c7f4..b2a2d5d9e5 100644
--- a/extcap/sdjournal.c
+++ b/extcap/sdjournal.c
@@ -23,6 +23,7 @@
#include <wsutil/interface.h>
#include <wsutil/file_util.h>
#include <wsutil/filesystem.h>
+#include <wsutil/privileges.h>
#include <writecap/pcapio.h>
#include <wiretap/wtap.h>
@@ -328,6 +329,7 @@ static int list_config(char *interface)
int main(int argc, char **argv)
{
+ char* init_progfile_dir_error;
int result;
int option_idx = 0;
int start_from_entries = 10;
@@ -337,6 +339,22 @@ int main(int argc, char **argv)
char* help_url;
char* help_header = NULL;
+ /*
+ * Get credential information for later use.
+ */
+ init_process_policies();
+
+ /*
+ * Attempt to get the pathname of the directory containing the
+ * executable file.
+ */
+ init_progfile_dir_error = init_progfile_dir(argv[0]);
+ if (init_progfile_dir_error != NULL) {
+ g_warning("Can't get pathname of directory containing the captype program: %s.",
+ init_progfile_dir_error);
+ g_free(init_progfile_dir_error);
+ }
+
help_url = data_file_url("sdjournal.html");
extcap_base_set_util_info(extcap_conf, argv[0], SDJOURNAL_VERSION_MAJOR, SDJOURNAL_VERSION_MINOR,
SDJOURNAL_VERSION_RELEASE, help_url);
diff --git a/extcap/sshdump.c b/extcap/sshdump.c
index 14238659a0..768645e735 100644
--- a/extcap/sshdump.c
+++ b/extcap/sshdump.c
@@ -18,6 +18,7 @@
#include <wsutil/file_util.h>
#include <wsutil/strtoi.h>
#include <wsutil/filesystem.h>
+#include <wsutil/privileges.h>
#include <errno.h>
#include <string.h>
@@ -336,6 +337,7 @@ static char* concat_filters(const char* extcap_filter, const char* remote_filter
int main(int argc, char *argv[])
{
+ char* init_progfile_dir_error;
int result;
int option_idx = 0;
ssh_params_t* ssh_params = ssh_params_new();
@@ -354,6 +356,22 @@ int main(int argc, char *argv[])
WSADATA wsaData;
#endif /* _WIN32 */
+ /*
+ * Get credential information for later use.
+ */
+ init_process_policies();
+
+ /*
+ * Attempt to get the pathname of the directory containing the
+ * executable file.
+ */
+ init_progfile_dir_error = init_progfile_dir(argv[0]);
+ if (init_progfile_dir_error != NULL) {
+ g_warning("Can't get pathname of directory containing the captype program: %s.",
+ init_progfile_dir_error);
+ g_free(init_progfile_dir_error);
+ }
+
help_url = data_file_url("sshdump.html");
extcap_base_set_util_info(extcap_conf, argv[0], SSHDUMP_VERSION_MAJOR, SSHDUMP_VERSION_MINOR,
SSHDUMP_VERSION_RELEASE, help_url);
diff --git a/extcap/udpdump.c b/extcap/udpdump.c
index c1636b7c94..4539918fdd 100644
--- a/extcap/udpdump.c
+++ b/extcap/udpdump.c
@@ -47,6 +47,7 @@
#include <wsutil/strtoi.h>
#include <wsutil/inet_addr.h>
#include <wsutil/filesystem.h>
+#include <wsutil/privileges.h>
#include <cli_main.h>
@@ -358,6 +359,7 @@ static void run_listener(const char* fifo, const guint16 port, const char* proto
int main(int argc, char *argv[])
{
+ char* init_progfile_dir_error;
int option_idx = 0;
int result;
guint16 port = 0;
@@ -371,6 +373,22 @@ int main(int argc, char *argv[])
WSADATA wsaData;
#endif /* _WIN32 */
+ /*
+ * Get credential information for later use.
+ */
+ init_process_policies();
+
+ /*
+ * Attempt to get the pathname of the directory containing the
+ * executable file.
+ */
+ init_progfile_dir_error = init_progfile_dir(argv[0]);
+ if (init_progfile_dir_error != NULL) {
+ g_warning("Can't get pathname of directory containing the captype program: %s.",
+ init_progfile_dir_error);
+ g_free(init_progfile_dir_error);
+ }
+
help_url = data_file_url("udpdump.html");
extcap_base_set_util_info(extcap_conf, argv[0], UDPDUMP_VERSION_MAJOR, UDPDUMP_VERSION_MINOR, UDPDUMP_VERSION_RELEASE,
help_url);