From 9837703a118dc45dbcb47485bf4d11556b3a8df4 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sat, 24 Oct 2020 07:44:36 +0000 Subject: [PATCH] dumpcap: fix the macOS "no permission to capture" message. The macOS installer works differently from the way it did when that message was written (it's now a drag-install for Wireshark, with separate installers for ChmodBPF and for files to add the Wireshark binary directory to the default $PATH), and the macOS main screen now offers a "click this to install" link, running the ChmodBPF installer, if the user doesn't have permissions to capture. Update the message to reflect that (although that's wrong if you directly run dumpcap or run it via TShark - this needs to be cleaned up in some fashion). Fix a capitalization error while we're at it. In the code that generates the main screen message to which the dumpcap message refers, add a comment saying that, if the main screen message changes, dumpcap's message should also be updated. (cherry picked from commit 4fd7983b04695bfc1ccf83b49559074bfd3a80d1) --- dumpcap.c | 7 ++++--- ui/qt/interface_frame.cpp | 11 +++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/dumpcap.c b/dumpcap.c index c843ddb631..b7675fd78b 100644 --- a/dumpcap.c +++ b/dumpcap.c @@ -547,9 +547,10 @@ relinquish_all_capabilities(void) #elif defined(__APPLE__) #define PLATFORM_PERMISSIONS_SUGGESTION \ "\n\n" \ - "If you installed Wireshark using the package from wireshark.org, "\ - "Try re-installing it and checking the box for the \"Set capture " \ - "permissions on startup\" item." + "If you installed Wireshark using the package from wireshark.org, " \ + "close this dialog and click on the \"installing ChmodBPF\" link in " \ + "\"You can fix this by installing ChmodBPF.\" on the main screen, " \ + "and then complete the installation procedure." #else #define PLATFORM_PERMISSIONS_SUGGESTION #endif diff --git a/ui/qt/interface_frame.cpp b/ui/qt/interface_frame.cpp index e06fdf6ab7..ca3a407cef 100644 --- a/ui/qt/interface_frame.cpp +++ b/ui/qt/interface_frame.cpp @@ -303,6 +303,12 @@ void InterfaceFrame::resetInterfaceTreeDisplay() if (!haveLocalCapturePermissions()) { #ifdef Q_OS_MAC + // + // NOTE: if you change this text, you must also change the + // definition of PLATFORM_PERMISSIONS_SUGGESTION that is + // used if __APPLE__ is defined, so that it reflects the + // new message text. + // QString install_chmodbpf_path = wsApp->applicationDirPath() + "/../Resources/Extras/Install ChmodBPF.pkg"; ui->warningLabel->setText(tr( "

" @@ -312,6 +318,11 @@ void InterfaceFrame::resetInterfaceTreeDisplay() "

") .arg(install_chmodbpf_path)); #else + // + // XXX - should this give similar platform-dependent recommendations, + // just as dumpcap gives platform-dependent recommendations in its + // PLATFORM_PERMISSIONS_SUGGESTION #define? + // ui->warningLabel->setText(tr("You don't have permission to capture on local interfaces.")); #endif }