Skip to content

Commit

Permalink
Move checks for virtual_server to listen_parse()
Browse files Browse the repository at this point in the history
Which is better than scattering them through the code.
  • Loading branch information
alandekok committed Jun 27, 2014
1 parent de7fd41 commit 0022bf3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 24 deletions.
10 changes: 10 additions & 0 deletions src/main/listen.c
Expand Up @@ -2748,6 +2748,7 @@ static rad_listen_t *listen_parse(CONF_SECTION *cs, char const *server)
CONF_PAIR *cp;
char const *value;
lt_dlhandle handle;
CONF_SECTION *server_cs;
char buffer[32];

cp = cf_pair_find(cs, "type");
Expand Down Expand Up @@ -2862,6 +2863,15 @@ static rad_listen_t *listen_parse(CONF_SECTION *cs, char const *server)
return NULL;
}


server_cs = cf_section_sub_find_name2(main_config.config, "server",
this->server);
if (!server_cs) {
cf_log_err_cs(cs, "No such server \"%s\"", this->server);
listen_free(&this);
return NULL;
}

cf_log_info(cs, "}");

return this;
Expand Down
24 changes: 0 additions & 24 deletions src/main/modules.c
Expand Up @@ -1547,7 +1547,6 @@ int modules_init(CONF_SECTION *config)
{
CONF_ITEM *ci, *next;
CONF_SECTION *cs, *modules;
rad_listen_t *listener;

/*
* Set up the internal module struct.
Expand Down Expand Up @@ -1746,29 +1745,6 @@ int modules_init(CONF_SECTION *config)
}
cf_log_info(cs, " } # modules");

/*
* Loop over the listeners, figuring out which sections
* to load.
*/
for (listener = main_config.listen;
listener != NULL;
listener = listener->next) {
char buffer[256];

#ifdef WITH_PROXY
if (listener->type == RAD_LISTEN_PROXY) continue;
#endif

cs = cf_section_sub_find_name2(config,
"server", listener->server);
if (!cs && (listener->server != NULL)) {
listener->print(listener, buffer, sizeof(buffer));

ERROR("No server has been defined for %s", buffer);
return -1;
}
}

if (virtual_servers_load(config) < 0) return -1;

return 0;
Expand Down

0 comments on commit 0022bf3

Please sign in to comment.