/*
* rlm_always.c
*
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * Copyright 2000 The FreeRADIUS server project
+ * 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
+ *
+ * Copyright 2000,2006 The FreeRADIUS server project
*/
-#include "autoconf.h"
-#include "libradius.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <freeradius-devel/ident.h>
+RCSID("$Id$")
-#include "radiusd.h"
-#include "modules.h"
-#include "conffile.h"
-
-static const char rcsid[] = "$Id$";
+#include <freeradius-devel/radiusd.h>
+#include <freeradius-devel/modules.h>
/*
* The instance data for rlm_always is the list of fake values we are
* to the strdup'd string into 'config.string'. This gets around
* buffer over-flows.
*/
-static CONF_PARSER module_config[] = {
+static const CONF_PARSER module_config[] = {
{ "rcode", PW_TYPE_STRING_PTR, offsetof(rlm_always_t,rcode_str),
NULL, "fail" },
{ "simulcount", PW_TYPE_INTEGER, offsetof(rlm_always_t,simulcount),
static int always_instantiate(CONF_SECTION *conf, void **instance)
{
rlm_always_t *data;
-
+
/*
* Set up a storage area for instance data
*/
data = rad_malloc(sizeof(*data));
+ if (!data) {
+ return -1;
+ }
+ memset(data, 0, sizeof(*data));
/*
* If the configuration parameters can't be parsed, then
free(data);
return -1;
}
-
+
/*
* Convert the rcode string to an int, and get rid of it
*/
data->rcode = str2rcode(data->rcode_str);
- free(data->rcode_str);
if (data->rcode == -1) {
free(data);
return -1;
return ((struct rlm_always_t *)instance)->rcode;
}
+#ifdef WITH_SESSION_MGMT
/*
* checksimul fakes some other variables besides the rcode...
*/
return inst->rcode;
}
+#endif
static int always_detach(void *instance)
{
}
module_t rlm_always = {
- "always",
- RLM_TYPE_THREAD_SAFE, /* type */
- NULL, /* initialization */
+ RLM_MODULE_INIT,
+ "always",
+ RLM_TYPE_CHECK_CONFIG_SAFE, /* type */
always_instantiate, /* instantiation */
+ always_detach, /* detach */
{
always_return, /* authentication */
always_return, /* authorization */
always_return, /* preaccounting */
always_return, /* accounting */
+#ifdef WITH_SESSION_MGMT
always_checksimul, /* checksimul */
- NULL, /* pre-proxy */
- NULL, /* post-proxy */
- NULL /* post-auth */
+#else
+ NULL,
+#endif
+ always_return, /* pre-proxy */
+ always_return, /* post-proxy */
+ always_return /* post-auth */
+#ifdef WITH_COA
+ ,
+ always_return, /* recv-coa */
+ always_return /* send-coa */
+#endif
},
- always_detach, /* detach */
- NULL, /* destroy */
};