Skip to content

Commit

Permalink
Fix client_add for virtual servers.
Browse files Browse the repository at this point in the history
If there's a "listen" section, the clients are added to that
virtual server.

If there's no "listen" section in this virtual server, the
clients are added to the global list.
  • Loading branch information
alandekok authored and arr2036 committed May 1, 2015
1 parent 72de103 commit 9ce4c88
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/client.c
Expand Up @@ -231,13 +231,21 @@ bool client_add(RADCLIENT_LIST *clients, RADCLIENT *client)
if (!clients) {
if (client->server != NULL) {
CONF_SECTION *cs;
CONF_SECTION *listen;

cs = cf_section_sub_find_name2(main_config.config, "server", client->server);
if (!cs) {
ERROR("Failed to find virtual server %s", client->server);
return false;
}

/*
* If this server has no "listen" section, add the clients
* to the global client list.
*/
listen = cf_section_sub_find(cs, "listen");
if (!listen) goto global_clients;

/*
* If the client list already exists, use that.
* Otherwise, create a new client list.
Expand All @@ -258,6 +266,7 @@ bool client_add(RADCLIENT_LIST *clients, RADCLIENT *client)
}

} else {
global_clients:
/*
* Initialize the global list, if not done already.
*/
Expand Down

0 comments on commit 9ce4c88

Please sign in to comment.