diff options
author | Guy Harris <gharris@sonic.net> | 2023-09-09 22:14:08 -0700 |
---|---|---|
committer | Guy Harris <gharris@sonic.net> | 2023-09-09 23:47:27 -0700 |
commit | fe835ae95cb147e0d7cab7721c8ce4b3f292eba8 (patch) | |
tree | 6b273b8aac968a81157e89be55049a97b3e34ab6 /ui/capture.c | |
parent | 656f00ef29d01933da673493cf30cb91c2479a9d (diff) |
capture child: send an errno message if exec of dumpcap fails.
On at least some Linux distributions, dumpcap is either installed with
elevated privileges sufficient to support traffic capture by default or
can optionally be given those privileges. If it has those privileges,
it's typically made group-executable but not world-executable and owned
by a special group, e.g. "wireshark", so that only users in that group
can use dumpcap to capture traffic.
The user installing the Wireshark package is *not* necessarily put into
that group by default; this means that any attempt by Wireshark or
TShark to run dumpcap will fail with EACCES.
If the exec call in the child process sends text error mesages, intended
for end users, up the message pipe, as we had been doing, then figuring
out *why* the exec failed would require some heuristic parsing to figure
out whether it's a permissions problem or not.
Instead of doing that, just send a message giving the errno for exec
failing.
For now, we just format an error message for that in the parent process,
but this leaves room to do a better job.
While we're at it, fix some cases where an empty error message could be
printed.
Diffstat (limited to 'ui/capture.c')
-rw-r--r-- | ui/capture.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ui/capture.c b/ui/capture.c index 894a8a1fb3..13bacc5997 100644 --- a/ui/capture.c +++ b/ui/capture.c @@ -620,7 +620,7 @@ capture_input_error(capture_session *cap_session _U_, char *error_msg, ws_assert(cap_session->state == CAPTURE_PREPARING || cap_session->state == CAPTURE_RUNNING); safe_error_msg = simple_dialog_format_message(error_msg); - if (*secondary_error_msg != '\0') { + if (secondary_error_msg != NULL && *secondary_error_msg != '\0') { /* We have both primary and secondary messages. */ safe_secondary_error_msg = simple_dialog_format_message(secondary_error_msg); simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s%s%s\n\n%s", |