aboutsummaryrefslogtreecommitdiffstats
path: root/tfshark.c
diff options
context:
space:
mode:
Diffstat (limited to 'tfshark.c')
-rw-r--r--tfshark.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/tfshark.c b/tfshark.c
index 0bbb77274d..7fef9a6bf3 100644
--- a/tfshark.c
+++ b/tfshark.c
@@ -821,9 +821,13 @@ main(int argc, char *argv[])
#endif /* _WIN32 */
/*
- * Get credential information for later use.
+ * Get credential information for later use, and drop privileges
+ * before doing anything else.
+ * Let the user know if anything happened.
*/
init_process_policies();
+ relinquish_special_privs_perm();
+ print_current_user();
/*
* Attempt to get the pathname of the executable file.
@@ -1427,14 +1431,6 @@ main(int argc, char *argv[])
* We're reading a capture file.
*/
- /*
- * Immediately relinquish any special privileges we have; we must not
- * be allowed to read any capture files the user running TShark
- * can't open.
- */
- relinquish_special_privs_perm();
- print_current_user();
-
/* TODO: if tfshark is ever changed to give the user a choice of which
open_routine reader to use, then the following needs to change. */
if (cf_open(&cfile, cf_name, WTAP_TYPE_AUTO, FALSE, &err) != CF_OK) {