[PATCH] Fix new DBus API
Tomasz Bursztyka
tomasz.bursztyka
Wed Jan 5 02:08:02 PST 2011
"psk" field, in set_network_properties(), was always getting quoted even when
containing a raw key (64 characters length representing the hexadecimal value
of the raw key).
---
wpa_supplicant/dbus/dbus_new_handlers.c | 24 +++++++++++++++++++-----
1 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c
index 08cdd72..987f766 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers.c
@@ -195,7 +195,9 @@ static const char *dont_quote[] = {
"bssid", NULL
};
-static dbus_bool_t should_quote_opt(const char *key)
+static dbus_bool_t should_quote_opt(const char *key,
+ size_t value_length,
+ char *value)
{
int i = 0;
while (dont_quote[i] != NULL) {
@@ -203,6 +205,17 @@ static dbus_bool_t should_quote_opt(const char *key)
return FALSE;
i++;
}
+
+ /*
+ * Do not quote psk value which is a raw key.
+ */
+ if ((os_strcmp(key, "psk") == 0) && (value_length == PMK_LEN*2)) {
+ u8 tmp_buf[PMK_LEN];
+
+ if (hexstr2bin(value, tmp_buf, PMK_LEN) == 0)
+ return FALSE;
+ }
+
return TRUE;
}
@@ -273,11 +286,12 @@ static DBusMessage * set_network_properties(DBusMessage *message,
if (ret <= 0)
goto error;
} else if (entry.type == DBUS_TYPE_STRING) {
- if (should_quote_opt(entry.key)) {
- size = os_strlen(entry.str_value);
- if (size <= 0)
- goto error;
+ size = os_strlen(entry.str_value);
+ if (size <= 0)
+ goto error;
+ if (should_quote_opt(entry.key, size,
+ entry.str_value)) {
size += 3;
value = os_zalloc(size);
if (value == NULL)
--
1.7.2.3
More information about the Hostap
mailing list