EAP-TTLS: Allow TTLS to be built without MSCHAPv2 support
authorJouni Malinen <j@w1.fi>
Thu, 16 Aug 2012 16:02:44 +0000 (19:02 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 16 Aug 2012 16:02:44 +0000 (19:02 +0300)
Previously, CONFIG_EAP_MSCHAPV2=y was assumed to be set for
CONFIG_EAP_TTLS=y. Avoid this dependency by making including the
MSCHAPv2 parts in EAP-TTLS conditionally.

Signed-hostap: Jouni Malinen <j@w1.fi>

src/eap_peer/eap_ttls.c

index e09f5e5..a250c1b 100644 (file)
@@ -401,6 +401,7 @@ static int eap_ttls_phase2_request_mschapv2(struct eap_sm *sm,
                                            struct eap_method_ret *ret,
                                            struct wpabuf **resp)
 {
+#ifdef EAP_MSCHAPv2
        struct wpabuf *msg;
        u8 *buf, *pos, *challenge, *peer_challenge;
        const u8 *identity, *password;
@@ -488,6 +489,10 @@ static int eap_ttls_phase2_request_mschapv2(struct eap_sm *sm,
        }
 
        return 0;
+#else /* EAP_MSCHAPv2 */
+       wpa_printf(MSG_ERROR, "EAP-TTLS: MSCHAPv2 not included in the build");
+       return -1;
+#endif /* EAP_MSCHAPv2 */
 }
 
 
@@ -1042,6 +1047,7 @@ static int eap_ttls_process_phase2_mschapv2(struct eap_sm *sm,
                                            struct eap_method_ret *ret,
                                            struct ttls_parse_avp *parse)
 {
+#ifdef EAP_MSCHAPv2
        if (parse->mschapv2_error) {
                wpa_printf(MSG_DEBUG, "EAP-TTLS/MSCHAPV2: Received "
                           "MS-CHAP-Error - failed");
@@ -1090,6 +1096,10 @@ static int eap_ttls_process_phase2_mschapv2(struct eap_sm *sm,
         * with EAP-Success after this.
         */
        return 1;
+#else /* EAP_MSCHAPv2 */
+       wpa_printf(MSG_ERROR, "EAP-TTLS: MSCHAPv2 not included in the build");
+       return -1;
+#endif /* EAP_MSCHAPv2 */
 }