]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Fix RADIUS client configuration update on reconfig
authorJouni Malinen <jouni.malinen@atheros.com>
Thu, 10 Feb 2011 20:12:29 +0000 (22:12 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 10 Feb 2011 20:12:29 +0000 (22:12 +0200)
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.

src/ap/hostapd.c
src/radius/radius_client.c
src/radius/radius_client.h

index 3f2888a34749cdff52aafe77533765a0c6a45afd..343c388730ff02dae9592d7808c785a27d70c219 100644 (file)
@@ -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;
index 171af2927b0fb903ecf0156784ab2f5b58ad66ed..691f77a5e53e8c07a9da58470a196b0fc598417f 100644 (file)
@@ -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;
+}
index 644ea234fd253c480ee913a81fc8a0b703163dea..18e729041b30d653ffe7b334df8cbfd825520cf8 100644 (file)
@@ -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 */