Merged EAP-AKA' into eap_aka.c and added it to defconfig/ChangeLog
[wpasupplicant] / wpa_supplicant / config.c
index c95e7a0..a452323 100644 (file)
@@ -60,14 +60,19 @@ struct parse_data {
 static char * wpa_config_parse_string(const char *value, size_t *len)
 {
        if (*value == '"') {
-               char *pos;
+               const char *pos;
+               char *str;
                value++;
                pos = os_strrchr(value, '"');
                if (pos == NULL || pos[1] != '\0')
                        return NULL;
-               *pos = '\0';
-               *len = os_strlen(value);
-               return os_strdup(value);
+               *len = pos - value;
+               str = os_malloc(*len + 1);
+               if (str == NULL)
+                       return NULL;
+               os_memcpy(str, value, *len);
+               str[*len] = '\0';
+               return str;
        } else {
                u8 *str;
                size_t tlen, hlen = os_strlen(value);
@@ -515,6 +520,10 @@ static int wpa_config_parse_key_mgmt(const struct parse_data *data,
                else if (os_strcmp(start, "WPA-EAP-SHA256") == 0)
                        val |= WPA_KEY_MGMT_IEEE8021X_SHA256;
 #endif /* CONFIG_IEEE80211W */
+#ifdef CONFIG_WPS
+               else if (os_strcmp(start, "WPS") == 0)
+                       val |= WPA_KEY_MGMT_WPS;
+#endif /* CONFIG_WPS */
                else {
                        wpa_printf(MSG_ERROR, "Line %d: invalid key_mgmt '%s'",
                                   line, start);
@@ -621,6 +630,12 @@ static char * wpa_config_write_key_mgmt(const struct parse_data *data,
                                   pos == buf ? "" : " ");
 #endif /* CONFIG_IEEE80211W */
 
+#ifdef CONFIG_WPS
+       if (ssid->key_mgmt & WPA_KEY_MGMT_WPS)
+               pos += os_snprintf(pos, end - pos, "%sWPS",
+                                  pos == buf ? "" : " ");
+#endif /* CONFIG_WPS */
+
        return buf;
 }
 #endif /* NO_CONFIG_WRITE */