/* * This program is is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2 if the * License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ /** * $Id: cfd227eb73e6afd0e88f1962f2951772623028a4 $ * @file rlm_rest.c * @brief Integrate FreeRADIUS with RESTfull APIs * * @copyright 2012-2014 Arran Cudbard-Bell */ RCSID("$Id: cfd227eb73e6afd0e88f1962f2951772623028a4 $") #include #include #include #include #include /* * Structure for module configuration */ typedef struct rlm_lrs_t { char const *xlat_name; //!< Instance name. int delay; } rlm_lrs_t; static const CONF_PARSER module_config[] = { { NULL, -1, 0, NULL, NULL } }; /* * Check user info from Erable with the given password. */ static rlm_rcode_t CC_HINT(nonnull) execute(void *instance, UNUSED REQUEST *request) { usleep(100000); return RLM_MODULE_OK; } /* * Do any per-module initialization that is separate to each * configured instance of the module. e.g. set up connections * to external databases, read configuration files, set up * dictionary entries, etc. * * If configuration information is given in the config section * that must be referenced in later calls, store a handle to it * in *instance otherwise put a null pointer there. */ static int mod_instantiate(CONF_SECTION *conf, void *instance) { return 0; } /* * Only free memory we allocated. The strings allocated via * cf_section_parse() do not need to be freed. */ static int mod_detach(void *instance) { return 0; } /* * The module name should be the only globally exported symbol. * That is, everything else should be 'static'. * * If the module needs to temporarily modify it's instantiation * data, the type should be changed to RLM_TYPE_THREAD_UNSAFE. * The server will then take care of ensuring that the module * is single-threaded. */ module_t rlm_lrs = { RLM_MODULE_INIT, "rlm_lrs", RLM_TYPE_THREAD_SAFE, /* type */ sizeof(rlm_lrs_t), module_config, mod_instantiate, /* instantiation */ mod_detach, /* detach */ { NULL, /* authentication */ NULL, /* authorization */ NULL, /* preaccounting */ NULL, /* accounting */ NULL, /* checksimul */ execute, /* pre-proxy */ execute, /* post-proxy */ NULL, /* post-auth */ }, };