Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(626)

Unified Diff: wpa_supplicant/dbus/dbus_new_handlers.c

Issue 6783033: CHROMIUMOS: wpa_supplicant: Accept raw PMK in new DBus API (Closed) Base URL: ssh://gitrw.chromium.org:9222/hostap.git@master
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: wpa_supplicant/dbus/dbus_new_handlers.c
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c
index 047909f3ee03eb5758fdde36a36bcf108801c37d..4a2aa1b4fc8fca28799accd74047ffd8a980e70a 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)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698