[PATCH 04/14] dbus: allow psk=ext:<name> in network properties

Angelo Compagnucci angelo.compagnucci at gmail.com
Mon Nov 23 06:24:38 PST 2026


wpa_supplicant puts quotes around the string values of network
properties before it parses them. So a psk of "ext:<name>" became a
passphrase, and a D-Bus client could not make a network use an
external password. The configuration file and the control interface
already allow this. When external passwords are built in, do not quote
such a psk. As a result, a passphrase that starts with "ext:" can no
longer be set through D-Bus.

Tested with a D-Bus client that added a network with psk "ext:<name>".
The network then used the external password.

Signed-off-by: Angelo Compagnucci <angelo.compagnucci at gmail.com>
---
 wpa_supplicant/dbus/dbus_new_handlers.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c
index e686a2e79..106872aab 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers.c
@@ -157,6 +157,17 @@ static const char * const dont_quote[] = {
 	"mac_value", NULL
 };
 
+/* psk=ext:<name> is the name of an external password, not a passphrase */
+static dbus_bool_t is_ext_psk(const char *key, const char *value)
+{
+#ifdef CONFIG_EXT_PASSWORD
+	return os_strcmp(key, "psk") == 0 && str_starts(value, "ext:");
+#else /* CONFIG_EXT_PASSWORD */
+	return FALSE;
+#endif /* CONFIG_EXT_PASSWORD */
+}
+
+
 static dbus_bool_t should_quote_opt(const char *key)
 {
 	int i = 0;
@@ -238,7 +249,8 @@ dbus_bool_t set_network_properties(struct wpa_supplicant *wpa_s,
 			if (ret <= 0)
 				goto error;
 		} else if (entry.type == DBUS_TYPE_STRING) {
-			if (should_quote_opt(entry.key)) {
+			if (should_quote_opt(entry.key) &&
+			    !is_ext_psk(entry.key, entry.str_value)) {
 				size = os_strlen(entry.str_value);
 
 				size += 3;
-- 
2.53.0




More information about the Hostap mailing list