Skip to content

Commit

Permalink
virtual servers cannot be empty
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Jan 1, 2018
1 parent 6cb2027 commit 73b620d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/modules/proto_radius/proto_radius.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ static int mod_instantiate(void *instance, CONF_SECTION *conf)
* @todo - this loop is run on the virtual server for
* every "listen" section in it. Which isn't efficient.
*/
i = 0;
for (ci = cf_item_next(server, NULL);
ci != NULL;
ci = cf_item_next(server, ci)) {
Expand All @@ -477,6 +478,8 @@ static int mod_instantiate(void *instance, CONF_SECTION *conf)
continue;
}

i++;

/*
* Skip a section if it was already compiled.
*/
Expand Down Expand Up @@ -518,6 +521,14 @@ static int mod_instantiate(void *instance, CONF_SECTION *conf)
}
}

/*
* No 'recv' or 'send' sections. That's an error.
*/
if (!i) {
cf_log_err(server, "Virtual servers cannot be empty.");
return -1;
}

/*
* Instantiate the process modules
*/
Expand Down

0 comments on commit 73b620d

Please sign in to comment.