{ NULL, -1, 0, NULL, NULL } /* end the list */
};
-
-static int checkval_detach(void *instance)
-{
- free(instance);
- return 0;
-}
-
/*
* Do any per-module initialization that is separate to each
* configured instance of the module. e.g. set up connections
/*
* Set up a storage area for instance data
*/
- inst = rad_malloc(sizeof(*inst));
+ *instance = inst = talloc_zero(conf, rlm_checkval_t);
if (!inst) {
return -1;
}
- memset(inst, 0, sizeof(*inst));
/*
* If the configuration parameters can't be parsed, then
* fail.
*/
if (cf_section_parse(conf, inst, module_config) < 0) {
- checkval_detach(inst);
return -1;
}
*/
if (!inst->data_type || !*inst->data_type){
radlog(L_ERR, "rlm_checkval: Data type not defined");
- checkval_detach(inst);
return -1;
}
if (!inst->item_name || !*inst->item_name){
radlog(L_ERR, "rlm_checkval: Item name not defined");
- checkval_detach(inst);
return -1;
}
if (!inst->check_name || !*inst->check_name){
radlog(L_ERR, "rlm_checkval: Check item name not defined");
- checkval_detach(inst);
return -1;
}
if (!da) {
radlog(L_ERR, "rlm_checkval: No such attribute %s",
inst->item_name);
- checkval_detach(inst);
return -1;
}
inst->item = da;
if (!da){
radlog(L_ERR, "rlm_checkval: No such attribute %s",
inst->check_name);
- checkval_detach(inst);
return -1;
}
inst->check = da;
if (!inst->type) {
radlog(L_ERR, "rlm_checkval: Data type %s in not known",
inst->data_type);
- checkval_detach(inst);
return -1;
}
- *instance = inst;
-
return 0;
}
module_t rlm_checkval = {
RLM_MODULE_INIT,
"checkval",
- 0, /* type */
+ 0, /* type */
checkval_instantiate, /* instantiation */
- checkval_detach, /* detach */
+ NULL, /* detach */
{
NULL, /* authentication */
checkval_authorize, /* authorization */