[PATCH] Add WPA_UNICODE_SSID support

Johannes Berg johannes
Fri Feb 25 00:42:02 PST 2011


On Thu, 2011-02-24 at 17:31 -0800, Dmitry Shmidt wrote:

> --- a/src/utils/common.c
> +++ b/src/utils/common.c
> @@ -374,8 +374,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

That doesn't make sense, anyone who has a working, say UTF-8, config now
will be totally confused by this change.

> +#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

And without the first change, this change also doesn't make a lot of
sense?

johannes




More information about the Hostap mailing list