developer | 2a20969 | 2023-08-14 20:23:42 +0800 | [diff] [blame] | 1 | --- a/hostapd/config_file.c |
| 2 | +++ b/hostapd/config_file.c |
developer | e35b8e4 | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 3 | @@ -4816,7 +4816,12 @@ struct hostapd_config * hostapd_config_r |
developer | 2a20969 | 2023-08-14 20:23:42 +0800 | [diff] [blame] | 4 | int errors = 0; |
| 5 | size_t i; |
| 6 | |
| 7 | - f = fopen(fname, "r"); |
| 8 | + if (!strncmp(fname, "data:", 5)) { |
| 9 | + f = fmemopen((void *)(fname + 5), strlen(fname + 5), "r"); |
| 10 | + fname = "<inline>"; |
| 11 | + } else { |
| 12 | + f = fopen(fname, "r"); |
| 13 | + } |
| 14 | if (f == NULL) { |
| 15 | wpa_printf(MSG_ERROR, "Could not open configuration file '%s' " |
| 16 | "for reading.", fname); |
| 17 | --- a/wpa_supplicant/config_file.c |
| 18 | +++ b/wpa_supplicant/config_file.c |
| 19 | @@ -326,8 +326,13 @@ struct wpa_config * wpa_config_read(cons |
| 20 | while (cred_tail && cred_tail->next) |
| 21 | cred_tail = cred_tail->next; |
| 22 | |
| 23 | + if (!strncmp(name, "data:", 5)) { |
| 24 | + f = fmemopen((void *)(name + 5), strlen(name + 5), "r"); |
| 25 | + name = "<inline>"; |
| 26 | + } else { |
| 27 | + f = fopen(name, "r"); |
| 28 | + } |
| 29 | wpa_printf(MSG_DEBUG, "Reading configuration file '%s'", name); |
| 30 | - f = fopen(name, "r"); |
| 31 | if (f == NULL) { |
| 32 | wpa_printf(MSG_ERROR, "Failed to open config file '%s', " |
| 33 | "error: %s", name, strerror(errno)); |