aboutsummaryrefslogtreecommitdiffstats
path: root/extcap/randpktdump.c
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/randpktdump.c
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/randpktdump.c')
-rw-r--r--extcap/randpktdump.c18
1 files changed, 18 insertions, 0 deletions
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);