diff options
author | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2021-03-05 04:09:47 +0000 |
---|---|---|
committer | Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2021-03-06 12:56:11 +0000 |
commit | 41a172cc953382e4c830481dea14d895c622754e (patch) | |
tree | c5356ca4a2d622f621aefd5124e9ad3bd4cd6871 /tshark.c | |
parent | b5530e7021fa68c1d8e7e454b758cfea64acd6ba (diff) |
if_capabilities: Use a structured error msg from dumpcap
Have dumpcap in child mode return an error message with a primary and
secondary string, instead of using stderr. When writing to the console
log we ignore the second message to prevent flooding the log with
tutorial-like info on permissions.
Diffstat (limited to 'tshark.c')
-rw-r--r-- | tshark.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -727,7 +727,7 @@ main(int argc, char *argv[]) int caps_queries = 0; gboolean start_capture = FALSE; GList *if_list; - gchar *err_str; + gchar *err_str, *err_str_secondary; struct bpf_program fcode; #else gboolean capture_option_specified = FALSE; @@ -2200,11 +2200,13 @@ main(int argc, char *argv[]) auth_str = g_strdup_printf("%s:%s", interface_opts->auth_username, interface_opts->auth_password); } #endif - caps = capture_get_if_capabilities(interface_opts->name, interface_opts->monitor_mode, auth_str, &err_str, NULL); + caps = capture_get_if_capabilities(interface_opts->name, interface_opts->monitor_mode, + auth_str, &err_str, &err_str_secondary, NULL); g_free(auth_str); if (caps == NULL) { - cmdarg_err("%s", err_str); + cmdarg_err("%s%s%s", err_str, err_str_secondary ? "\n" : "", err_str_secondary ? err_str_secondary : ""); g_free(err_str); + g_free(err_str_secondary); exit_status = INVALID_CAPABILITY; goto clean_exit; } |