]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fixup EAP type definitions
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 15 Mar 2013 20:53:42 +0000 (16:53 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 15 Mar 2013 20:53:42 +0000 (16:53 -0400)
18 files changed:
src/include/libradius.h
src/main/modules.c
src/modules/rlm_eap/eap.c
src/modules/rlm_eap/eap.h
src/modules/rlm_eap/libeap/eap_sim.h
src/modules/rlm_eap/libeap/eap_tls.h
src/modules/rlm_eap/libeap/eap_types.h
src/modules/rlm_eap/libeap/eapcommon.c
src/modules/rlm_eap/libeap/eapsimlib.c
src/modules/rlm_eap/mem.c
src/modules/rlm_eap/radeapclient.c
src/modules/rlm_eap/rlm_eap.c
src/modules/rlm_eap/rlm_eap.h
src/modules/rlm_eap/types/rlm_eap_leap/eap_leap.c
src/modules/rlm_eap/types/rlm_eap_leap/eap_leap.h
src/modules/rlm_eap/types/rlm_eap_leap/rlm_eap_leap.c
src/modules/rlm_eap/types/rlm_eap_peap/peap.c
src/modules/rlm_eap/types/rlm_eap_pwd/rlm_eap_pwd.c

index e5612f666070157bde7eb99b430a41c4d70052af..1fc7fdf44433e2fdc03a1429cd013c2455b8dede 100644 (file)
@@ -73,8 +73,6 @@ RCSIDH(libradius_h, "$Id$")
 extern "C" {
 #endif
 
-#define EAP_START               2
-
 #define AUTH_VECTOR_LEN                16
 #define CHAP_VALUE_LENGTH       16
 #define MAX_STRING_LEN         254     /* RFC2138: string 0-253 octets */
index 2df360d6ab08e39adf550f0806828e3917413627..68a4cdce291bfa515b60c5c682e776377215de7e 100644 (file)
@@ -184,7 +184,7 @@ typedef struct lt_dlmodule_t {
   void         *ref;
 } lt_dlmodule_t;
 
-typedef struct eap_type_t EAP_TYPE;
+typedef struct eap_type_data_t EAP_TYPE;
 typedef struct rlm_sql_module_t rlm_sql_module_t;
 
 /*
index 501865b091246bfb5a4e6f60ef28a33c58d42ee4..ad46bc85b92926cd46ac32f536d6cf0bafb99806 100644 (file)
@@ -100,7 +100,7 @@ int eaptype_load(EAP_TYPES **type, int eap_type, CONF_SECTION *cs)
        const char      *eaptype_name;
        EAP_TYPES       *node;
 
-       eaptype_name = eaptype_type2name(eap_type, namebuf, sizeof(namebuf));
+       eaptype_name = eap_type_data_type2name(eap_type, namebuf, sizeof(namebuf));
        snprintf(buffer, sizeof(buffer), "rlm_eap_%s", eaptype_name);
 
        /* Make room for the EAP-Type */
@@ -223,7 +223,7 @@ int eaptype_select(rlm_eap_t *inst, EAP_HANDLER *handler)
 {
        size_t          i;
        unsigned int    default_eap_type = inst->default_eap_type;
-       eaptype_t       *eaptype;
+       eap_type_data_t *eaptype;
        VALUE_PAIR      *vp;
        char            namebuf[64];
        const char      *eaptype_name;
@@ -235,7 +235,7 @@ int eaptype_select(rlm_eap_t *inst, EAP_HANDLER *handler)
         *      Don't trust anyone.
         */
        if ((eaptype->type == 0) ||
-           (eaptype->type > PW_EAP_MAX_TYPES)) {
+           (eaptype->type >= PW_EAP_MAX_TYPES)) {
                RDEBUG2("Asked to select bad type");
                return EAP_INVALID;
        }
@@ -266,10 +266,10 @@ int eaptype_select(rlm_eap_t *inst, EAP_HANDLER *handler)
                 *      Ensure it's valid.
                 */
                if ((default_eap_type < PW_EAP_MD5) ||
-                   (default_eap_type > PW_EAP_MAX_TYPES) ||
+                   (default_eap_type >= PW_EAP_MAX_TYPES) ||
                    (inst->types[default_eap_type] == NULL)) {
                        RDEBUG2("No such EAP type %s",
-                              eaptype_type2name(default_eap_type,
+                              eap_type_data_type2name(default_eap_type,
                                                 namebuf, sizeof(namebuf)));
                        return EAP_INVALID;
                }
@@ -286,7 +286,7 @@ int eaptype_select(rlm_eap_t *inst, EAP_HANDLER *handler)
                if (eaptype_call(inst->types[default_eap_type],
                                 handler) == 0) {
                        RDEBUG2("Default EAP type %s failed in initiate",
-                              eaptype_type2name(default_eap_type,
+                              eap_type_data_type2name(default_eap_type,
                                                 namebuf, sizeof(namebuf)));
                        return EAP_INVALID;
                }
@@ -337,7 +337,7 @@ int eaptype_select(rlm_eap_t *inst, EAP_HANDLER *handler)
                                return EAP_INVALID;
                        }
 
-                       if ((eaptype->data[i] > PW_EAP_MAX_TYPES) ||
+                       if ((eaptype->data[i] >= PW_EAP_MAX_TYPES) ||
                            !inst->types[eaptype->data[i]]) {
                                DICT_VALUE *dv;
 
@@ -352,7 +352,7 @@ int eaptype_select(rlm_eap_t *inst, EAP_HANDLER *handler)
                                continue;
                        }
 
-                       eaptype_name = eaptype_type2name(eaptype->data[i],
+                       eaptype_name = eap_type_data_type2name(eaptype->data[i],
                                                         namebuf,
                                                         sizeof(namebuf));
                        
@@ -373,7 +373,7 @@ int eaptype_select(rlm_eap_t *inst, EAP_HANDLER *handler)
                                char    mynamebuf[64];
                                RDEBUG2("Client wants %s, while we require %s.  Skipping the requested type.",
                                       eaptype_name,
-                                      eaptype_type2name(vp->vp_integer,
+                                      eap_type_data_type2name(vp->vp_integer,
                                                         mynamebuf,
                                                         sizeof(mynamebuf)));
                                continue;
@@ -390,7 +390,7 @@ int eaptype_select(rlm_eap_t *inst, EAP_HANDLER *handler)
                        RDEBUG2("No common EAP types found.");
                        return EAP_INVALID;
                }
-               eaptype_name = eaptype_type2name(default_eap_type,
+               eaptype_name = eap_type_data_type2name(default_eap_type,
                                                 namebuf, sizeof(namebuf));
                RDEBUG2("EAP-NAK asked for EAP-Type/%s",
                       eaptype_name);
@@ -402,7 +402,7 @@ int eaptype_select(rlm_eap_t *inst, EAP_HANDLER *handler)
                 *      Key off of the configured sub-modules.
                 */
                default:
-                       eaptype_name = eaptype_type2name(eaptype->type,
+                       eaptype_name = eap_type_data_type2name(eaptype->type,
                                                         namebuf,
                                                         sizeof(namebuf));
                        RDEBUG2("EAP/%s", eaptype_name);
@@ -441,10 +441,10 @@ int eaptype_select(rlm_eap_t *inst, EAP_HANDLER *handler)
 rlm_rcode_t eap_compose(EAP_HANDLER *handler)
 {
        VALUE_PAIR *vp;
-       eap_packet_t *eap_packet;
+       eap_packet_raw_t *eap_packet;
        REQUEST *request = handler->request;
        EAP_DS *eap_ds = handler->eap_ds;
-       EAP_PACKET *reply = eap_ds->request;
+       eap_packet_t *reply = eap_ds->request;
        int rcode;
 
        /*
@@ -509,7 +509,7 @@ rlm_rcode_t eap_compose(EAP_HANDLER *handler)
             (eap_ds->request->code == PW_EAP_RESPONSE)) &&
            (eap_ds->request->type.type == 0)) {
                rad_assert(handler->eap_type >= PW_EAP_MD5);
-               rad_assert(handler->eap_type <= PW_EAP_MAX_TYPES);
+               rad_assert(handler->eap_type < PW_EAP_MAX_TYPES);
 
                eap_ds->request->type.type = handler->eap_type;
        }
@@ -522,7 +522,7 @@ rlm_rcode_t eap_compose(EAP_HANDLER *handler)
        if (eap_wireformat(reply) == EAP_INVALID) {
                return RLM_MODULE_INVALID;
        }
-       eap_packet = (eap_packet_t *)reply->packet;
+       eap_packet = (eap_packet_raw_t *)reply->packet;
 
        vp = eap_packet2vp(request->reply, eap_packet);
        if (!vp) return RLM_MODULE_INVALID;
@@ -727,7 +727,7 @@ int eap_start(rlm_eap_t *inst, REQUEST *request)
         *      Success, or Failure.
         */
        if ((eap_msg->vp_octets[0] == 0) ||
-           (eap_msg->vp_octets[0] > PW_EAP_MAX_CODES)) {
+           (eap_msg->vp_octets[0] >= PW_EAP_MAX_CODES)) {
                RDEBUG2("Unknown EAP packet");
        } else {
                RDEBUG2("EAP packet type %s id %d length %d",
@@ -759,7 +759,7 @@ int eap_start(rlm_eap_t *inst, REQUEST *request)
        if ((eap_msg->vp_octets[4] >= PW_EAP_MD5) &&
            inst->ignore_unknown_eap_types &&
            ((eap_msg->vp_octets[4] == 0) ||
-            (eap_msg->vp_octets[4] > PW_EAP_MAX_TYPES) ||
+            (eap_msg->vp_octets[4] >= PW_EAP_MAX_TYPES) ||
             (inst->types[eap_msg->vp_octets[4]] == NULL))) {
                RDEBUG2(" Ignoring Unknown EAP type");
                return EAP_NOOP;
@@ -784,7 +784,7 @@ int eap_start(rlm_eap_t *inst, REQUEST *request)
            (eap_msg->length >= (EAP_HEADER_LEN + 2)) &&
            inst->ignore_unknown_eap_types &&
            ((eap_msg->vp_octets[5] == 0) ||
-            (eap_msg->vp_octets[5] > PW_EAP_MAX_TYPES) ||
+            (eap_msg->vp_octets[5] >= PW_EAP_MAX_TYPES) ||
             (inst->types[eap_msg->vp_octets[5]] == NULL))) {
                RDEBUG2("Ignoring NAK with request for unknown EAP type");
                return EAP_NOOP;
@@ -864,7 +864,7 @@ void eap_success(EAP_HANDLER *handler)
 /*
  * Basic EAP packet verfications & validations
  */
-static int eap_validation(REQUEST *request, eap_packet_t *eap_packet)
+static int eap_validation(REQUEST *request, eap_packet_raw_t *eap_packet)
 {
        uint16_t len;
 
@@ -878,7 +878,7 @@ static int eap_validation(REQUEST *request, eap_packet_t *eap_packet)
            ((eap_packet->code != PW_EAP_RESPONSE) &&
             (eap_packet->code != PW_EAP_REQUEST)) ||
            (eap_packet->data[0] <= 0) ||
-           (eap_packet->data[0] > PW_EAP_MAX_TYPES)) {
+           (eap_packet->data[0] >= PW_EAP_MAX_TYPES)) {
 
                radlog_request(L_AUTH, 0, request, 
                               "Badly formatted EAP Message: Ignoring the packet");
@@ -899,7 +899,7 @@ static int eap_validation(REQUEST *request, eap_packet_t *eap_packet)
 /*
  *  Get the user Identity only from EAP-Identity packets
  */
-static char *eap_identity(REQUEST *request, eap_packet_t *eap_packet)
+static char *eap_identity(REQUEST *request, eap_packet_raw_t *eap_packet)
 {
        int size;
        uint16_t len;
@@ -931,10 +931,10 @@ static char *eap_identity(REQUEST *request, eap_packet_t *eap_packet)
 /*
  *     Create our Request-Response data structure with the eap packet
  */
-static EAP_DS *eap_buildds(eap_packet_t **eap_packet_p)
+static EAP_DS *eap_buildds(eap_packet_raw_t **eap_packet_p)
 {
        EAP_DS          *eap_ds = NULL;
-       eap_packet_t    *eap_packet = *eap_packet_p;
+       eap_packet_raw_t        *eap_packet = *eap_packet_p;
        int             typelen;
        uint16_t        len;
 
@@ -988,11 +988,11 @@ static EAP_DS *eap_buildds(eap_packet_t **eap_packet_p)
  * username contains REQUEST->username which might have been stripped.
  * identity contains the one sent in EAP-Identity response
  */
-EAP_HANDLER *eap_handler(rlm_eap_t *inst, eap_packet_t **eap_packet_p,
+EAP_HANDLER *eap_handler(rlm_eap_t *inst, eap_packet_raw_t **eap_packet_p,
                         REQUEST *request)
 {
        EAP_HANDLER     *handler = NULL;
-       eap_packet_t    *eap_packet = *eap_packet_p;
+       eap_packet_raw_t        *eap_packet = *eap_packet_p;
        VALUE_PAIR      *vp;
 
        /*
index 28282f10bd6e40c2d4430be9b67cdcec8e94d034..1e82e89ca81e30e35c73a8bed406c30b13e4a1d2 100644 (file)
@@ -46,8 +46,8 @@ RCSIDH(eap_h, "$Id$")
  *  we send EAP-Request/EAP-success/EAP-failure
  */
 typedef struct eap_ds {
-       EAP_PACKET      *response;
-       EAP_PACKET      *request;
+       eap_packet_t    *response;
+       eap_packet_t    *request;
        int             set_request_id;
 } EAP_DS;
 
@@ -126,7 +126,7 @@ typedef struct _eap_handler {
 /*
  * Interface to call EAP sub mdoules
  */
-typedef struct eap_type_t {
+typedef struct eap_type_data_t {
        const   char *name;
        int     (*attach)(CONF_SECTION *conf, void **type_data);
        int     (*initiate)(void *type_data, EAP_HANDLER *handler);
index ee51dcb9e7296d2020bda925d18904d3ff4a601a..51f0389df52fc31edb00c81d76cd649126d425e6 100644 (file)
@@ -103,7 +103,7 @@ enum eapsim_serverstates {
 /*
  * interfaces in eapsimlib.c
  */
-extern int map_eapsim_basictypes(RADIUS_PACKET *r, EAP_PACKET *ep);
+extern int map_eapsim_basictypes(RADIUS_PACKET *r, eap_packet_t *ep);
 extern const char *sim_state2name(enum eapsim_clientstates state, char *buf, int buflen);
 extern const char *sim_subtype2name(enum eapsim_subtype subtype, char *buf, int buflen);
 extern int unmap_eapsim_basictypes(RADIUS_PACKET *r,
index 9bcb1808a47dfc09721eac0ed75d04ad56f713fd..85bcecc81f49877f2519fdaaa5b69eb54ab7d2d1 100644 (file)
@@ -95,7 +95,7 @@ typedef struct tls_packet {
        uint8_t         *data;
        uint32_t        dlen;
 
-       //uint8_t               *packet;  /* Wired EAP-TLS packet as found in typdedata of EAP_PACKET */
+       //uint8_t               *packet;  /* Wired EAP-TLS packet as found in typdedata of eap_packet_t */
 } EAPTLS_PACKET;
 
 
index 94f8b92b200189c37d92572d8750b262c252ddbc..c36e93daa88f90f633976b11739ede09c9e86187 100644 (file)
@@ -32,59 +32,99 @@ RCSIDH(eap_types_h, "$Id$")
 #include <freeradius-devel/radiusd.h>
 #include <freeradius-devel/modules.h>
 
-#define PW_EAP_REQUEST         1
-#define PW_EAP_RESPONSE                2
-#define PW_EAP_SUCCESS         3
-#define PW_EAP_FAILURE         4
-#define PW_EAP_MAX_CODES       4
+/* Field length and other arbitrary things */
+#define EAP_HEADER_LEN                 4
 
 /* base for dictionary values */
 #define ATTRIBUTE_EAP_ID        1020
 #define ATTRIBUTE_EAP_CODE      1021
 #define ATTRIBUTE_EAP_BASE      1280
 
-#define PW_EAP_IDENTITY                1
-#define PW_EAP_NOTIFICATION    2
-#define PW_EAP_NAK             3
-#define PW_EAP_MD5             4
-#define PW_EAP_OTP             5
-#define PW_EAP_GTC             6
-#define PW_EAP_TLS             13
-#define PW_EAP_LEAP            17
-#define PW_EAP_SIM              18
-#define PW_EAP_TTLS            21
-#define PW_EAP_PEAP            25
-#define PW_EAP_MSCHAPV2                26
-#define PW_EAP_CISCO_MSCHAPV2  29
-#define PW_EAP_TNC             38
-#define PW_EAP_IKEV2           49
-#define PW_EAP_PWD              52
-     /* same number as last type */
-#define PW_EAP_MAX_TYPES       52
-
-#define EAP_HEADER_LEN                 4
+typedef enum eap_code {
+       PW_EAP_REQUEST = 1,
+       PW_EAP_RESPONSE,
+       PW_EAP_SUCCESS,
+       PW_EAP_FAILURE,
+       PW_EAP_MAX_CODES
+} eap_code_t;
 
-#define EAP_START              2
-#define NAME_LEN               32
+typedef enum eap_type {
+       PW_EAP_IDENTITY = 1,            /* 1 */
+       PW_EAP_NOTIFICATION,            /* 2 */
+       PW_EAP_NAK,                     /* 3 */
+       PW_EAP_MD5,                     /* 4 */
+       PW_EAP_OTP,                     /* 5 */
+       PW_EAP_GTC,                     /* 6 */
+       PW_EAP_7,                       /* 7  - unused */
+       PW_EAP_8,                       /* 8  - unused */
+       PW_EAP_RSA_PUBLIC_KEY,          /* 9 */
+       PW_EAP_DSS_UNILATERAL,          /* 10 */
+       PW_EAP_KEA,                     /* 11 */
+       PW_EAP_KEA_VALIDATE,            /* 12 */
+       PW_EAP_TLS,                     /* 13 */
+       PW_EAP_DEFENDER_TOKEN,          /* 14 */
+       PW_EAP_RSA_SECURID,             /* 15 */
+       PW_EAP_ARCOT_SYSTEMS,           /* 16 */
+       PW_EAP_LEAP,                    /* 17 */
+       PW_EAP_SIM,                     /* 18 */
+       PW_EAP_SRP_SHA1,                /* 19 */
+       PW_EAP_20,                      /* 20 - unassigned */
+       PW_EAP_TTLS,                    /* 21 */
+       PW_EAP_REMOTE_ACCESS_SERVICE,   /* 22 */
+       PW_EAP_AKA,                     /* 23 */
+       PW_EAP_3COM,                    /* 24 - should this be EAP-HP now? */   
+       PW_EAP_PEAP,                    /* 25 */
+       PW_EAP_MSCHAPV2,                /* 26 */
+       PW_EAP_MAKE,                    /* 27 */
+       PW_EAP_CRYPTOCARD,              /* 28 */
+       PW_EAP_CISCO_MSCHAPV2,          /* 29 */
+       PW_EAP_DYNAMID,                 /* 30 */
+       PW_EAP_ROB,                     /* 31 */
+       PW_EAP_POTP,                    /* 32 */
+       PW_EAP_MS_ATLV,                 /* 33 */
+       PW_EAP_SENTRINET,               /* 34 */
+       PW_EAP_ACTIONTEC,               /* 35 */
+       PW_EAP_COGENT_BIOMETRIC,        /* 36 */
+       PW_EAP_AIRFORTRESS,             /* 37 */
+       PW_EAP_TNC,                     /* 38 - fixme conflicts with HTTP DIGEST */
+//     PW_EAP_HTTP_DIGEST,             /* 38 */
+       PW_EAP_SECURISUITE,             /* 39 */
+       PW_EAP_DEVICECONNECT,           /* 40 */
+       PW_EAP_SPEKE,                   /* 41 */
+       PW_EAP_MOBAC,                   /* 42 */
+       PW_EAP_FAST,                    /* 43 */
+       PW_EAP_ZONELABS,                /* 44 */
+       PW_EAP_LINK,                    /* 45 */
+       PW_EAP_PAX,                     /* 46 */
+       PW_EAP_PSK,                     /* 47 */
+       PW_EAP_SAKE,                    /* 48 */
+       PW_EAP_IKEV2,                   /* 49 */
+       PW_EAP_AKA2,                    /* 50 */
+       PW_EAP_GPSK,                    /* 51 */
+       PW_EAP_PWD,                     /* 52 */
+       PW_EAP_EKE,                     /* 53 */
+       PW_EAP_MAX_TYPES                /* 54 - for validation */
+} eap_type_t;
 
-enum {
-       EAP_NOTFOUND,    /* not found */
-       EAP_FOUND,       /* found, continue */
-       EAP_OK,          /* ok, continue */
-       EAP_FAIL,        /* failed, don't reply */
-       EAP_NOOP,        /* succeeded without doing anything */
-       EAP_INVALID,     /* invalid, don't reply */
-       EAP_VALID        /* valid, continue */
-};
+typedef enum eap_rcode {
+       EAP_NOTFOUND,           //!< Not found.
+       EAP_FOUND,              //!< Found, continue.
+       EAP_OK,                 //!< Ok, continue.
+       EAP_FAIL,               //!< Failed, don't reply.
+       EAP_NOOP,               //!< Succeeded without doing anything.
+       EAP_INVALID,            //!< Invalid, don't reply.
+       EAP_VALID,              //!< Valid, continue.
+       EAP_MAX_RCODES
+} eap_rcode_t;
 
 /*
  * EAP-Type specific data.
  */
-typedef struct eaptype_t {
+typedef struct eap_type_data {
        uint8_t type;
        size_t  length;
        uint8_t *data;
-} eaptype_t;
+} eap_type_data_t;
 
 /*
  * Structure to hold EAP data.
@@ -96,31 +136,31 @@ typedef struct eap_packet {
        unsigned char   code;
        unsigned char   id;
        unsigned int    length;
-       eaptype_t       type;
+       eap_type_data_t type;
 
        unsigned char   *packet;
-} EAP_PACKET;
+} eap_packet_t;
 
 /*
  * Structure to represent packet format of eap *on wire*
  */
-typedef struct eap_packet_t {
+typedef struct eap_packet_raw {
        uint8_t         code;
        uint8_t         id;
        uint8_t         length[2];
        uint8_t         data[1];
-} eap_packet_t;
+} eap_packet_raw_t;
 
 
 /*
  * interfaces in eapcommon.c
  */
 extern int eaptype_name2type(const char *name);
-extern const char *eaptype_type2name(unsigned int type, char *buffer, size_t buflen);
-extern int eap_wireformat(EAP_PACKET *reply);
-extern int eap_basic_compose(RADIUS_PACKET *packet, EAP_PACKET *reply);
+extern const char *eap_type_data_type2name(unsigned int type, char *buffer, size_t buflen);
+extern int eap_wireformat(eap_packet_t *reply);
+extern int eap_basic_compose(RADIUS_PACKET *packet, eap_packet_t *reply);
 extern VALUE_PAIR *eap_packet2vp(RADIUS_PACKET *packet,
-                                const eap_packet_t *reply);
-extern eap_packet_t *eap_vp2packet(VALUE_PAIR *vps);
+                                const eap_packet_raw_t *reply);
+extern eap_packet_raw_t *eap_vp2packet(VALUE_PAIR *vps);
 
 #endif /* _EAP_TYPES_H */
index acbafc257a73649afed719af900f104a0fe325d4..cfa1e1fbd9ef370e90d38083b4d799191577ebe8 100644 (file)
@@ -116,7 +116,8 @@ static const char *eap_types[] = {
   "ikev2",
   "50",
   "51",
-  "pwd"
+  "pwd",
+  "eke"
 };                             /* MUST have PW_EAP_MAX_TYPES */
 
 /*
@@ -126,7 +127,7 @@ int eaptype_name2type(const char *name)
 {
        int i;
 
-       for (i = 0; i <= PW_EAP_MAX_TYPES; i++) {
+       for (i = 0; i < PW_EAP_MAX_TYPES; i++) {
                if (strcmp(name, eap_types[i]) == 0) {
                        return i;
                }
@@ -138,11 +139,11 @@ int eaptype_name2type(const char *name)
 /*
  *     Returns a text string containing the name of the EAP type.
  */
-const char *eaptype_type2name(unsigned int type, char *buffer, size_t buflen)
+const char *eap_type_data_type2name(unsigned int type, char *buffer, size_t buflen)
 {
        DICT_VALUE      *dval;
 
-       if (type > PW_EAP_MAX_TYPES) {
+       if (type >= PW_EAP_MAX_TYPES) {
                /*
                 *      Prefer the dictionary name over a number,
                 *      if it exists.
@@ -185,9 +186,9 @@ const char *eaptype_type2name(unsigned int type, char *buffer, size_t buflen)
  *                      be malloc()'ed to the right size.
  *
  */
-int eap_wireformat(EAP_PACKET *reply)
+int eap_wireformat(eap_packet_t *reply)
 {
-       eap_packet_t    *hdr;
+       eap_packet_raw_t        *hdr;
        uint16_t total_length = 0;
 
        if (reply == NULL) return EAP_INVALID;
@@ -207,7 +208,7 @@ int eap_wireformat(EAP_PACKET *reply)
        }
 
        reply->packet = (unsigned char *)malloc(total_length);
-       hdr = (eap_packet_t *)reply->packet;
+       hdr = (eap_packet_raw_t *)reply->packet;
        if (!hdr) {
                radlog(L_ERR, "rlm_eap: out of memory");
                return EAP_INVALID;
@@ -248,16 +249,16 @@ int eap_wireformat(EAP_PACKET *reply)
  *     compose EAP reply packet in EAP-Message attr of RADIUS.  If
  *     EAP exceeds 253, frame it in multiple EAP-Message attrs.
  */
-int eap_basic_compose(RADIUS_PACKET *packet, EAP_PACKET *reply)
+int eap_basic_compose(RADIUS_PACKET *packet, eap_packet_t *reply)
 {
        VALUE_PAIR *vp;
-       eap_packet_t *eap_packet;
+       eap_packet_raw_t *eap_packet;
        int rcode;
 
        if (eap_wireformat(reply) == EAP_INVALID) {
                return RLM_MODULE_INVALID;
        }
-       eap_packet = (eap_packet_t *)reply->packet;
+       eap_packet = (eap_packet_raw_t *)reply->packet;
 
        pairdelete(&(packet->vps), PW_EAP_MESSAGE, 0, TAG_ANY);
 
@@ -307,7 +308,7 @@ int eap_basic_compose(RADIUS_PACKET *packet, EAP_PACKET *reply)
 }
 
 
-VALUE_PAIR *eap_packet2vp(RADIUS_PACKET *packet, const eap_packet_t *eap)
+VALUE_PAIR *eap_packet2vp(RADIUS_PACKET *packet, const eap_packet_raw_t *eap)
 {
        int             total, size;
        const uint8_t   *ptr;
@@ -349,10 +350,10 @@ VALUE_PAIR *eap_packet2vp(RADIUS_PACKET *packet, const eap_packet_t *eap)
  * NOTE: Sometimes Framed-MTU might contain the length of EAP-Message,
  *      refer fragmentation in rfc2869.
  */
-eap_packet_t *eap_vp2packet(VALUE_PAIR *vps)
+eap_packet_raw_t *eap_vp2packet(VALUE_PAIR *vps)
 {
        VALUE_PAIR *first, *vp;
-       eap_packet_t *eap_packet;
+       eap_packet_raw_t *eap_packet;
        unsigned char *ptr;
        uint16_t len;
        int total_len;
@@ -413,7 +414,7 @@ eap_packet_t *eap_vp2packet(VALUE_PAIR *vps)
        /*
         *      Now that we know the lengths are OK, allocate memory.
         */
-       eap_packet = (eap_packet_t *) malloc(len);
+       eap_packet = (eap_packet_raw_t *) malloc(len);
        if (eap_packet == NULL) {
                radlog(L_ERR, "rlm_eap: out of memory");
                return NULL;
index a509d38a6acb13efab886416a80da0b2751380d3..018c6775ed94b14418096fd1b1de1b3f47200f0f 100644 (file)
@@ -61,7 +61,7 @@ RCSID("$Id$")
  * them all into a single EAP-SIM body.
  *
  */
-int map_eapsim_basictypes(RADIUS_PACKET *r, EAP_PACKET *ep)
+int map_eapsim_basictypes(RADIUS_PACKET *r, eap_packet_t *ep)
 {
        VALUE_PAIR       *vp;
        int               encoded_size;
@@ -254,14 +254,14 @@ int map_eapsim_basictypes(RADIUS_PACKET *r, EAP_PACKET *ep)
        if(macspace != NULL && vp != NULL)
        {
                unsigned char   *buffer;
-               eap_packet_t    *hdr;
+               eap_packet_raw_t        *hdr;
                uint16_t         hmaclen, total_length = 0;
                unsigned char    sha1digest[20];
 
                total_length = EAP_HEADER_LEN + 1 + encoded_size;
                hmaclen = total_length + appendlen;
                buffer = (unsigned char *)malloc(hmaclen);
-               hdr = (eap_packet_t *)buffer;
+               hdr = (eap_packet_raw_t *)buffer;
                if (!hdr) {
                        radlog(L_ERR, "rlm_eap: out of memory");
                        free(encodedmsg);
@@ -391,7 +391,7 @@ eapsim_checkmac(VALUE_PAIR *rvps,
                uint8_t calcmac[20])
 {
        int ret;
-       eap_packet_t *e;
+       eap_packet_raw_t *e;
        uint8_t *buffer;
        int elen,len;
        VALUE_PAIR *mac;
index f058136a6ac07e954901b65244e8bf0d67cf1e9b..d7b4fae64bfa36a435edca16f232905962f57c88 100644 (file)
@@ -36,23 +36,23 @@ RCSID("$Id$")
 #endif
 
 /*
- * Allocate a new EAP_PACKET
+ * Allocate a new eap_packet_t
  */
-EAP_PACKET *eap_packet_alloc(void)
+eap_packet_t *eap_packet_alloc(void)
 {
-       EAP_PACKET   *rp;
+       eap_packet_t   *rp;
 
-       rp = rad_malloc(sizeof(EAP_PACKET));
-       memset(rp, 0, sizeof(EAP_PACKET));
+       rp = rad_malloc(sizeof(eap_packet_t));
+       memset(rp, 0, sizeof(eap_packet_t));
        return rp;
 }
 
 /*
- * Free EAP_PACKET
+ * Free eap_packet_t
  */
-void eap_packet_free(EAP_PACKET **eap_packet_ptr)
+void eap_packet_free(eap_packet_t **eap_packet_ptr)
 {
-       EAP_PACKET *eap_packet;
+       eap_packet_t *eap_packet;
 
        if (!eap_packet_ptr) return;
        eap_packet = *eap_packet_ptr;
@@ -81,7 +81,7 @@ void eap_packet_free(EAP_PACKET **eap_packet_ptr)
 }
 
 /*
- * Allocate a new EAP_PACKET
+ * Allocate a new eap_packet_t
  */
 EAP_DS *eap_ds_alloc(void)
 {
@@ -536,7 +536,7 @@ int eaplist_add(rlm_eap_t *inst, EAP_HANDLER *handler)
  *     got to free the prev_eapds & move the eap_ds to prev_eapds
  */
 EAP_HANDLER *eaplist_find(rlm_eap_t *inst, REQUEST *request,
-                         eap_packet_t *eap_packet)
+                         eap_packet_raw_t *eap_packet)
 {
        VALUE_PAIR      *state;
        EAP_HANDLER     *handler, myHandler;
index de4fbd73fed74e91bb96d54dbd90a9890e7b8850..8f31e675830b095f8531954f0445c5d83094ff60 100644 (file)
@@ -1258,7 +1258,7 @@ static void map_eap_types(RADIUS_PACKET *req)
 {
        VALUE_PAIR *vp, *vpnext;
        int id, eapcode;
-       EAP_PACKET ep;
+       eap_packet_t ep;
        int eap_type;
 
        vp = pairfind(req->vps, ATTRIBUTE_EAP_ID, 0, TAG_ANY);
@@ -1330,7 +1330,7 @@ static void map_eap_types(RADIUS_PACKET *req)
 static void unmap_eap_types(RADIUS_PACKET *rep)
 {
        VALUE_PAIR *eap1;
-       eap_packet_t *e;
+       eap_packet_raw_t *e;
        int len;
        int type;
 
@@ -1397,7 +1397,7 @@ static void unmap_eap_types(RADIUS_PACKET *rep)
 
 static int map_eapsim_types(RADIUS_PACKET *r)
 {
-       EAP_PACKET ep;
+       eap_packet_t ep;
        int ret;
 
        memset(&ep, 0, sizeof(ep));
index e21312495f4f29427442f86f4da6c2e6eb2a4395..18b624191a9c15fe05fd197d842dbd8db2a122c3 100644 (file)
@@ -271,7 +271,7 @@ static rlm_rcode_t eap_authenticate(void *instance, REQUEST *request)
 {
        rlm_eap_t       *inst;
        EAP_HANDLER     *handler;
-       eap_packet_t    *eap_packet;
+       eap_packet_raw_t        *eap_packet;
        int             rcode;
        rlm_rcode_t     module_rcode;
 
@@ -719,7 +719,7 @@ static rlm_rcode_t eap_post_auth(void *instance, REQUEST *request)
        rlm_eap_t       *inst = instance;
        VALUE_PAIR      *vp;
        EAP_HANDLER     *handler;
-       eap_packet_t    *eap_packet;
+       eap_packet_raw_t        *eap_packet;
        
        /*
         * Only build a failure message if something previously rejected the request
index 73649a96658d014c1888b56b7e6e43c1bfe96548..d25c408097f23d7406085fa2012fef34f9148839 100644 (file)
@@ -52,7 +52,7 @@ typedef struct rlm_eap_t {
        rbtree_t        *session_tree;
        EAP_HANDLER     *session_head, *session_tail;
        rbtree_t        *handler_tree; /* for debugging only */
-       EAP_TYPES       *types[PW_EAP_MAX_TYPES + 1];
+       EAP_TYPES       *types[PW_EAP_MAX_TYPES];
 
        /*
         *      Configuration items.
@@ -96,20 +96,20 @@ int                 eap_start(rlm_eap_t *inst, REQUEST *request);
 void           eap_fail(EAP_HANDLER *handler);
 void           eap_success(EAP_HANDLER *handler);
 rlm_rcode_t    eap_compose(EAP_HANDLER *handler);
-EAP_HANDLER    *eap_handler(rlm_eap_t *inst, eap_packet_t **eap_msg, REQUEST *request);
+EAP_HANDLER    *eap_handler(rlm_eap_t *inst, eap_packet_raw_t **eap_msg, REQUEST *request);
 
 /* Memory Management */
-EAP_PACKET     *eap_packet_alloc(void);
+eap_packet_t   *eap_packet_alloc(void);
 EAP_DS         *eap_ds_alloc(void);
 EAP_HANDLER    *eap_handler_alloc(rlm_eap_t *inst);
-void           eap_packet_free(EAP_PACKET **eap_packet);
+void           eap_packet_free(eap_packet_t **eap_packet);
 void           eap_ds_free(EAP_DS **eap_ds);
 void           eap_opaque_free(EAP_HANDLER *handler);
 void           eap_handler_free(rlm_eap_t *inst, EAP_HANDLER *handler);
 
 int            eaplist_add(rlm_eap_t *inst, EAP_HANDLER *handler);
 EAP_HANDLER    *eaplist_find(rlm_eap_t *inst, REQUEST *request,
-                             eap_packet_t *eap_packet);
+                             eap_packet_raw_t *eap_packet);
 void           eaplist_free(rlm_eap_t *inst);
 
 /* State */
index 48d0133d0f80594d2b2cd609c94959b9f2151eaa..16eb0884cfe18ba103394d83becb87af320fcf97 100644 (file)
@@ -53,26 +53,26 @@ RCSID("$Id$")
 #include "eap_leap.h"
 
 /*
- *      Allocate a new LEAP_PACKET
+ *      Allocate a new Leap_packet_t
  */
-LEAP_PACKET *eapleap_alloc(void)
+Leap_packet_t *eapleap_alloc(void)
 {
-       LEAP_PACKET   *rp;
+       Leap_packet_t   *rp;
 
-       if ((rp = malloc(sizeof(LEAP_PACKET))) == NULL) {
+       if ((rp = malloc(sizeof(Leap_packet_t))) == NULL) {
                radlog(L_ERR, "rlm_eap_leap: out of memory");
                return NULL;
        }
-       memset(rp, 0, sizeof(LEAP_PACKET));
+       memset(rp, 0, sizeof(Leap_packet_t));
        return rp;
 }
 
 /*
- *      Free LEAP_PACKET
+ *      Free Leap_packet_t
  */
-void eapleap_free(LEAP_PACKET **leap_packet_ptr)
+void eapleap_free(Leap_packet_t **leap_packet_ptr)
 {
-       LEAP_PACKET *leap_packet;
+       Leap_packet_t *leap_packet;
 
        if (!leap_packet_ptr) return;
        leap_packet = *leap_packet_ptr;
@@ -89,10 +89,10 @@ void eapleap_free(LEAP_PACKET **leap_packet_ptr)
 /*
  *   Extract the data from the LEAP packet.
  */
-LEAP_PACKET *eapleap_extract(EAP_DS *eap_ds)
+Leap_packet_t *eapleap_extract(EAP_DS *eap_ds)
 {
-       leap_packet_t   *data;
-       LEAP_PACKET     *packet;
+       leap_packet_raw_t       *data;
+       Leap_packet_t   *packet;
        int             name_len;
 
        /*
@@ -114,7 +114,7 @@ LEAP_PACKET *eapleap_extract(EAP_DS *eap_ds)
        /*
         *      Hmm... this cast isn't the best thing to do.
         */
-       data = (leap_packet_t *)eap_ds->response->type.data;
+       data = (leap_packet_raw_t *)eap_ds->response->type.data;
 
        /*
         *      Some simple sanity checks on the incoming packet.
@@ -243,7 +243,7 @@ static int eapleap_ntpwdhash(unsigned char *ntpwdhash, VALUE_PAIR *password)
 /*
  *     Verify the MS-CHAP response from the user.
  */
-int eapleap_stage4(LEAP_PACKET *packet, VALUE_PAIR* password,
+int eapleap_stage4(Leap_packet_t *packet, VALUE_PAIR* password,
                   leap_session_t *session)
 {
        unsigned char ntpwdhash[16];
@@ -278,14 +278,14 @@ int eapleap_stage4(LEAP_PACKET *packet, VALUE_PAIR* password,
 /*
  *     Verify ourselves to the AP
  */
-LEAP_PACKET *eapleap_stage6(LEAP_PACKET *packet, REQUEST *request,
+Leap_packet_t *eapleap_stage6(Leap_packet_t *packet, REQUEST *request,
                            VALUE_PAIR *user_name, VALUE_PAIR* password,
                            leap_session_t *session, VALUE_PAIR **reply_vps)
 {
        size_t i;
        unsigned char ntpwdhash[16], ntpwdhashhash[16];
        unsigned char buffer[256];
-       LEAP_PACKET *reply;
+       Leap_packet_t *reply;
        unsigned char *p;
        VALUE_PAIR *vp;
 
@@ -388,10 +388,10 @@ LEAP_PACKET *eapleap_stage6(LEAP_PACKET *packet, REQUEST *request,
  *     If an EAP LEAP request needs to be initiated then
  *     create such a packet.
  */
-LEAP_PACKET *eapleap_initiate(UNUSED EAP_DS *eap_ds, VALUE_PAIR *user_name)
+Leap_packet_t *eapleap_initiate(UNUSED EAP_DS *eap_ds, VALUE_PAIR *user_name)
 {
        int i;
-       LEAP_PACKET     *reply;
+       Leap_packet_t   *reply;
 
        reply = eapleap_alloc();
        if (reply == NULL)  {
@@ -442,9 +442,9 @@ LEAP_PACKET *eapleap_initiate(UNUSED EAP_DS *eap_ds, VALUE_PAIR *user_name)
 /*
  * compose the LEAP reply packet in the EAP reply typedata
  */
-int eapleap_compose(EAP_DS *eap_ds, LEAP_PACKET *reply)
+int eapleap_compose(EAP_DS *eap_ds, Leap_packet_t *reply)
 {
-       leap_packet_t *data;
+       leap_packet_raw_t *data;
 
        /*
         *  We need the name and the challenge.
@@ -460,7 +460,7 @@ int eapleap_compose(EAP_DS *eap_ds, LEAP_PACKET *reply)
                        radlog(L_ERR, "rlm_eap_leap: out of memory");
                        return 0;
                }
-               data = (leap_packet_t *) eap_ds->request->type.data;
+               data = (leap_packet_raw_t *) eap_ds->request->type.data;
                data->version = 0x01;
                data->unused = 0;
                data->count = reply->count;
index eb23f57d518f512cdb2eea2d737d5793d6215a00..0b7d19546057ef6c64bc3757d92123c06407e072 100644 (file)
@@ -26,7 +26,7 @@ RCSIDH(eap_leap_h, "$Id$")
  */
 
 /* eap packet structure */
-typedef struct leap_packet_t {
+typedef struct leap_packet_raw_t {
        /*
         *  EAP header, followed by type comes before this.
         */
@@ -34,7 +34,7 @@ typedef struct leap_packet_t {
        uint8_t unused;
        uint8_t count;
        uint8_t challenge[1];   /* 8 or 24, followed by user name */
-} leap_packet_t;
+} leap_packet_raw_t;
 
 /*
  *     Which is decoded into this.
@@ -47,7 +47,7 @@ typedef struct leap_packet {
        unsigned char   *challenge;
        int             name_len;
        char            *name;
-} LEAP_PACKET;
+} Leap_packet_t;
 
 /*
  *     The information which must be kept around
@@ -61,15 +61,15 @@ typedef struct leap_session_t {
 
 /* function declarations here */
 
-LEAP_PACKET    *eapleap_alloc(void);
-void           eapleap_free(LEAP_PACKET **leap_packet_ptr);
+Leap_packet_t  *eapleap_alloc(void);
+void           eapleap_free(Leap_packet_t **leap_packet_ptr);
 
-int            eapleap_compose(EAP_DS *auth, LEAP_PACKET *reply);
-LEAP_PACKET    *eapleap_extract(EAP_DS *auth);
-LEAP_PACKET    *eapleap_initiate(EAP_DS *eap_ds, VALUE_PAIR *user_name);
-int            eapleap_stage4(LEAP_PACKET *packet, VALUE_PAIR* password,
+int            eapleap_compose(EAP_DS *auth, Leap_packet_t *reply);
+Leap_packet_t  *eapleap_extract(EAP_DS *auth);
+Leap_packet_t  *eapleap_initiate(EAP_DS *eap_ds, VALUE_PAIR *user_name);
+int            eapleap_stage4(Leap_packet_t *packet, VALUE_PAIR* password,
                               leap_session_t *session);
-LEAP_PACKET    *eapleap_stage6(LEAP_PACKET *packet, REQUEST *request,
+Leap_packet_t  *eapleap_stage6(Leap_packet_t *packet, REQUEST *request,
                                VALUE_PAIR *user_name, VALUE_PAIR* password,
                                leap_session_t *session,
                                VALUE_PAIR **reply_vps);
index f62480f47d11aaf4f6c970ef992b37e0941293cf..bcbb77fba209c4f927b0a4bfa1e372735363f610 100644 (file)
@@ -41,7 +41,7 @@ RCSID("$Id$")
 static int leap_initiate(UNUSED void *instance, EAP_HANDLER *handler)
 {
        leap_session_t  *session;
-       LEAP_PACKET     *reply;
+       Leap_packet_t   *reply;
 
        DEBUG2("  rlm_eap_leap: Stage 2");
 
@@ -92,8 +92,8 @@ static int leap_authenticate(UNUSED void *instance, EAP_HANDLER *handler)
 {
        int             rcode;
        leap_session_t  *session;
-       LEAP_PACKET     *packet;
-       LEAP_PACKET     *reply;
+       Leap_packet_t   *packet;
+       Leap_packet_t   *reply;
        VALUE_PAIR      *password;
 
        if (!handler->opaque) {
index 833b2c3b60883b75569f7453a77c712d31143381..f4bfd275e791a86ab43a337e5556352b60ffa206 100644 (file)
@@ -100,7 +100,7 @@ static int eappeap_success(EAP_HANDLER *handler, tls_session_t *tls_session)
 
 static int eappeap_identity(EAP_HANDLER *handler, tls_session_t *tls_session)
 {
-       eap_packet_t eap_packet;
+       eap_packet_raw_t eap_packet;
 
        eap_packet.code = PW_EAP_REQUEST;
        eap_packet.id = handler->eap_ds->response->id + 1;
@@ -210,7 +210,7 @@ done:
 static int eapmessage_verify(REQUEST *request,
                             const uint8_t *data, unsigned int data_len)
 {
-       const eap_packet_t *eap_packet = (const eap_packet_t *) data;
+       const eap_packet_raw_t *eap_packet = (const eap_packet_raw_t *) data;
        uint8_t eap_type;
        char buffer[256];
 
@@ -255,7 +255,7 @@ static int eapmessage_verify(REQUEST *request,
        case PW_EAP_MSCHAPV2:
        default:
                RDEBUG2("EAP type %s",
-                      eaptype_type2name(eap_type,
+                      eap_type_data_type2name(eap_type,
                                         buffer, sizeof(buffer)));
                return 1;
                break;
@@ -387,7 +387,7 @@ static int vp2eap(REQUEST *request, tls_session_t *tls_session, VALUE_PAIR *vp)
 static int eappeap_check_tlv(REQUEST *request, const uint8_t *data,
                             size_t data_len)
 {
-       const eap_packet_t *eap_packet = (const eap_packet_t *) data;
+       const eap_packet_raw_t *eap_packet = (const eap_packet_raw_t *) data;
 
        if (data_len < 11) return 0;
 
index cc663ddcd704245c78bbaef3fefa732bbf67119a..35df9c0263df7c2de52fd161588e835153128d4b 100644 (file)
@@ -302,7 +302,7 @@ eap_pwd_authenticate (void *arg, EAP_HANDLER *handler)
     pwd_session_t *pwd_session;
     pwd_hdr *hdr;
     pwd_id_packet *id;
-    EAP_PACKET *response;
+    eap_packet_t *response;
     REQUEST *request, *fake;
     VALUE_PAIR *pw, **outvps, *vp;
     EAP_DS *eap_ds;