Prototype & Signature corrections
authorraghu <raghu>
Tue, 22 Jan 2002 21:45:08 +0000 (21:45 +0000)
committerraghu <raghu>
Tue, 22 Jan 2002 21:45:08 +0000 (21:45 +0000)
src/modules/rlm_eap/eap.c
src/modules/rlm_eap/eap.h
src/modules/rlm_eap/mem.c
src/modules/rlm_eap/rlm_eap.c
src/modules/rlm_eap/state.c
src/modules/rlm_eap/types/rlm_eap_md5/eap_md5.c
src/modules/rlm_eap/types/rlm_eap_md5/eap_md5.h

index 6ba96da..ebce56d 100644 (file)
@@ -594,7 +594,7 @@ VALUE_PAIR *eap_useridentity(EAP_HANDLER *list, eap_packet_t *eap_packet, unsign
        }
 
        /* 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;
index e26473a..5dcb2c8 100644 (file)
@@ -195,24 +195,21 @@ void              eaptype_freelist(EAP_TYPES **tl);
 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);
@@ -221,10 +218,11 @@ int               eaplist_add(EAP_HANDLER **list, 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*/
index 4652680..b9bc780 100644 (file)
 /*
  *      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;
 }
@@ -71,20 +68,17 @@ void eap_packet_free(EAP_PACKET **eap_packet_ptr)
 /*
  *      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;
        }
@@ -110,7 +104,7 @@ void eap_ds_free(EAP_DS **eap_ds_p)
 /*
  *      Allocate a new EAP_HANDLER
  */
-EAP_HANDLER *eap_handler_alloc()
+EAP_HANDLER *eap_handler_alloc(void)
 {
         EAP_HANDLER    *handler;
         
@@ -118,6 +112,7 @@ EAP_HANDLER *eap_handler_alloc()
                 radlog(L_ERR, "out of memory");
                 return NULL;
         }
+        handler = rad_malloc(sizeof(EAP_HANDLER));
         /*memset(handler, 0, sizeof(EAP_HANDLER));
         */
        return handler;
index 596eba4..7bb0b94 100644 (file)
@@ -1,6 +1,24 @@
 /*
- * 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"
index 1420e20..9fe084d 100644 (file)
@@ -148,7 +148,7 @@ static void generate_random(uint8_t *vector, int length)
                        sizeof(random_vector_pool));
 }
 
-void generate_key()
+void generate_key(void)
 {
        generate_random(state_key, AUTH_VECTOR_LEN);
 }
@@ -156,7 +156,7 @@ void generate_key()
 /*
  * 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];
index a75ca7d..646b972 100644 (file)
@@ -43,7 +43,7 @@
 /*
  *      Allocate a new MD5_PACKET
  */
-MD5_PACKET *eapmd5_alloc()
+MD5_PACKET *eapmd5_alloc(void)
 {
         MD5_PACKET   *rp;
 
index 6caf56d..2197ae8 100644 (file)
@@ -51,7 +51,7 @@ typedef struct md5_list {
 
 /* 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);