ERP: Avoid mixing of enum types
authorJouni Malinen <j@w1.fi>
Tue, 7 Jul 2015 09:09:09 +0000 (12:09 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 7 Jul 2015 13:25:06 +0000 (16:25 +0300)
Use explicit typecasting to avoid implicit conversion warnings in cases
where enum eap_erp_type is used in functions taking an EapType argument.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/eap_peer/eap.c
src/eap_server/eap_server.c

index 1dbe003..c8a1231 100644 (file)
@@ -584,7 +584,7 @@ static int eap_peer_erp_reauth_start(struct eap_sm *sm,
        wpa_printf(MSG_DEBUG, "EAP: Valid ERP key found %s (SEQ=%u)",
                   erp->keyname_nai, erp->next_seq);
 
-       msg = eap_msg_alloc(EAP_VENDOR_IETF, EAP_ERP_TYPE_REAUTH,
+       msg = eap_msg_alloc(EAP_VENDOR_IETF, (EapType) EAP_ERP_TYPE_REAUTH,
                            1 + 2 + 2 + os_strlen(erp->keyname_nai) + 1 + 16,
                            EAP_CODE_INITIATE, hdr->identifier);
        if (msg == NULL)
index 6651229..d561ad9 100644 (file)
@@ -96,7 +96,8 @@ static struct wpabuf * eap_sm_buildInitiateReauthStart(struct eap_sm *sm,
                plen += 2 + domain_len;
        }
 
-       msg = eap_msg_alloc(EAP_VENDOR_IETF, EAP_ERP_TYPE_REAUTH_START, plen,
+       msg = eap_msg_alloc(EAP_VENDOR_IETF,
+                           (EapType) EAP_ERP_TYPE_REAUTH_START, plen,
                            EAP_CODE_INITIATE, id);
        if (msg == NULL)
                return NULL;
@@ -714,8 +715,8 @@ static void erp_send_finish_reauth(struct eap_sm *sm,
        plen = 1 + 2 + 2 + os_strlen(nai);
        if (hash_len)
                plen += 1 + hash_len;
-       msg = eap_msg_alloc(EAP_VENDOR_IETF, EAP_ERP_TYPE_REAUTH, plen,
-                           EAP_CODE_FINISH, id);
+       msg = eap_msg_alloc(EAP_VENDOR_IETF, (EapType) EAP_ERP_TYPE_REAUTH,
+                           plen, EAP_CODE_FINISH, id);
        if (msg == NULL)
                return;
        wpabuf_put_u8(msg, flags);
@@ -799,7 +800,7 @@ SM_STATE(EAP, INITIATE_RECEIVED)
 
        sm->rxInitiate = FALSE;
 
-       pos = eap_hdr_validate(EAP_VENDOR_IETF, EAP_ERP_TYPE_REAUTH,
+       pos = eap_hdr_validate(EAP_VENDOR_IETF, (EapType) EAP_ERP_TYPE_REAUTH,
                               sm->eap_if.eapRespData, &len);
        if (pos == NULL) {
                wpa_printf(MSG_INFO, "EAP-Initiate: Invalid frame");