dbus: Add D-Bus method for current authentication mode
Chooses between EAP and non-EAP authentication modes and uses the appropriate method to retrieve the name. Signed-off-by: Paul Stewart <pstew@google.com>
This commit is contained in:
parent
cf83fb0b5b
commit
ba6f267f64
4 changed files with 47 additions and 0 deletions
|
@ -1388,6 +1388,10 @@ static const struct wpa_dbus_property_desc wpas_dbus_interface_properties[] = {
|
|||
(WPADBusPropertyAccessor) wpas_dbus_getter_current_network,
|
||||
NULL, R
|
||||
},
|
||||
{ "CurrentAuthMode", WPAS_DBUS_NEW_IFACE_INTERFACE, "s",
|
||||
(WPADBusPropertyAccessor) wpas_dbus_getter_current_auth_mode,
|
||||
NULL, R
|
||||
},
|
||||
{ "Blobs", WPAS_DBUS_NEW_IFACE_INTERFACE, "a{say}",
|
||||
(WPADBusPropertyAccessor) wpas_dbus_getter_blobs,
|
||||
NULL, R
|
||||
|
|
|
@ -2191,6 +2191,45 @@ DBusMessage * wpas_dbus_getter_current_network(DBusMessage *message,
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpas_dbus_getter_current_auth_mode - Get current authentication type
|
||||
* @message: Pointer to incoming dbus message
|
||||
* @wpa_s: wpa_supplicant structure for a network interface
|
||||
* Returns: A dbus message containing a string indicating the current
|
||||
* authentication type.
|
||||
*
|
||||
* Getter for "CurrentAuthMode" property.
|
||||
*/
|
||||
DBusMessage * wpas_dbus_getter_current_auth_mode(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
DBusMessage *reply;
|
||||
const char *eap_mode;
|
||||
const char *auth_mode;
|
||||
char eap_mode_buf[WPAS_DBUS_AUTH_MODE_MAX];
|
||||
|
||||
if (wpa_s->wpa_state != WPA_COMPLETED) {
|
||||
auth_mode = "INACTIVE";
|
||||
} else if (wpa_s->key_mgmt == WPA_KEY_MGMT_IEEE8021X ||
|
||||
wpa_s->key_mgmt == WPA_KEY_MGMT_IEEE8021X_NO_WPA) {
|
||||
eap_mode = wpa_supplicant_get_eap_mode(wpa_s);
|
||||
os_snprintf(eap_mode_buf, WPAS_DBUS_AUTH_MODE_MAX,
|
||||
"EAP-%s", eap_mode);
|
||||
auth_mode = eap_mode_buf;
|
||||
|
||||
} else {
|
||||
auth_mode = wpa_key_mgmt_txt(wpa_s->key_mgmt,
|
||||
wpa_s->current_ssid->proto);
|
||||
}
|
||||
|
||||
reply = wpas_dbus_simple_property_getter(message,
|
||||
DBUS_TYPE_STRING,
|
||||
&auth_mode);
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpas_dbus_getter_bridge_ifname - Get interface name
|
||||
* @message: Pointer to incoming dbus message
|
||||
|
|
|
@ -125,6 +125,9 @@ DBusMessage * wpas_dbus_getter_current_bss(DBusMessage *message,
|
|||
DBusMessage * wpas_dbus_getter_current_network(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_getter_current_auth_mode(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
DBusMessage * wpas_dbus_getter_bsss(DBusMessage *message,
|
||||
struct wpa_supplicant *wpa_s);
|
||||
|
||||
|
|
|
@ -104,6 +104,7 @@ struct wpa_dbus_property_desc {
|
|||
#define WPAS_DBUS_OBJECT_PATH_MAX 150
|
||||
#define WPAS_DBUS_INTERFACE_MAX 150
|
||||
#define WPAS_DBUS_METHOD_SIGNAL_PROP_MAX 50
|
||||
#define WPAS_DBUS_AUTH_MODE_MAX 64
|
||||
|
||||
#define WPA_DBUS_INTROSPECTION_INTERFACE "org.freedesktop.DBus.Introspectable"
|
||||
#define WPA_DBUS_INTROSPECTION_METHOD "Introspect"
|
||||
|
|
Loading…
Reference in a new issue