summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2015-07-17 17:01:27 +0200
committerAnders Broman <a.broman58@gmail.com>2015-07-22 07:10:10 +0000
commit6452caa3b3ffe0f72d2a6396d96f0470ceb77671 (patch)
treee75ce1025539ea5d2f9e013ae0f23b7340b8c137 /ui
parent32d9a1d714d5d253428a5c3d5450e1d3316a9f16 (diff)
downloadwireshark-6452caa3b3ffe0f72d2a6396d96f0470ceb77671.tar.gz
Fix retrieval of data link type supported by remote interfaces with authentication
Make use of -A parameter when querying data link types supported by a given interface with dumpcap. Ensure to pass the authentication parameters configured for a remote interface when calling capture_get_if_capabilities() Bug: 11366 Change-Id: I4efea615084a82108e4a12a64e8c46817f30a5c6 Reviewed-on: https://code.wireshark.org/review/9690 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/gtk/capture_dlg.c20
-rw-r--r--ui/gtk/main.c12
-rw-r--r--ui/gtk/prefs_capture.c14
-rw-r--r--ui/iface_lists.c2
-rw-r--r--ui/qt/manage_interfaces_dialog.cpp12
5 files changed, 46 insertions, 14 deletions
diff --git a/ui/gtk/capture_dlg.c b/ui/gtk/capture_dlg.c
index 80c848ef4f..747097677f 100644
--- a/ui/gtk/capture_dlg.c
+++ b/ui/gtk/capture_dlg.c
@@ -1225,6 +1225,7 @@ insert_new_rows(GList *list)
model = gtk_tree_view_get_model(if_cb);
/* Scan through the list and build a list of strings to display. */
for (if_entry = g_list_first(list); if_entry != NULL; if_entry = g_list_next(if_entry)) {
+ gchar *auth_str = NULL;
if_info = (if_info_t *)if_entry->data;
#ifdef HAVE_PCAP_REMOTE
add_interface_to_remote_list(if_info);
@@ -1282,7 +1283,14 @@ insert_new_rows(GList *list)
}
device.cfilter = g_strdup(global_capture_opts.default_options.cfilter);
monitor_mode = prefs_capture_device_monitor_mode(if_string);
- caps = capture_get_if_capabilities(if_string, monitor_mode, NULL, main_window_update);
+#ifdef HAVE_PCAP_REMOTE
+ if (global_remote_opts.remote_host_opts.auth_type == CAPTURE_AUTH_PWD) {
+ auth_str = g_strdup_printf("%s:%s", global_remote_opts.remote_host_opts.auth_username,
+ global_remote_opts.remote_host_opts.auth_password);
+ }
+#endif
+ caps = capture_get_if_capabilities(if_string, monitor_mode, auth_str, NULL, main_window_update);
+ g_free(auth_str);
gtk_list_store_append (GTK_LIST_STORE(model), &iter);
for (; (curr_addr = g_slist_nth(if_info->addrs, ips)) != NULL; ips++) {
if (ips != 0) {
@@ -5875,6 +5883,7 @@ capture_prep_monitor_changed_cb(GtkWidget *monitor, gpointer argp _U_)
link_row *linkr;
GtkWidget *linktype_combo_box = (GtkWidget *) g_object_get_data(G_OBJECT(opt_edit_w), E_CAP_LT_CBX_KEY);
GtkWidget *linktype_lb = (GtkWidget *)g_object_get_data(G_OBJECT(linktype_combo_box), E_CAP_LT_CBX_LABEL_KEY);
+ gchar *auth_str = NULL;
device = g_array_index(global_capture_opts.all_ifaces, interface_t, marked_interface);
global_capture_opts.all_ifaces = g_array_remove_index(global_capture_opts.all_ifaces, marked_interface);
@@ -5882,7 +5891,14 @@ capture_prep_monitor_changed_cb(GtkWidget *monitor, gpointer argp _U_)
if_string = g_strdup(device.name);
monitor_mode = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(monitor));
- caps = capture_get_if_capabilities(if_string, monitor_mode, NULL, main_window_update);
+#ifdef HAVE_PCAP_REMOTE
+ if (device.remote_opts.remote_host_opts.auth_type == CAPTURE_AUTH_PWD) {
+ auth_str = g_strdup_printf("%s:%s", device.remote_opts.remote_host_opts.auth_username,
+ device.remote_opts.remote_host_opts.auth_password);
+ }
+#endif
+ caps = capture_get_if_capabilities(if_string, monitor_mode, auth_str, NULL, main_window_update);
+ g_free(auth_str);
if (caps != NULL) {
g_signal_handlers_disconnect_by_func(linktype_combo_box, G_CALLBACK(select_link_type_cb), NULL );
diff --git a/ui/gtk/main.c b/ui/gtk/main.c
index c69ba84eba..b5cd7922bc 100644
--- a/ui/gtk/main.c
+++ b/ui/gtk/main.c
@@ -2955,11 +2955,19 @@ DIAG_ON(cast-qual)
device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
if (device.selected) {
+ gchar* auth_str = NULL;
+#ifdef HAVE_PCAP_REMOTE
+ if (device.remote_opts.remote_host_opts.auth_type == CAPTURE_AUTH_PWD) {
+ auth_str = g_strdup_printf("%s:%s", device.remote_opts.remote_host_opts.auth_username,
+ device.remote_opts.remote_host_opts.auth_password);
+ }
+#endif
#if defined(HAVE_PCAP_CREATE)
- caps = capture_get_if_capabilities(device.name, device.monitor_mode_supported, &err_str, main_window_update);
+ caps = capture_get_if_capabilities(device.name, device.monitor_mode_supported, auth_str, &err_str, main_window_update);
#else
- caps = capture_get_if_capabilities(device.name, FALSE, &err_str,main_window_update);
+ caps = capture_get_if_capabilities(device.name, FALSE, auth_str, &err_str,main_window_update);
#endif
+ g_free(auth_str);
if (caps == NULL) {
cmdarg_err("%s", err_str);
g_free(err_str);
diff --git a/ui/gtk/prefs_capture.c b/ui/gtk/prefs_capture.c
index be9654ecb2..b95e05c4bf 100644
--- a/ui/gtk/prefs_capture.c
+++ b/ui/gtk/prefs_capture.c
@@ -1075,7 +1075,7 @@ ifopts_description_to_val (const char *if_name, gboolean monitor_mode, const cha
if_capabilities_t *caps;
int dlt = -1;
- caps = capture_get_if_capabilities(if_name, monitor_mode, NULL, main_window_update);
+ caps = capture_get_if_capabilities(if_name, monitor_mode, NULL, NULL, main_window_update);
if (caps != NULL) {
if (caps->data_link_types != NULL) {
GList *lt_entry;
@@ -1186,9 +1186,9 @@ ifopts_edit_ifsel_cb(GtkTreeSelection *selection _U_,
* to the interface capabilities of the selected interface
*/
#ifdef HAVE_PCAP_CREATE
- caps = capture_get_if_capabilities(if_name, monitor_mode, NULL, main_window_update);
+ caps = capture_get_if_capabilities(if_name, monitor_mode, NULL, NULL, main_window_update);
#else
- caps = capture_get_if_capabilities(if_name, FALSE, NULL, main_window_update);
+ caps = capture_get_if_capabilities(if_name, FALSE, NULL, NULL, main_window_update);
#endif
if (caps != NULL) {
#ifdef HAVE_PCAP_CREATE
@@ -1304,10 +1304,10 @@ ifopts_edit_monitor_changed_cb(GtkToggleButton *tbt, gpointer udata)
gtk_list_store_set (list_store, &list_iter,
DEF_MONITOR_MODE_COLUMN, monitor_mode,
-1);
- caps = capture_get_if_capabilities(if_name, monitor_mode, NULL, main_window_update);
+ caps = capture_get_if_capabilities(if_name, monitor_mode, NULL, NULL, main_window_update);
#else
/* no monitor-mode support */
- caps = capture_get_if_capabilities(if_name, FALSE, NULL);
+ caps = capture_get_if_capabilities(if_name, FALSE, NULL, NULL);
#endif
/*
@@ -1620,10 +1620,10 @@ ifopts_options_add(GtkListStore *list_store, if_info_t *if_info)
#ifdef HAVE_PCAP_CREATE
/* get default monitor mode setting */
monitor_mode = prefs_capture_device_monitor_mode(if_info->name);
- caps = capture_get_if_capabilities(if_info->name, monitor_mode, NULL, main_window_update);
+ caps = capture_get_if_capabilities(if_info->name, monitor_mode, NULL, NULL, main_window_update);
#else
/* no monitor-mode support */
- caps = capture_get_if_capabilities(if_info->name, FALSE, NULL, main_window_update);
+ caps = capture_get_if_capabilities(if_info->name, FALSE, NULL, NULL, main_window_update);
#endif
/* set default link-layer header type */
diff --git a/ui/iface_lists.c b/ui/iface_lists.c
index 2756805a93..8c29dd357e 100644
--- a/ui/iface_lists.c
+++ b/ui/iface_lists.c
@@ -183,7 +183,7 @@ scan_local_interfaces(void (*update_cb)(void))
}
device.type = if_info->type;
monitor_mode = prefs_capture_device_monitor_mode(if_info->name);
- caps = capture_get_if_capabilities(if_info->name, monitor_mode, NULL, update_cb);
+ caps = capture_get_if_capabilities(if_info->name, monitor_mode, NULL, NULL, update_cb);
for (; (curr_addr = g_slist_nth(if_info->addrs, ips)) != NULL; ips++) {
temp_addr = (if_addr_t *)g_malloc0(sizeof(if_addr_t));
if (ips != 0) {
diff --git a/ui/qt/manage_interfaces_dialog.cpp b/ui/qt/manage_interfaces_dialog.cpp
index c0746f8409..cc80b4dc3e 100644
--- a/ui/qt/manage_interfaces_dialog.cpp
+++ b/ui/qt/manage_interfaces_dialog.cpp
@@ -475,7 +475,7 @@ void ManageInterfacesDialog::addRemoteInterfaces(GList* rlist, remote_options *r
GList *if_entry, *lt_entry;
if_info_t *if_info;
char *if_string = NULL;
- gchar *descr, *str = NULL, *link_type_name = NULL;;
+ gchar *descr, *str = NULL, *link_type_name = NULL, *auth_str;
if_capabilities_t *caps;
gint linktype_count;
bool monitor_mode, found = false;
@@ -490,6 +490,7 @@ void ManageInterfacesDialog::addRemoteInterfaces(GList* rlist, remote_options *r
guint num_interfaces = global_capture_opts.all_ifaces->len;
for (if_entry = g_list_first(rlist); if_entry != NULL; if_entry = g_list_next(if_entry)) {
+ auth_str = NULL;
if_info = (if_info_t *)if_entry->data;
for (i = 0; i < num_interfaces; i++) {
device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
@@ -546,7 +547,14 @@ void ManageInterfacesDialog::addRemoteInterfaces(GList* rlist, remote_options *r
}
device.cfilter = g_strdup(global_capture_opts.default_options.cfilter);
monitor_mode = prefs_capture_device_monitor_mode(if_string);
- caps = capture_get_if_capabilities(if_string, monitor_mode, NULL, main_window_update);
+#ifdef HAVE_PCAP_REMOTE
+ if (roptions->remote_host_opts.auth_type == CAPTURE_AUTH_PWD) {
+ auth_str = g_strdup_printf("%s:%s", roptions->remote_host_opts.auth_username,
+ roptions->remote_host_opts.auth_password);
+ }
+#endif
+ caps = capture_get_if_capabilities(if_string, monitor_mode, auth_str, NULL, main_window_update);
+ g_free(auth_str);
for (; (curr_addr = g_slist_nth(if_info->addrs, ips)) != NULL; ips++) {
address addr_str;
char* temp_addr_str = NULL;