aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2011-02-10 20:12:29 (GMT)
committerJouni Malinen <j@w1.fi>2011-02-10 20:12:29 (GMT)
commite3e52e364ef86ed09d6caa5d0c327c88395f9968 (patch)
tree6f9e0a56acb413393eb95bdc1999815e5ce2ff92 /src
parent810f08bab4a891b45c24746cbc335356c566b377 (diff)
downloadhostap-e3e52e364ef86ed09d6caa5d0c327c88395f9968.zip
hostap-e3e52e364ef86ed09d6caa5d0c327c88395f9968.tar.gz
hostap-e3e52e364ef86ed09d6caa5d0c327c88395f9968.tar.bz2
hostapd: Fix RADIUS client configuration update on reconfig
The internal pointer to RADIUS client configuration needs to be updated whenever a new hostapd configuration is loaded. Without this, freed memory may be dereferenced and this can result in segmentation faults.
Diffstat (limited to 'src')
-rw-r--r--src/ap/hostapd.c13
-rw-r--r--src/radius/radius_client.c8
-rw-r--r--src/radius/radius_client.h2
3 files changed, 19 insertions, 4 deletions
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 3f2888a..343c388 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -46,6 +46,10 @@ extern int wpa_debug_level;
static void hostapd_reload_bss(struct hostapd_data *hapd)
{
+#ifndef CONFIG_NO_RADIUS
+ radius_client_reconfig(hapd->radius, hapd->conf->radius);
+#endif /* CONFIG_NO_RADIUS */
+
if (hostapd_setup_wpa_psk(hapd->conf)) {
wpa_printf(MSG_ERROR, "Failed to re-configure WPA PSK "
"after reloading configuration");
@@ -103,14 +107,15 @@ int hostapd_reload_config(struct hostapd_iface *iface)
* Deauthenticate all stations since the new configuration may not
* allow them to use the BSS anymore.
*/
- for (j = 0; j < iface->num_bss; j++)
+ for (j = 0; j < iface->num_bss; j++) {
hostapd_flush_old_stations(iface->bss[j]);
#ifndef CONFIG_NO_RADIUS
- /* TODO: update dynamic data based on changed configuration
- * items (e.g., open/close sockets, etc.) */
- radius_client_flush(hapd->radius, 0);
+ /* TODO: update dynamic data based on changed configuration
+ * items (e.g., open/close sockets, etc.) */
+ radius_client_flush(iface->bss[j]->radius, 0);
#endif /* CONFIG_NO_RADIUS */
+ }
oldconf = hapd->iconf;
iface->conf = newconf;
diff --git a/src/radius/radius_client.c b/src/radius/radius_client.c
index 171af29..691f77a 100644
--- a/src/radius/radius_client.c
+++ b/src/radius/radius_client.c
@@ -1489,3 +1489,11 @@ int radius_client_get_mib(struct radius_client_data *radius, char *buf,
return count;
}
+
+
+void radius_client_reconfig(struct radius_client_data *radius,
+ struct hostapd_radius_servers *conf)
+{
+ if (radius)
+ radius->conf = conf;
+}
diff --git a/src/radius/radius_client.h b/src/radius/radius_client.h
index 644ea23..18e7290 100644
--- a/src/radius/radius_client.h
+++ b/src/radius/radius_client.h
@@ -259,5 +259,7 @@ void radius_client_flush_auth(struct radius_client_data *radius,
const u8 *addr);
int radius_client_get_mib(struct radius_client_data *radius, char *buf,
size_t buflen);
+void radius_client_reconfig(struct radius_client_data *radius,
+ struct hostapd_radius_servers *conf);
#endif /* RADIUS_CLIENT_H */