Report the actual *error* for CANT_GET_INTERFACE_LIST.

CANT_GET_INTERFACE_LIST does *NOT* mean "No remote interfaces found.",
as in "there are no remote interfaces"; a NULL return from
get_remote_interface_list() and an err value of 0 means that.
CANT_GET_INTERFACE_LIST means "something bad happened and the error
string says what it is".  Display that error string, so when people
report problems:

	https://github.com/the-tcpdump-group/libpcap/issues/666

they'll give the actual error message, and I'll fix my breakage of the
rpcap protocol negotiation:

	2972769d03

rather than just wondering what the problem was and asking the reporter
of the problem for more information.

Report anything other than "there are no remote interfaces" as an error,
not a warning.

Change-Id: Ia9381953d080e037254f21e47ee7ecc4619b7254
Reviewed-on: https://code.wireshark.org/review/24627
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2017-11-28 15:06:13 -08:00
parent 2fdbeb0d78
commit ae65dc20ea
1 changed files with 9 additions and 4 deletions

View File

@ -127,10 +127,15 @@ void RemoteCaptureDialog::apply_remote()
global_remote_opts.remote_host_opts.auth_username,
global_remote_opts.remote_host_opts.auth_password,
&err, &err_str);
if (rlist == NULL &&
(err == CANT_GET_INTERFACE_LIST || err == DONT_HAVE_PCAP)) {
QMessageBox::warning(this, tr("Error"),
(err == CANT_GET_INTERFACE_LIST?tr("No remote interfaces found."):tr("PCAP not found")));
if (rlist == NULL) {
if (err == 0)
QMessageBox::warning(this, tr("Error"), tr("No remote interfaces found."));
else if (err == CANT_GET_INTERFACE_LIST)
QMessageBox::critical(this, tr("Error"), err_str);
else if (err == DONT_HAVE_PCAP)
QMessageBox::critical(this, tr("Error"), tr("PCAP not found"));
else
QMessageBox::critical(this, tr("Error"), "Unknown error");
return;
}
if (ui->hostCombo->count() == 0) {