summaryrefslogtreecommitdiff
path: root/lib/conf.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/conf.c')
-rw-r--r--lib/conf.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/conf.c b/lib/conf.c
index c8b2a46..0f00fd8 100644
--- a/lib/conf.c
+++ b/lib/conf.c
@@ -1,4 +1,5 @@
-/* See the file COPYING for licensing information. */
+/* Copyright 2010, 2011 NORDUnet A/S. All rights reserved.
+ See the file COPYING for licensing information. */
#if defined HAVE_CONFIG_H
#include <config.h>
@@ -8,6 +9,7 @@
#include <string.h>
#include <radsec/radsec.h>
#include <radsec/radsec-impl.h>
+#include "peer.h"
#include "debug.h"
#if 0
@@ -40,15 +42,15 @@ rs_context_read_config(struct rs_context *ctx, const char *config_file)
cfg_opt_t server_opts[] =
{
CFG_STR ("hostname", NULL, CFGF_NONE),
- CFG_STR ("service", "radius", CFGF_NONE),
- CFG_STR ("secret", NULL, CFGF_NONE),
+ CFG_STR ("service", "2083", CFGF_NONE),
+ CFG_STR ("secret", "radsec", CFGF_NONE),
CFG_END ()
};
cfg_opt_t config_opts[] =
{
CFG_STR ("type", "UDP", CFGF_NONE),
- CFG_INT ("timeout", 2, CFGF_NONE),
- CFG_INT ("retries", 2, CFGF_NONE),
+ CFG_INT ("timeout", 2, CFGF_NONE), /* FIXME: Remove? */
+ CFG_INT ("retries", 2, CFGF_NONE), /* FIXME: Remove? */
CFG_STR ("cacertfile", NULL, CFGF_NONE),
/*CFG_STR ("cacertpath", NULL, CFGF_NONE),*/
CFG_STR ("certfile", NULL, CFGF_NONE),
@@ -87,6 +89,8 @@ rs_context_read_config(struct rs_context *ctx, const char *config_file)
return rs_err_ctx_push_fl (ctx, RSE_CONFIG, __FILE__, __LINE__,
"missing config name");
r->name = strdup (s);
+ if (!r->name)
+ return rs_err_ctx_push_fl (ctx, RSE_NOMEM, __FILE__, __LINE__, NULL);
typestr = cfg_getstr (cfg_config, "type");
if (!strcmp (typestr, "UDP"))
@@ -111,15 +115,15 @@ rs_context_read_config(struct rs_context *ctx, const char *config_file)
/* Add peers, one per server stanza. */
for (j = 0; j < cfg_size (cfg_config, "server"); j++)
{
- struct rs_peer *p = _rs_peer_create (ctx, &r->peers);
+ struct rs_peer *p = peer_create (ctx, &r->peers);
if (!p)
return rs_err_ctx_push_fl (ctx, RSE_NOMEM, __FILE__, __LINE__,
NULL);
p->realm = r;
cfg_server = cfg_getnsec (cfg_config, "server", j);
- _rs_resolv (&p->addr, r->type, cfg_getstr (cfg_server, "hostname"),
- cfg_getstr (cfg_server, "service"));
+ rs_resolv (&p->addr, r->type, cfg_getstr (cfg_server, "hostname"),
+ cfg_getstr (cfg_server, "service"));
p->secret = cfg_getstr (cfg_server, "secret");
}
}