#include "eap_method.h"
-/*
- * See header
- */
-eap_type_t eap_type_from_string(char *name)
-{
- int i;
- static struct {
- char *name;
- eap_type_t type;
- } types[] = {
- {"identity", EAP_IDENTITY},
- {"md5", EAP_MD5},
- {"otp", EAP_OTP},
- {"gtc", EAP_GTC},
- {"tls", EAP_TLS},
- {"ttls", EAP_TTLS},
- {"sim", EAP_SIM},
- {"aka", EAP_AKA},
- {"mschapv2", EAP_MSCHAPV2},
- {"radius", EAP_RADIUS},
- };
-
- for (i = 0; i < countof(types); i++)
- {
- if (strcaseeq(name, types[i].name))
- {
- return types[i].type;
- }
- }
- return 0;
-}
-
ENUM(eap_code_names, EAP_REQUEST, EAP_FAILURE,
"EAP_REQUEST",
"EAP_RESPONSE",
"EAP_PEER",
);
-
-
-
*/
extern enum_name_t *eap_role_names;
-/**
- * Lookup the EAP method type from a string.
- *
- * @param name EAP method name (such as "md5", "aka")
- * @return method type, 0 if unkown
- */
-eap_type_t eap_type_from_string(char *name);
-
/**
* EAP code, type of an EAP message
*/
"HELPER_SUBJECT_HASH_URL",
);
+/*
+ * See header
+ */
+eap_type_t eap_type_from_string(char *name)
+{
+ int i;
+ static struct {
+ char *name;
+ eap_type_t type;
+ } types[] = {
+ {"identity", EAP_IDENTITY},
+ {"md5", EAP_MD5},
+ {"otp", EAP_OTP},
+ {"gtc", EAP_GTC},
+ {"tls", EAP_TLS},
+ {"ttls", EAP_TTLS},
+ {"sim", EAP_SIM},
+ {"aka", EAP_AKA},
+ {"mschapv2", EAP_MSCHAPV2},
+ {"radius", EAP_RADIUS},
+ };
+
+ for (i = 0; i < countof(types); i++)
+ {
+ if (strcaseeq(name, types[i].name))
+ {
+ return types[i].type;
+ }
+ }
+ return 0;
+}
+
typedef struct private_auth_cfg_t private_auth_cfg_t;
/**
*/
extern enum_name_t *eap_type_short_names;
+/**
+ * Lookup the EAP method type from a string.
+ *
+ * @param name EAP method name (such as "md5", "aka")
+ * @return method type, 0 if unkown
+ */
+eap_type_t eap_type_from_string(char *name);
+
/**
* Authentication config to use during authentication process.
*
}
break;
}
- if (streq(kw->value, "aka"))
- {
- conn->eap_type = 23;
- }
- else if (streq(kw->value, "sim"))
- {
- conn->eap_type = 18;
- }
- else if (streq(kw->value, "md5"))
- {
- conn->eap_type = 4;
- }
- else if (streq(kw->value, "gtc"))
- {
- conn->eap_type = 6;
- }
- else if (streq(kw->value, "tls"))
- {
- conn->eap_type = 13;
- }
- else if (streq(kw->value, "ttls"))
- {
- conn->eap_type = 21;
- }
- else if (streq(kw->value, "mschapv2"))
- {
- conn->eap_type = 26;
- }
- else if (streq(kw->value, "radius"))
- { /* pseudo-type */
- conn->eap_type = 253;
- }
- else
+ conn->eap_type = eap_type_from_string(kw->value);
+ if (conn->eap_type == 0)
{
conn->eap_type = atoi(kw->value);
if (conn->eap_type == 0)