}
/* Get the handler from the list, if present */
- handler = eap_findhandler(list, id);
+ handler = eaplist_findhandler(list, id);
if (handler)
return pairmake("User-Name", handler->identity, T_OP_EQ);
return NULL;
int eap_start(REQUEST *request);
void eap_fail(REQUEST *request, EAP_PACKET *reply);
void eap_success(REQUEST *request, EAP_PACKET *reply);
-EAP_HANDLER *eap_handler(EAP_HANDLER **list, eap_packet_t **eap_msg, REQUEST *request);
-char *eap_identity(eap_packet_t *eap_packet);
-eap_packet_t *eap_attribute(VALUE_PAIR *vps);
+int eap_validation(eap_packet_t *eap_msg);
int eap_wireformat(EAP_PACKET *packet);
int eap_compose(REQUEST *request, EAP_PACKET *reply);
-
-int eap_validation(eap_packet_t *eap_msg);
+eap_packet_t *eap_attribute(VALUE_PAIR *vps);
+EAP_DS *eap_buildds(eap_packet_t **eap_msg);
+EAP_HANDLER *eap_handler(EAP_HANDLER **list, eap_packet_t **eap_msg, REQUEST *request);
+char *eap_identity(eap_packet_t *eap_packet);
+VALUE_PAIR *eap_useridentity(EAP_HANDLER *list, eap_packet_t *eap_packet, unsigned char id[]);
unsigned char *eap_generateid(REQUEST *request, unsigned char response_id);
unsigned char *eap_regenerateid(REQUEST *request, unsigned char response_id);
-EAP_DS *eap_buildds(eap_packet_t **eap_msg);
-char *eap_identity(eap_packet_t *eap_msg);
-VALUE_PAIR *eap_useridentity(EAP_HANDLER *list, eap_packet_t *eap_msg, unsigned char id[]);
-EAP_HANDLER *eap_findhandler(EAP_HANDLER *list, unsigned char id[]);
/* Memory Management */
-EAP_PACKET *eap_packet_alloc();
-EAP_DS *eap_ds_alloc();
-EAP_HANDLER *eap_handler_alloc();
+EAP_PACKET *eap_packet_alloc(void);
+EAP_DS *eap_ds_alloc(void);
+EAP_HANDLER *eap_handler_alloc(void);
void eap_packet_free(EAP_PACKET **eap_packet);
void eap_ds_free(EAP_DS **eap_ds);
void eap_handler_free(EAP_HANDLER **handler);
void eaplist_clean(EAP_HANDLER **list, time_t limit);
void eaplist_free(EAP_HANDLER **list);
EAP_HANDLER *eaplist_isreply(EAP_HANDLER **list, unsigned char id[]);
+EAP_HANDLER *eaplist_findhandler(EAP_HANDLER *list, unsigned char id[]);
/* State */
-void generate_key();
-VALUE_PAIR *generate_state();
+void generate_key(void);
+VALUE_PAIR *generate_state(void);
int verify_state(VALUE_PAIR *state);
#endif /*_EAP_H*/
/*
* Allocate a new EAP_PACKET
*/
-EAP_PACKET *eap_packet_alloc()
+EAP_PACKET *eap_packet_alloc(void)
{
EAP_PACKET *rp;
- if ((rp = malloc(sizeof(EAP_PACKET))) == NULL) {
- radlog(L_ERR, "out of memory");
- return NULL;
- }
+ rp = rad_malloc(sizeof(EAP_PACKET));
memset(rp, 0, sizeof(EAP_PACKET));
return rp;
}
/*
* Allocate a new EAP_PACKET
*/
-EAP_DS *eap_ds_alloc()
+EAP_DS *eap_ds_alloc(void)
{
EAP_DS *eap_ds;
- if ((eap_ds = malloc(sizeof(EAP_DS))) == NULL) {
- radlog(L_ERR, "out of memory");
- return NULL;
- }
+ eap_ds = rad_malloc(sizeof(EAP_DS));
memset(eap_ds, 0, sizeof(EAP_DS));
- if ((eap_ds->response = eap_packet_alloc(sizeof(EAP_PACKET))) == NULL) {
+ if ((eap_ds->response = eap_packet_alloc()) == NULL) {
eap_ds_free(&eap_ds);
return NULL;
}
- if ((eap_ds->request = eap_packet_alloc(sizeof(EAP_PACKET))) == NULL) {
+ if ((eap_ds->request = eap_packet_alloc()) == NULL) {
eap_ds_free(&eap_ds);
return NULL;
}
/*
* Allocate a new EAP_HANDLER
*/
-EAP_HANDLER *eap_handler_alloc()
+EAP_HANDLER *eap_handler_alloc(void)
{
EAP_HANDLER *handler;
radlog(L_ERR, "out of memory");
return NULL;
}
+ handler = rad_malloc(sizeof(EAP_HANDLER));
/*memset(handler, 0, sizeof(EAP_HANDLER));
*/
return handler;
/*
- * rlm_eap.c
- * contains handles that are called from modules.
+ * rlm_eap.c contains handles that are called from modules.
+ *
+ * Version: $Id$
+ *
+ * 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.
+ *
+ * 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
+ *
+ * Copyright 2000,2001 The FreeRADIUS server project
+ * Copyright 2001 hereUare Communications, Inc. <raghud@hereuare.com>
*/
#include "autoconf.h"
sizeof(random_vector_pool));
}
-void generate_key()
+void generate_key(void)
{
generate_random(state_key, AUTH_VECTOR_LEN);
}
/*
* Our state, is (challenge + time + hmac(challenge + time, key))
*/
-VALUE_PAIR *generate_state()
+VALUE_PAIR *generate_state(void)
{
unsigned char challenge[AUTH_VECTOR_LEN];
unsigned char hmac[AUTH_VECTOR_LEN];
/*
* Allocate a new MD5_PACKET
*/
-MD5_PACKET *eapmd5_alloc()
+MD5_PACKET *eapmd5_alloc(void)
{
MD5_PACKET *rp;
/* function declarations here */
-MD5_PACKET *eapmd5_alloc();
+MD5_PACKET *eapmd5_alloc(void);
void eapmd5_free(MD5_PACKET **md5_packet_ptr);
MD5_PACKET *eapmd5_extract(EAP_DS *auth);
int eapmd5_compose(EAP_DS *auth, MD5_PACKET *reply);