mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-25 00:38:24 -05:00
dbus: Implement EAP SM control request signals
Add a D-Bus signal for EAP SM requests. This signal is emitted on the Interface object so that clients only have to listen to one object for requests rather than to all network objects. This signal is analogous to the socket control interface's CTRL-REQ- request. Signed-off-by: Dan Williams <dcbw@redhat.com>
This commit is contained in:
parent
9ef1aaae24
commit
a9022616ae
@ -22,6 +22,7 @@
|
||||
#include "../config.h"
|
||||
#include "../wpa_supplicant_i.h"
|
||||
#include "../bss.h"
|
||||
#include "../wpas_glue.h"
|
||||
#include "dbus_new_helpers.h"
|
||||
#include "dbus_dict_helpers.h"
|
||||
#include "dbus_new.h"
|
||||
@ -381,6 +382,67 @@ void wpas_dbus_signal_network_selected(struct wpa_supplicant *wpa_s, int id)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpas_dbus_signal_network_request - Indicate that additional information
|
||||
* (EAP password, etc.) is required to complete the association to this SSID
|
||||
* @wpa_s: %wpa_supplicant network interface data
|
||||
* @rtype: The specific additional information required
|
||||
* @default_text: Optional description of required information
|
||||
*
|
||||
* Request additional information or passwords to complete an association
|
||||
* request.
|
||||
*/
|
||||
void wpas_dbus_signal_network_request(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid,
|
||||
enum wpa_ctrl_req_type rtype,
|
||||
const char *default_txt)
|
||||
{
|
||||
struct wpas_dbus_priv *iface;
|
||||
DBusMessage *msg;
|
||||
DBusMessageIter iter;
|
||||
char net_obj_path[WPAS_DBUS_OBJECT_PATH_MAX];
|
||||
const char *field, *txt = NULL, *net_ptr;
|
||||
|
||||
iface = wpa_s->global->dbus;
|
||||
|
||||
/* Do nothing if the control interface is not turned on */
|
||||
if (iface == NULL)
|
||||
return;
|
||||
|
||||
field = wpa_supplicant_ctrl_req_to_string(rtype, default_txt, &txt);
|
||||
if (field == NULL)
|
||||
return;
|
||||
|
||||
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
|
||||
WPAS_DBUS_NEW_IFACE_INTERFACE,
|
||||
"NetworkRequest");
|
||||
if (msg == NULL)
|
||||
return;
|
||||
|
||||
os_snprintf(net_obj_path, WPAS_DBUS_OBJECT_PATH_MAX,
|
||||
"%s/" WPAS_DBUS_NEW_NETWORKS_PART "/%u",
|
||||
wpa_s->dbus_new_path, ssid->id);
|
||||
net_ptr = &net_obj_path[0];
|
||||
|
||||
dbus_message_iter_init_append(msg, &iter);
|
||||
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH,
|
||||
&net_ptr))
|
||||
goto err;
|
||||
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &field))
|
||||
goto err;
|
||||
if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &txt))
|
||||
goto err;
|
||||
|
||||
dbus_connection_send(iface->con, msg, NULL);
|
||||
dbus_message_unref(msg);
|
||||
return;
|
||||
|
||||
err:
|
||||
wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
|
||||
dbus_message_unref(msg);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpas_dbus_signal_network_enabled_changed - Signals Enabled property changes
|
||||
* @wpa_s: %wpa_supplicant network interface data
|
||||
@ -1689,6 +1751,14 @@ static const struct wpa_dbus_signal_desc wpas_dbus_global_signals[] = {
|
||||
END_ARGS
|
||||
}
|
||||
},
|
||||
{ "NetworkRequest", WPAS_DBUS_NEW_IFACE_INTERFACE,
|
||||
{
|
||||
{ "path", "o", ARG_OUT },
|
||||
{ "field", "s", ARG_OUT },
|
||||
{ "text", "s", ARG_OUT },
|
||||
END_ARGS
|
||||
}
|
||||
},
|
||||
/* Deprecated: use org.freedesktop.DBus.Properties.PropertiesChanged */
|
||||
{ "PropertiesChanged", WPAS_DBUS_NEW_INTERFACE,
|
||||
{
|
||||
|
@ -25,6 +25,7 @@ struct wps_event_m2d;
|
||||
struct wps_event_fail;
|
||||
struct wps_credential;
|
||||
enum wpa_states;
|
||||
enum wpa_ctrl_req_type;
|
||||
|
||||
enum wpas_dbus_prop {
|
||||
WPAS_DBUS_PROP_AP_SCAN,
|
||||
@ -131,6 +132,10 @@ void wpas_dbus_bss_signal_prop_changed(struct wpa_supplicant *wpa_s,
|
||||
void wpas_dbus_signal_network_enabled_changed(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid);
|
||||
void wpas_dbus_signal_network_selected(struct wpa_supplicant *wpa_s, int id);
|
||||
void wpas_dbus_signal_network_request(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid,
|
||||
enum wpa_ctrl_req_type rtype,
|
||||
const char *default_text);
|
||||
void wpas_dbus_signal_scan_done(struct wpa_supplicant *wpa_s, int success);
|
||||
void wpas_dbus_signal_wps_cred(struct wpa_supplicant *wpa_s,
|
||||
const struct wps_credential *cred);
|
||||
@ -241,6 +246,12 @@ static inline void wpas_dbus_signal_network_selected(
|
||||
{
|
||||
}
|
||||
|
||||
static inline void wpas_dbus_signal_network_request(
|
||||
struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
|
||||
enum wpa_ctrl_req_type rtype, const char *default_txt)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void wpas_dbus_signal_scan_done(struct wpa_supplicant *wpa_s,
|
||||
int success)
|
||||
{
|
||||
|
@ -78,7 +78,7 @@ struct wpa_dbus_signal_desc {
|
||||
/* signal interface */
|
||||
const char *dbus_interface;
|
||||
/* array of arguments */
|
||||
struct wpa_dbus_argument args[3];
|
||||
struct wpa_dbus_argument args[4];
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -141,6 +141,15 @@ void wpas_notify_network_selected(struct wpa_supplicant *wpa_s,
|
||||
}
|
||||
|
||||
|
||||
void wpas_notify_network_request(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid,
|
||||
enum wpa_ctrl_req_type rtype,
|
||||
const char *default_txt)
|
||||
{
|
||||
wpas_dbus_signal_network_request(wpa_s, ssid, rtype, default_txt);
|
||||
}
|
||||
|
||||
|
||||
void wpas_notify_scanning(struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
/* notify the old DBus API */
|
||||
|
@ -36,6 +36,10 @@ void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid);
|
||||
void wpas_notify_network_selected(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid);
|
||||
void wpas_notify_network_request(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid,
|
||||
enum wpa_ctrl_req_type rtype,
|
||||
const char *default_txt);
|
||||
void wpas_notify_scanning(struct wpa_supplicant *wpa_s);
|
||||
void wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success);
|
||||
void wpas_notify_scan_results(struct wpa_supplicant *wpa_s);
|
||||
|
@ -648,6 +648,8 @@ static void wpa_supplicant_eap_param_needed(void *ctx,
|
||||
if (ssid == NULL)
|
||||
return;
|
||||
|
||||
wpas_notify_network_request(wpa_s, ssid, field, default_txt);
|
||||
|
||||
field_name = wpa_supplicant_ctrl_req_to_string(field, default_txt,
|
||||
&txt);
|
||||
if (field_name == NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user