aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2012-08-09 19:20:45 (GMT)
committerJouni Malinen <j@w1.fi>2012-08-09 20:18:31 (GMT)
commit8451227fa47a6d743c54b66f568442ba942c270d (patch)
tree43528ef63b5e8ebfad7fd5136ca380802ce7aa4b
parent7997ece468a8cd59d005e060ce36ccf70b065377 (diff)
downloadhostap-8451227fa47a6d743c54b66f568442ba942c270d.zip
hostap-8451227fa47a6d743c54b66f568442ba942c270d.tar.gz
hostap-8451227fa47a6d743c54b66f568442ba942c270d.tar.bz2
AOSP: unicode
-rw-r--r--src/utils/common.c2
-rw-r--r--wpa_supplicant/config.c42
2 files changed, 44 insertions, 0 deletions
diff --git a/src/utils/common.c b/src/utils/common.c
index 99861ae..26fea1b 100644
--- a/src/utils/common.c
+++ b/src/utils/common.c
@@ -368,8 +368,10 @@ const char * wpa_ssid_txt(const u8 *ssid, size_t ssid_len)
os_memcpy(ssid_txt, ssid, ssid_len);
ssid_txt[ssid_len] = '\0';
for (pos = ssid_txt; *pos != '\0'; pos++) {
+#ifndef WPA_UNICODE_SSID
if ((u8) *pos < 32 || (u8) *pos >= 127)
*pos = '_';
+#endif
}
return ssid_txt;
}
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index a7c1784..f6e0802 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -218,6 +218,26 @@ 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
#endif /* NO_CONFIG_WRITE */
@@ -1473,6 +1493,15 @@ static char * wpa_config_write_p2p_client_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
#endif /* NO_CONFIG_WRITE */
/* INT: Define an integer variable */
@@ -1517,7 +1546,11 @@ static char * wpa_config_write_p2p_client_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
{ STR_RANGE(ssid, 0, MAX_SSID_LEN) },
+#endif
{ INT_RANGE(scan_ssid, 0, 1) },
{ FUNC(bssid) },
{ FUNC_KEY(psk) },
@@ -1602,6 +1635,15 @@ static const struct parse_data ssid_fields[] = {
#endif /* CONFIG_HT_OVERRIDES */
};
+#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
+
#undef OFFSET
#undef _STR
#undef STR