};
-static int linelog_detach(void *instance)
-{
- rlm_linelog_t *inst = instance;
-
- free(inst);
- return 0;
-}
-
/*
* Instantiate the module.
*/
/*
* Set up a storage area for instance data
*/
- inst = rad_malloc(sizeof(*inst));
- memset(inst, 0, sizeof(*inst));
+ *instance = inst = talloc_zero(conf, rlm_linelog_t);
+ if (!inst) return -1;
/*
* If the configuration parameters can't be parsed, then
* fail.
*/
if (cf_section_parse(conf, inst, module_config) < 0) {
- linelog_detach(inst);
return -1;
}
if (!inst->filename) {
radlog(L_ERR, "rlm_linelog: Must specify an output filename");
- linelog_detach(inst);
return -1;
}
#ifndef HAVE_SYSLOG_H
if (strcmp(inst->filename, "syslog") == 0) {
radlog(L_ERR, "rlm_linelog: Syslog output is not supported");
- linelog_detach(inst);
return -1;
}
#else
inst->facility = fr_str2int(syslog_str2fac, inst->syslog_facility, -1);
if (inst->facility < 0) {
radlog(L_ERR, "rlm_linelog: Bad syslog facility '%s'", inst->syslog_facility);
- linelog_detach(inst);
return -1;
}
}
if (!inst->line) {
radlog(L_ERR, "rlm_linelog: Must specify a log format");
- linelog_detach(inst);
return -1;
}
inst->cs = conf;
- *instance = inst;
-
return 0;
}
"linelog",
RLM_TYPE_CHECK_CONFIG_SAFE, /* type */
linelog_instantiate, /* instantiation */
- linelog_detach, /* detach */
+ NULL, /* detach */
{
do_linelog, /* authentication */
do_linelog, /* authorization */