Fix wpa_config_read() with existing config block
If two config files are merged together, the ssid and cred blocks may not have been processed correctly since the tail pointers were not updated to the last entry from the first configuration file. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
27b418715f
commit
b89962b4b9
1 changed files with 8 additions and 4 deletions
|
@ -352,8 +352,8 @@ struct wpa_config * wpa_config_read(const char *name, struct wpa_config *cfgp)
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char buf[512], *pos;
|
char buf[512], *pos;
|
||||||
int errors = 0, line = 0;
|
int errors = 0, line = 0;
|
||||||
struct wpa_ssid *ssid, *tail = NULL, *head = NULL;
|
struct wpa_ssid *ssid, *tail, *head;
|
||||||
struct wpa_cred *cred, *cred_tail = NULL, *cred_head = NULL;
|
struct wpa_cred *cred, *cred_tail, *cred_head;
|
||||||
struct wpa_config *config;
|
struct wpa_config *config;
|
||||||
int id = 0;
|
int id = 0;
|
||||||
int cred_id = 0;
|
int cred_id = 0;
|
||||||
|
@ -369,8 +369,12 @@ struct wpa_config * wpa_config_read(const char *name, struct wpa_config *cfgp)
|
||||||
"structure");
|
"structure");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
head = config->ssid;
|
tail = head = config->ssid;
|
||||||
cred_head = config->cred;
|
while (tail && tail->next)
|
||||||
|
tail = tail->next;
|
||||||
|
cred_tail = cred_head = config->cred;
|
||||||
|
while (cred_tail && cred_tail->next)
|
||||||
|
cred_tail = cred_tail->next;
|
||||||
|
|
||||||
wpa_printf(MSG_DEBUG, "Reading configuration file '%s'", name);
|
wpa_printf(MSG_DEBUG, "Reading configuration file '%s'", name);
|
||||||
f = fopen(name, "r");
|
f = fopen(name, "r");
|
||||||
|
|
Loading…
Reference in a new issue