aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2011-07-15 22:32:26 (GMT)
committerJouni Malinen <j@w1.fi>2013-11-24 20:46:38 (GMT)
commit79b38d4b45a05ef7d291e11f8df807cb9086da99 (patch)
treed64fb2638c50c5bba6fad47a3e5da76685103310
parenta3057941fd8be11e8f5e0b409105cfb8cc42fb8b (diff)
downloadhostap-79b38d4b45a05ef7d291e11f8df807cb9086da99.zip
hostap-79b38d4b45a05ef7d291e11f8df807cb9086da99.tar.gz
hostap-79b38d4b45a05ef7d291e11f8df807cb9086da99.tar.bz2
Add WPA_UNICODE_SSID support
Change-Id: I1f938b97169d4468ee5b05316826ee509a10d9ad Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
-rw-r--r--wpa_supplicant/config.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index 9ceaaf8..12b0ecc 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -171,6 +171,27 @@ static char * wpa_config_write_str(const struct parse_data *data,
return wpa_config_write_string((const u8 *) *src, len);
}
+
+
+#ifdef WPA_UNICODE_SSID
+static char * wpa_config_write_str_unicode(const struct parse_data *data,
+ struct wpa_ssid *ssid)
+{
+ size_t len;
+ char **src;
+
+ src = (char **) (((u8 *) ssid) + (long) data->param1);
+ if (*src == NULL)
+ return NULL;
+
+ if (data->param2)
+ len = *((size_t *) (((u8 *) ssid) + (long) data->param2));
+ else
+ len = os_strlen(*src);
+
+ return wpa_config_write_string_ascii((const u8 *) *src, len);
+}
+#endif /* WPA_UNICODE_SSID */
#endif /* NO_CONFIG_WRITE */
@@ -1556,6 +1577,17 @@ static char * wpa_config_write_psk_list(const struct parse_data *data,
OFFSET(f), (void *) 0
#define _INTe(f) #f, wpa_config_parse_int, wpa_config_write_int, \
OFFSET(eap.f), (void *) 0
+#ifdef WPA_UNICODE_SSID
+/* STR_* variants that do not force conversion to ASCII */
+#define _STR_UNICODE(f) #f, wpa_config_parse_str, \
+ wpa_config_write_str_unicode, OFFSET(f)
+#define STR_UNICODE(f) _STR_UNICODE(f), NULL, NULL, NULL, 0
+#define _STR_LEN_UNICODE(f) _STR_UNICODE(f), OFFSET(f ## _len)
+#define STR_LEN_UNICODE(f) _STR_LEN_UNICODE(f), NULL, NULL, 0
+#define _STR_RANGE_UNICODE(f, min, max) _STR_LEN_UNICODE(f), \
+ (void *) (min), (void *) (max)
+#define STR_RANGE_UNICODE(f, min, max) _STR_RANGE_UNICODE(f, min, max), 0
+#endif /* WPA_UNICODE_SSID */
#endif /* NO_CONFIG_WRITE */
/* INT: Define an integer variable */
@@ -1600,7 +1632,11 @@ static char * wpa_config_write_psk_list(const struct parse_data *data,
* functions.
*/
static const struct parse_data ssid_fields[] = {
+#ifdef WPA_UNICODE_SSID
+ { STR_RANGE_UNICODE(ssid, 0, MAX_SSID_LEN) },
+#else /* WPA_UNICODE_SSID */
{ STR_RANGE(ssid, 0, MAX_SSID_LEN) },
+#endif /* WPA_UNICODE_SSID */
{ INT_RANGE(scan_ssid, 0, 1) },
{ FUNC(bssid) },
{ FUNC_KEY(psk) },
@@ -1717,6 +1753,15 @@ static const struct parse_data ssid_fields[] = {
{ INT(beacon_int) },
};
+#ifdef WPA_UNICODE_SSID
+#undef _STR_UNICODE
+#undef STR_UNICODE
+#undef _STR_LEN_UNICODE
+#undef STR_LEN_UNICODE
+#undef _STR_RANGE_UNICODE
+#undef STR_RANGE_UNICODE
+#endif /* WPA_UNICODE_SSID */
+
#undef OFFSET
#undef _STR
#undef STR