int
rs_context_read_config(struct rs_context *ctx, const char *config_file)
{
- /* FIXME: Missing some error handling! */
-
cfg_t *cfg, *cfg_realm, *cfg_server;
int i, j;
const char *s;
};
cfg = cfg_init (opts, CFGF_NONE);
+ if (cfg == NULL)
+ return rs_err_ctx_push (ctx, RSE_CONFIG, "unable to initialize libconfuse");
if (cfg_parse (cfg, config_file) == CFG_PARSE_ERROR)
return rs_err_ctx_push (ctx, RSE_CONFIG, "%s: invalid configuration file",
config_file);
p->realm = r;
cfg_server = cfg_getnsec (cfg_realm, "server", j);
+ /* FIXME: Handle resolve errors, possibly by postponing name
+ resolution. */
rs_resolv (&p->addr, r->type, cfg_getstr (cfg_server, "hostname"),
cfg_getstr (cfg_server, "service"));
p->secret = cfg_getstr (cfg_server, "secret");
char *fn = NULL;
if (dict == NULL)
- if (ctx->config != NULL)
+ if (ctx->config != NULL && ctx->config->dictionary)
dict = ctx->config->dictionary;
if (dict == NULL)
if (dict_init (dirname (dir), basename (fn)) < 0)
{
- r = rs_err_ctx_push_fl (ctx, RSE_FR, __FILE__, __LINE__, "dict_init");
+ r = rs_err_ctx_push_fl (ctx, RSE_FR, __FILE__, __LINE__,
+ "failing dict_init(\"%s\")", dict);
goto out;
}