summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKozlov Dmitry <xeb@mail.ru>2012-07-19 19:07:42 +0400
committerKozlov Dmitry <xeb@mail.ru>2012-07-19 19:07:42 +0400
commit09b155588131d8ed6f380aec467d0fa7749933b8 (patch)
treeaa31d14ac81cc6b653daa7fdfac296bfa5a9f69e
parentca1779b61f9a1f8390d964bf9d76c0f12caa25ed (diff)
downloadaccel-ppp-09b155588131d8ed6f380aec467d0fa7749933b8.tar.gz
accel-ppp-09b155588131d8ed6f380aec467d0fa7749933b8.zip
radius: multiple disctionary options support
-rw-r--r--accel-pppd/radius/dict.c15
-rw-r--r--accel-pppd/radius/radius.c20
2 files changed, 22 insertions, 13 deletions
diff --git a/accel-pppd/radius/dict.c b/accel-pppd/radius/dict.c
index 146d1c1..32af344 100644
--- a/accel-pppd/radius/dict.c
+++ b/accel-pppd/radius/dict.c
@@ -206,7 +206,7 @@ static int dict_load(const char *fname)
return 0;
out_err_syntax:
- log_emerg("radius:%s:%i: syntaxis error\n", fname, n);
+ log_emerg("radius:%s:%i: syntax error\n", fname, n);
out_err:
fclose(f);
return -1;
@@ -216,13 +216,16 @@ int rad_dict_load(const char *fname)
{
int r = -1;
- dict = malloc(sizeof(*dict));
if (!dict) {
- log_emerg("radius: out of memory\n");
- return -1;
+ dict = malloc(sizeof(*dict));
+
+ if (!dict) {
+ log_emerg("radius: out of memory\n");
+ return -1;
+ }
+ INIT_LIST_HEAD(&dict->items);
+ INIT_LIST_HEAD(&dict->vendors);
}
- INIT_LIST_HEAD(&dict->items);
- INIT_LIST_HEAD(&dict->vendors);
path = _malloc(PATH_MAX);
if (!path) {
diff --git a/accel-pppd/radius/radius.c b/accel-pppd/radius/radius.c
index 82ac979..048f736 100644
--- a/accel-pppd/radius/radius.c
+++ b/accel-pppd/radius/radius.c
@@ -567,20 +567,26 @@ static int load_config(void)
static void radius_init(void)
{
- char *opt;
- char *dict = DICTIONARY;
+ const char *dict = NULL;
+ struct conf_sect_t *s = conf_get_section("radius");
+ struct conf_option_t *opt1;
rpd_pool = mempool_create(sizeof(struct radius_pd_t));
if (load_config())
_exit(EXIT_FAILURE);
- opt = conf_get_opt("radius", "dictionary");
- if (opt)
- dict = opt;
+
+ list_for_each_entry(opt1, &s->items, entry) {
+ if (strcmp(opt1->name, "dictionary") || !opt1->val)
+ continue;
+ dict = opt1->val;
+ if (rad_dict_load(dict))
+ _exit(0);
+ }
- if (rad_dict_load(dict))
- _exit(EXIT_FAILURE);
+ if (!dict && rad_dict_load(DICTIONARY))
+ _exit(0);
pwdb_register(&pwdb);
ipdb_register(&ipdb);