diff options
author | Kozlov Dmitry <xeb@mail.ru> | 2012-07-19 19:07:42 +0400 |
---|---|---|
committer | Kozlov Dmitry <xeb@mail.ru> | 2012-07-19 19:07:42 +0400 |
commit | 09b155588131d8ed6f380aec467d0fa7749933b8 (patch) | |
tree | aa31d14ac81cc6b653daa7fdfac296bfa5a9f69e /accel-pppd/radius | |
parent | ca1779b61f9a1f8390d964bf9d76c0f12caa25ed (diff) | |
download | accel-ppp-09b155588131d8ed6f380aec467d0fa7749933b8.tar.gz accel-ppp-09b155588131d8ed6f380aec467d0fa7749933b8.zip |
radius: multiple disctionary options support
Diffstat (limited to 'accel-pppd/radius')
-rw-r--r-- | accel-pppd/radius/dict.c | 15 | ||||
-rw-r--r-- | accel-pppd/radius/radius.c | 20 |
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); |