aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorPaul Stewart <pstew@google.com>2011-03-15 11:53:56 (GMT)
committerJouni Malinen <j@w1.fi>2011-03-15 11:53:56 (GMT)
commitba6f267f64380906a3c8692507a49e09fb8cf1cd (patch)
treef3902766f087a06aea0a08f7c00950420396cd44 /wpa_supplicant
parentcf83fb0b5baaa192042db7452b1426e2e02fd9ce (diff)
downloadhostap-ba6f267f64380906a3c8692507a49e09fb8cf1cd.zip
hostap-ba6f267f64380906a3c8692507a49e09fb8cf1cd.tar.gz
hostap-ba6f267f64380906a3c8692507a49e09fb8cf1cd.tar.bz2
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>
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/dbus/dbus_new.c4
-rw-r--r--wpa_supplicant/dbus/dbus_new_handlers.c39
-rw-r--r--wpa_supplicant/dbus/dbus_new_handlers.h3
-rw-r--r--wpa_supplicant/dbus/dbus_new_helpers.h1
4 files changed, 47 insertions, 0 deletions
diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index c66640a..7562c94 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -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
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c
index 5402bff..3f129a0 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers.c
@@ -2192,6 +2192,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
* @wpa_s: wpa_supplicant structure for a network interface
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.h b/wpa_supplicant/dbus/dbus_new_handlers.h
index 3cdf9cb..119d15d 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.h
+++ b/wpa_supplicant/dbus/dbus_new_handlers.h
@@ -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);
diff --git a/wpa_supplicant/dbus/dbus_new_helpers.h b/wpa_supplicant/dbus/dbus_new_helpers.h
index 8db7a37..7038b63 100644
--- a/wpa_supplicant/dbus/dbus_new_helpers.h
+++ b/wpa_supplicant/dbus/dbus_new_helpers.h
@@ -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"