Added an option to add (or override) Credential attribute(s) in M8
[wpasupplicant] / hostapd / config.c
index e578c7f..dbdee76 100644 (file)
@@ -34,6 +34,7 @@
 extern struct wpa_driver_ops *hostapd_drivers[];
 
 
+#ifndef CONFIG_NO_VLAN
 static int hostapd_config_read_vlan_file(struct hostapd_bss_config *bss,
                                         const char *fname)
 {
@@ -113,6 +114,7 @@ static int hostapd_config_read_vlan_file(struct hostapd_bss_config *bss,
 
        return 0;
 }
+#endif /* CONFIG_NO_VLAN */
 
 
 static void hostapd_config_free_vlan(struct hostapd_bss_config *bss)
@@ -1518,8 +1520,9 @@ struct hostapd_config * hostapd_config_read(const char *fname)
                } else if (os_strcmp(buf, "deny_mac_file") == 0) {
                        if (hostapd_config_read_maclist(pos, &bss->deny_mac,
                                                        &bss->num_deny_mac)) {
-                               wpa_printf(MSG_ERROR "Line %d: Failed to read "
-                                          "deny_mac_file '%s'", line, pos);
+                               wpa_printf(MSG_ERROR, "Line %d: Failed to "
+                                          "read deny_mac_file '%s'",
+                                          line, pos);
                                errors++;
                        }
                } else if (os_strcmp(buf, "ap_max_inactivity") == 0) {
@@ -1900,6 +1903,7 @@ struct hostapd_config * hostapd_config_read(const char *fname)
                } else if (os_strcmp(buf, "pmk_r1_push") == 0) {
                        bss->pmk_r1_push = atoi(pos);
 #endif /* CONFIG_IEEE80211R */
+#ifndef CONFIG_NO_CTRL_IFACE
                } else if (os_strcmp(buf, "ctrl_interface") == 0) {
                        os_free(bss->ctrl_interface);
                        bss->ctrl_interface = os_strdup(pos);
@@ -1931,6 +1935,7 @@ struct hostapd_config * hostapd_config_read(const char *fname)
                        wpa_printf(MSG_DEBUG, "ctrl_interface_group=%d",
                                   bss->ctrl_interface_gid);
 #endif /* CONFIG_NATIVE_WINDOWS */
+#endif /* CONFIG_NO_CTRL_IFACE */
 #ifdef RADIUS_SERVER
                } else if (os_strcmp(buf, "radius_server_clients") == 0) {
                        os_free(bss->radius_server_clients);
@@ -2046,6 +2051,7 @@ struct hostapd_config * hostapd_config_read(const char *fname)
                                           "key '%s'", line, buf);
                                errors++;
                        }
+#ifndef CONFIG_NO_VLAN
                } else if (os_strcmp(buf, "dynamic_vlan") == 0) {
                        bss->ssid.dynamic_vlan = atoi(pos);
                } else if (os_strcmp(buf, "vlan_file") == 0) {
@@ -2058,6 +2064,7 @@ struct hostapd_config * hostapd_config_read(const char *fname)
                } else if (os_strcmp(buf, "vlan_tagged_interface") == 0) {
                        bss->ssid.vlan_tagged_interface = os_strdup(pos);
 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
+#endif /* CONFIG_NO_VLAN */
                } else if (os_strcmp(buf, "passive_scan_interval") == 0) {
                        conf->passive_scan_interval = atoi(pos);
                } else if (os_strcmp(buf, "passive_scan_listen") == 0) {
@@ -2151,6 +2158,7 @@ struct hostapd_config * hostapd_config_read(const char *fname)
                                errors++;
                        }
                } else if (os_strcmp(buf, "wps_pin_requests") == 0) {
+                       os_free(bss->wps_pin_requests);
                        bss->wps_pin_requests = os_strdup(pos);
                } else if (os_strcmp(buf, "device_name") == 0) {
                        if (os_strlen(pos) > 32) {
@@ -2158,6 +2166,7 @@ struct hostapd_config * hostapd_config_read(const char *fname)
                                           "device_name", line);
                                errors++;
                        }
+                       os_free(bss->device_name);
                        bss->device_name = os_strdup(pos);
                } else if (os_strcmp(buf, "manufacturer") == 0) {
                        if (os_strlen(pos) > 64) {
@@ -2165,6 +2174,7 @@ struct hostapd_config * hostapd_config_read(const char *fname)
                                           "manufacturer", line);
                                errors++;
                        }
+                       os_free(bss->manufacturer);
                        bss->manufacturer = os_strdup(pos);
                } else if (os_strcmp(buf, "model_name") == 0) {
                        if (os_strlen(pos) > 32) {
@@ -2172,6 +2182,7 @@ struct hostapd_config * hostapd_config_read(const char *fname)
                                           "model_name", line);
                                errors++;
                        }
+                       os_free(bss->model_name);
                        bss->model_name = os_strdup(pos);
                } else if (os_strcmp(buf, "model_number") == 0) {
                        if (os_strlen(pos) > 32) {
@@ -2179,6 +2190,7 @@ struct hostapd_config * hostapd_config_read(const char *fname)
                                           "model_number", line);
                                errors++;
                        }
+                       os_free(bss->model_number);
                        bss->model_number = os_strdup(pos);
                } else if (os_strcmp(buf, "serial_number") == 0) {
                        if (os_strlen(pos) > 32) {
@@ -2186,10 +2198,13 @@ struct hostapd_config * hostapd_config_read(const char *fname)
                                           "serial_number", line);
                                errors++;
                        }
+                       os_free(bss->serial_number);
                        bss->serial_number = os_strdup(pos);
                } else if (os_strcmp(buf, "device_type") == 0) {
+                       os_free(bss->device_type);
                        bss->device_type = os_strdup(pos);
                } else if (os_strcmp(buf, "config_methods") == 0) {
+                       os_free(bss->config_methods);
                        bss->config_methods = os_strdup(pos);
                } else if (os_strcmp(buf, "os_version") == 0) {
                        if (hexstr2bin(pos, bss->os_version, 4)) {
@@ -2198,7 +2213,20 @@ struct hostapd_config * hostapd_config_read(const char *fname)
                                errors++;
                        }
                } else if (os_strcmp(buf, "ap_pin") == 0) {
+                       os_free(bss->ap_pin);
                        bss->ap_pin = os_strdup(pos);
+               } else if (os_strcmp(buf, "skip_cred_build") == 0) {
+                       bss->skip_cred_build = atoi(pos);
+               } else if (os_strcmp(buf, "extra_cred") == 0) {
+                       os_free(bss->extra_cred);
+                       bss->extra_cred =
+                               (u8 *) os_readfile(pos, &bss->extra_cred_len);
+                       if (bss->extra_cred == NULL) {
+                               wpa_printf(MSG_ERROR, "Line %d: could not "
+                                          "read Credentials from '%s'",
+                                          line, pos);
+                               errors++;
+                       }
 #endif /* CONFIG_WPS */
                } else {
                        wpa_printf(MSG_ERROR, "Line %d: unknown configuration "