Remove unused RADIUS client reconfig function

This is not actually used at all and it looks like the rules for
maintaining the old/new RADIUS configuration are not very clear in the
case the RADIUS client configuration did not change. Consequently, it
is better to just remove this for now and if similar functionality is
ever needed, redesign it to be easier to use without causing hard to
find issues with using freed memory.

Simpler approach to reconfiguring the RADIUS client would involve
just deinitializing the old context unconditionally and initializing
a new one whenever the configuration could have changed.
This commit is contained in:
Jouni Malinen 2009-11-28 23:04:35 +02:00
parent 5843e1c9a6
commit 93704f8f95
2 changed files with 0 additions and 66 deletions

View file

@ -1399,65 +1399,3 @@ int radius_client_get_mib(struct radius_client_data *radius, char *buf,
return count;
}
static int radius_servers_diff(struct hostapd_radius_server *nserv,
struct hostapd_radius_server *oserv,
int num)
{
int i;
for (i = 0; i < num; i++) {
if (hostapd_ip_diff(&nserv[i].addr, &oserv[i].addr) ||
nserv[i].port != oserv[i].port ||
nserv[i].shared_secret_len != oserv[i].shared_secret_len ||
os_memcmp(nserv[i].shared_secret, oserv[i].shared_secret,
nserv[i].shared_secret_len) != 0)
return 1;
}
return 0;
}
/**
* radius_client_reconfig - Reconfigure RADIUS client
* @old: RADIUS client context from radius_client_init()
* @ctx: Callback context to be used in hostapd_logger() calls
* @oldconf: Old RADIUS client configuration (RADIUS servers)
* @newconf: New RADIUS client configuration (RADIUS servers)
* Returns: Pointer to private RADIUS client context or %NULL on failure
*
* This function can be used to conditionally change RADIUS client
* configuration. If newconf differs from oldconf, the old RADIUS client
* context is deinitialized and new one is allocated. If there is no change in
* the configuration, the old RADIUS client context will be returned.
*
* The caller is responsible for keeping the new configuration data available
* for the lifetime of the RADIUS client, i.e., until radius_client_deinit() is
* called for the returned context pointer.
*/
struct radius_client_data *
radius_client_reconfig(struct radius_client_data *old, void *ctx,
struct hostapd_radius_servers *oldconf,
struct hostapd_radius_servers *newconf)
{
radius_client_flush(old, 0);
if (newconf->retry_primary_interval !=
oldconf->retry_primary_interval ||
newconf->num_auth_servers != oldconf->num_auth_servers ||
newconf->num_acct_servers != oldconf->num_acct_servers ||
radius_servers_diff(newconf->auth_servers, oldconf->auth_servers,
newconf->num_auth_servers) ||
radius_servers_diff(newconf->acct_servers, oldconf->acct_servers,
newconf->num_acct_servers)) {
hostapd_logger(ctx, NULL, HOSTAPD_MODULE_RADIUS,
HOSTAPD_LEVEL_DEBUG,
"Reconfiguring RADIUS client");
radius_client_deinit(old);
return radius_client_init(ctx, newconf);
}
return old;
}

View file

@ -267,9 +267,5 @@ void radius_client_flush_auth(struct radius_client_data *radius,
int radius_client_get_mib(struct radius_client_data *radius, char *buf,
size_t buflen);
#endif /* CONFIG_NO_RADIUS */
struct radius_client_data *
radius_client_reconfig(struct radius_client_data *old, void *ctx,
struct hostapd_radius_servers *oldconf,
struct hostapd_radius_servers *newconf);
#endif /* RADIUS_CLIENT_H */