[PATCH] dbus: add a new property SAENeedAuth

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add a new dbus property SAENeedAuth to notify the desktop that a
password dialog needs to pop up for the user to enter the correct
password

Signed-off-by: xinpeng wang <wangxinpeng@xxxxxxxxxxxxx>
---
 src/common/sae.h                        |  1 +
 wpa_supplicant/dbus/dbus_new.c          |  8 ++++++++
 wpa_supplicant/dbus/dbus_new.h          |  1 +
 wpa_supplicant/dbus/dbus_new_handlers.c | 19 +++++++++++++++++++
 wpa_supplicant/dbus/dbus_new_handlers.h |  1 +
 wpa_supplicant/notify.c                 | 10 ++++++++++
 wpa_supplicant/notify.h                 |  1 +
 wpa_supplicant/sme.c                    |  6 +++++-
 8 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/src/common/sae.h b/src/common/sae.h
index 8f74353be..3134f3dcb 100644
--- a/src/common/sae.h
+++ b/src/common/sae.h
@@ -123,6 +123,7 @@ struct sae_data {
 	unsigned int pk:1;
 	unsigned int no_pw_id:1;
 	struct sae_temporary_data *tmp;
+	int sae_need_auth;
 };
 
 int sae_set_group(struct sae_data *sae, int group);
diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index ff7e003cb..4f0e63a69 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -2519,6 +2519,9 @@ void wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s,
 	case WPAS_DBUS_PROP_SIGNAL_CHANGE:
 		prop = "SignalChange";
 		break;
+	case WPAS_DBUS_PROP_SAE_NEED_AUTH:
+		prop = "SAENeedAuth";
+		break;
 	default:
 		wpa_printf(MSG_ERROR, "dbus: %s: Unknown Property value %d",
 			   __func__, property);
@@ -4191,6 +4194,11 @@ static const struct wpa_dbus_property_desc wpas_dbus_interface_properties[] = {
 	  NULL,
 	  NULL
 	},
+	{ "SAENeedAuth", WPAS_DBUS_NEW_IFACE_INTERFACE, "b",
+	  wpas_dbus_getter_sae_need_auth,
+	  NULL,
+	  NULL
+	},
 	{ NULL, NULL, NULL, NULL, NULL, NULL }
 };
 
diff --git a/wpa_supplicant/dbus/dbus_new.h b/wpa_supplicant/dbus/dbus_new.h
index f9ff63642..9e7c91c4b 100644
--- a/wpa_supplicant/dbus/dbus_new.h
+++ b/wpa_supplicant/dbus/dbus_new.h
@@ -42,6 +42,7 @@ enum wpas_dbus_prop {
 	WPAS_DBUS_PROP_BSS_TM_STATUS,
 	WPAS_DBUS_PROP_MAC_ADDRESS,
 	WPAS_DBUS_PROP_SIGNAL_CHANGE,
+	WPAS_DBUS_PROP_SAE_NEED_AUTH,
 };
 
 enum wpas_dbus_bss_prop {
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c
index 2fad8dd59..c03b2eff2 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers.c
@@ -3631,6 +3631,25 @@ dbus_bool_t wpas_dbus_getter_scanning(
 						&scanning, error);
 }
 
+/**
+ * wpas_dbus_new_iface_get_sae_need_auth - Get interface sae need_auth
+ * @iter: Pointer to incoming dbus message iter
+ * @error: Location to store error on failure
+ * @user_data: Function specific data
+ * Returns: TRUE on success, FALSE on failure
+ *
+ * Getter for "sae_need_auth" property.
+ */
+dbus_bool_t wpas_dbus_getter_sae_need_auth(
+	const struct wpa_dbus_property_desc *property_desc,
+	DBusMessageIter *iter, DBusError *error, void *user_data)
+{
+	struct wpa_supplicant *wpa_s = user_data;
+	dbus_bool_t sae_need_auth = wpa_s->sme.sae.sae_need_auth ? TRUE : FALSE;
+
+	return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_BOOLEAN,
+						&sae_need_auth, error);
+}
 
 /**
  * wpas_dbus_getter_ap_scan - Control roaming mode
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.h b/wpa_supplicant/dbus/dbus_new_handlers.h
index a5260907a..d0e731aff 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.h
+++ b/wpa_supplicant/dbus/dbus_new_handlers.h
@@ -225,6 +225,7 @@ DECLARE_ACCESSOR(wpas_dbus_getter_enabled);
 DECLARE_ACCESSOR(wpas_dbus_setter_enabled);
 DECLARE_ACCESSOR(wpas_dbus_getter_network_properties);
 DECLARE_ACCESSOR(wpas_dbus_setter_network_properties);
+DECLARE_ACCESSOR(wpas_dbus_getter_sae_need_auth);
 
 DBusMessage * wpas_dbus_handler_wps_start(DBusMessage *message,
 					  struct wpa_supplicant *wpa_s);
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index 06e006963..e239bb53b 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -290,6 +290,16 @@ void wpas_notify_scanning(struct wpa_supplicant *wpa_s)
 }
 
 
+void wpas_notify_sae_need_auth(struct wpa_supplicant *wpa_s)
+{
+	if (wpa_s->p2p_mgmt)
+		return;
+
+	/* notify the new DBus API */
+	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SAE_NEED_AUTH);
+}
+
+
 void wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success)
 {
 	if (wpa_s->p2p_mgmt)
diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h
index 7f6c345d2..cf9823cce 100644
--- a/wpa_supplicant/notify.h
+++ b/wpa_supplicant/notify.h
@@ -49,6 +49,7 @@ void wpas_notify_network_request(struct wpa_supplicant *wpa_s,
 				 enum wpa_ctrl_req_type rtype,
 				 const char *default_txt);
 void wpas_notify_scanning(struct wpa_supplicant *wpa_s);
+void wpas_notify_sae_need_auth(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);
 void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s,
diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index 2b758939d..317f6c5fa 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -1913,8 +1913,12 @@ static int sme_sae_auth(struct wpa_supplicant *wpa_s, u16 auth_transaction,
 		if (wpa_s->sme.sae.state != SAE_CONFIRMED)
 			return -1;
 		if (sae_check_confirm(&wpa_s->sme.sae, data, len,
-				      ie_offset) < 0)
+				      ie_offset) < 0) {
+			wpa_s->sme.sae.sae_need_auth = 1;
+			wpa_dbg(wpa_s, MSG_DEBUG, "SME: Notifying SAENeedAuth attribute changes");
+			wpas_notify_sae_need_auth(wpa_s);
 			return -1;
+		}
 		if (external && wpa_s->sme.ext_ml_auth &&
 		    sme_external_ml_auth(wpa_s, data, len, *ie_offset,
 					 status_code))
-- 
2.20.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux