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.
This commit is contained in:
Guy Harris 2020-10-24 00:44:36 -07:00
parent 08f521fb63
commit 4fd7983b04
2 changed files with 15 additions and 3 deletions

View File

@ -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

View File

@ -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(
"<p>"
@ -312,6 +318,11 @@ void InterfaceFrame::resetInterfaceTreeDisplay()
"</p>")
.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
}