blob: 3c62bf670f5bc59fdcc60cc05ed75aa3d1843979 [file] [log] [blame]
developer2a209692023-08-14 20:23:42 +08001--- a/hostapd/config_file.c
2+++ b/hostapd/config_file.c
developere35b8e42023-10-16 11:04:00 +08003@@ -4816,7 +4816,12 @@ struct hostapd_config * hostapd_config_r
developer2a209692023-08-14 20:23:42 +08004 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));