static int logintime_detach(void *instance) { paircompare_unregister(PW_CURRENT_TIME, timecmp); paircompare_unregister(PW_TIME_OF_DAY, time_of_day); free(instance); return 0; }
static int rlm_sql_detach(void *instance) { rlm_sql_t *inst = instance; paircompare_unregister(PW_SQL_GROUP, sql_groupcmp); if (inst->config) { if (inst->pool) sql_poolfree(inst); if (inst->config->xlat_name) { xlat_unregister(inst->config->xlat_name, sql_xlat, instance); } } if (inst->handle) { #if 0 /* * FIXME: Call the modules 'destroy' function? */ lt_dlclose(inst->handle); /* ignore any errors */ #endif } return 0; }
static int sqlcounter_detach(void *instance) { int i; char **p; rlm_sqlcounter_t *inst = (rlm_sqlcounter_t *)instance; paircompare_unregister(inst->dict_attr->attr, sqlcounter_cmp); /* * Free up dynamically allocated string pointers. */ for (i = 0; module_config[i].name != NULL; i++) { if (module_config[i].type != PW_TYPE_STRING_PTR) { continue; } /* * Treat 'config' as an opaque array of bytes, * and take the offset into it. There's a * (char*) pointer at that offset, and we want * to point to it. */ p = (char **) (((char *)inst) + module_config[i].offset); if (!*p) { /* nothing allocated */ continue; } free(*p); *p = NULL; } free(inst); return 0; }
static int rlm_sql_detach(void *instance) { SQL_INST *inst = instance; paircompare_unregister(PW_SQL_GROUP, sql_groupcmp); if (inst->config) { int i; if (inst->pool) sql_poolfree(inst); if (inst->config->xlat_name) { xlat_unregister(inst->config->xlat_name,(RAD_XLAT_FUNC)sql_xlat, instance); free(inst->config->xlat_name); } /* * Free up dynamically allocated string pointers. */ for (i = 0; module_config[i].name != NULL; i++) { char **p; if (module_config[i].type != PW_TYPE_STRING_PTR) { continue; } /* * Treat 'config' as an opaque array of bytes, * and take the offset into it. There's a * (char*) pointer at that offset, and we want * to point to it. */ p = (char **) (((char *)inst->config) + module_config[i].offset); if (!*p) { /* nothing allocated */ continue; } free(*p); *p = NULL; } /* * Catch multiple instances of the module. */ if (allowed_chars == inst->config->allowed_chars) { allowed_chars = NULL; } free(inst->config); inst->config = NULL; } if (inst->handle) { #if 0 /* * FIXME: Call the modules 'destroy' function? */ lt_dlclose(inst->handle); /* ignore any errors */ #endif } free(inst); return 0; }
static int mod_detach(void *instance) { rlm_sqlcounter_t *inst = (rlm_sqlcounter_t *)instance; paircompare_unregister(inst->dict_attr->attr, sqlcounter_cmp); return 0; }
static int sqlcounter_detach(void *instance) { rlm_sqlcounter_t *data = (rlm_sqlcounter_t *) instance; paircompare_unregister(data->dict_attr, sqlcounter_cmp); free(data->reset); free(data->query); free(data->check_name); free(data->sqlmod_inst); free(data->counter_name); free(data->allowed_chars); allowed_chars = NULL; free(instance); return 0; }
/** * @brief Register a function as compare function. * @param attr Attribute * @param compare_attr * The attribute in the request we want to * compare with. Normally this is the same as "attr". * You can set this to: * - -1 the same as "attr" * - 0 always call compare function, not tied to request attribute * - >0 Attribute to compare with. For example, PW_GROUP in a check * item needs to be compared with PW_USER_NAME in the incoming request. * @param fun comparison function * @param instance argument to comparison function * @return 0 */ int paircompare_register(unsigned int attr, int compare_attr, RAD_COMPARE_FUNC fun, void *instance) { struct cmp *c; paircompare_unregister(attr, fun); c = rad_malloc(sizeof(struct cmp)); c->compare = fun; c->attribute = attr; c->otherattr = compare_attr; c->instance = instance; c->next = cmp; cmp = c; return 0; }
/** Register a function as compare function. * * @param attribute to register comparison function for. * @param from the attribute we want to compare with. Normally this is the same as attribute. * If null call the comparison function on every attributes in the request if first_only is false * @param first_only will decide if we loop over the request attributes or stop on the first one * @param func comparison function * @param instance argument to comparison function * @return 0 */ int paircompare_register(DICT_ATTR const *attribute, DICT_ATTR const *from, bool first_only, RAD_COMPARE_FUNC func, void *instance) { struct cmp *c; rad_assert(attribute != NULL); paircompare_unregister(attribute, func); c = rad_malloc(sizeof(struct cmp)); c->compare = func; c->attribute = attribute; c->from = from; c->first_only = first_only; c->instance = instance; c->next = cmp; cmp = c; return 0; }
static int mod_detach(UNUSED void *instance) { paircompare_unregister(PW_EXPIRATION, expirecmp); return 0; }
static int mod_detach(UNUSED void *instance) { paircompare_unregister(PW_CURRENT_TIME, timecmp); paircompare_unregister(PW_TIME_OF_DAY, time_of_day); return 0; }
static int rlm_redisn_detach(void *instance) { REDIS_INST *inst = instance; paircompare_unregister(PW_REDIS_GROUP, redisn_groupcmp); int i; if (inst->redisnpool) { redisn_poolfree(inst); } if (inst->xlat_name) { xlat_unregister(inst->xlat_name,(RAD_XLAT_FUNC)redisn_xlat, instance); free(inst->xlat_name); } /* * Free up dynamically allocated string pointers. */ for (i = 0; module_config[i].name != NULL; i++) { char **p; if (module_config[i].type != PW_TYPE_STRING_PTR) { continue; } /* * Treat 'config' as an opaque array of bytes, * and take the offset into it. There's a * (char*) pointer at that offset, and we want * to point to it. */ p = (char **) (((char *)inst) + module_config[i].offset); if (!*p) { /* nothing allocated */ continue; } free(*p); *p = NULL; } /* * Catch multiple instances of the module. */ if (allowed_chars == inst->allowed_chars) { allowed_chars = NULL; } if (inst->servers_count>0) { if (inst->server_names) { for(i=0;i<inst->servers_count;i++) { if (inst->server_names[i]) free(inst->server_names[i]); if (inst->server_passwords[i]) free(inst->server_passwords[i]); } free(inst->server_names); } if (inst->server_ports) free(inst->server_ports); if (inst->server_dbs) free(inst->server_dbs); if (inst->server_passwords) free(inst->server_passwords); if (inst->server_connect_afters) free(inst->server_connect_afters); } free(inst); return 0; }