typedef struct rlm_eap_gtc_t {
char const *challenge;
char const *auth_type_name;
- int auth_type;
- fr_dict_enum_t const *dval;
+ uint32_t auth_type;
} rlm_eap_gtc_t;
static CONF_PARSER submodule_config[] = {
*/
request->password = vp;
- unlang = cf_section_find(request->server_cs, "authenticate", inst->dval->alias);
+ unlang = cf_section_find(request->server_cs, "authenticate", inst->auth_type_name);
if (!unlang) {
/*
* Call the authenticate section of the *current* virtual server.
*/
- rcode = process_authenticate(inst->dval->value->vb_uint32, request);
+ rcode = process_authenticate(inst->auth_type, request);
if (rcode != RLM_MODULE_OK) {
eap_round->request->code = FR_EAP_CODE_FAILURE;
return rcode;
cf_log_err_by_name(cs, "auth_type", "Unknown Auth-Type %s", inst->auth_type_name);
return -1;
}
- inst->dval = dval;
+ inst->auth_type = dval->value->vb_uint32;
+ inst->auth_type_name = dval->alias; /* Corrects case mismatches */
return 0;
}
#include <freeradius-devel/rad_assert.h>
typedef struct rlm_eap_mschapv2_t {
- bool with_ntdomain_hack;
- bool send_error;
- char const *identity;
- int auth_type_mschap;
+ bool with_ntdomain_hack;
+ bool send_error;
+ char const *identity;
+ int auth_type_mschap;
+ char const *auth_type_mschap_name;
} rlm_eap_mschapv2_t;
static CONF_PARSER submodule_config[] = {
VALUE_PAIR *auth_challenge, *response, *name;
rlm_eap_mschapv2_t *inst = (rlm_eap_mschapv2_t *) arg;
REQUEST *request = eap_session->request;
+ CONF_SECTION *unlang;
if (!rad_cond_assert(eap_session->inst)) return 0;
/*
* This is a wild & crazy hack.
*/
- rcode = process_authenticate(inst->auth_type_mschap, request);
+
+ unlang = cf_section_find(request->server_cs, "authenticate", inst->auth_type_mschap_name);
+ if (!unlang) {
+ rcode = process_authenticate(inst->auth_type_mschap, request);
+ } else {
+ unlang_push_section(request, unlang, RLM_MODULE_FAIL);
+ rcode = unlang_interpret_continue(request);
+ }
/*
* Delete MPPE keys & encryption policy. We don't
static int mod_instantiate(void *instance, CONF_SECTION *cs)
{
rlm_eap_mschapv2_t *inst = talloc_get_type_abort(instance, rlm_eap_mschapv2_t);
- fr_dict_enum_t const *dv;
+ fr_dict_enum_t const *enumv;
if (inst->identity && (strlen(inst->identity) > 255)) {
cf_log_err(cs, "identity is too long");
if (!inst->identity) inst->identity = talloc_asprintf(inst, "freeradius-%s", RADIUSD_VERSION_STRING);
- dv = fr_dict_enum_by_alias(NULL, fr_dict_attr_by_num(NULL, 0, FR_AUTH_TYPE), "MS-CHAP");
- if (!dv) dv = fr_dict_enum_by_alias(NULL, fr_dict_attr_by_num(NULL, 0, FR_AUTH_TYPE), "MSCHAP");
- if (!dv) {
+ enumv = fr_dict_enum_by_alias(NULL, fr_dict_attr_by_num(NULL, 0, FR_AUTH_TYPE), "MS-CHAP");
+ if (!enumv) enumv = fr_dict_enum_by_alias(NULL, fr_dict_attr_by_num(NULL, 0, FR_AUTH_TYPE), "MSCHAP");
+ if (!enumv) {
cf_log_err(cs, "Failed to find 'Auth-Type MS-CHAP' section. Cannot authenticate users.");
return -1;
}
- inst->auth_type_mschap = dv->value->vb_uint32;
+ inst->auth_type_mschap = enumv->value->vb_uint32;
+ inst->auth_type_mschap_name = enumv->alias;
return 0;
}
/*
* Process the PEAP portion of an EAP-PEAP request.
*/
-rlm_rcode_t eap_peap_process(eap_session_t *eap_session, tls_session_t *tls_session, int auth_type_eap) CC_HINT(nonnull);
+rlm_rcode_t eap_peap_process(eap_session_t *eap_session, tls_session_t *tls_session, fr_dict_enum_t const *enumv) CC_HINT(nonnull(1,2));
#endif /* _EAP_PEAP_H */
/*
* Process the pseudo-EAP contents of the tunneled data.
*/
-rlm_rcode_t eap_peap_process(eap_session_t *eap_session, tls_session_t *tls_session, int auth_type_eap)
+rlm_rcode_t eap_peap_process(eap_session_t *eap_session, tls_session_t *tls_session, fr_dict_enum_t const *enumv)
{
peap_tunnel_t *t = tls_session->opaque;
REQUEST *fake = NULL;
* done, THEN we proxy it...
*/
if (!t->proxy_tunneled_request_as_eap) {
+ CONF_SECTION *unlang;
fake->options |= RAD_REQUEST_OPTION_PROXY_EAP;
/*
* Auth-Type & EAP-Message here?
*/
- if (!auth_type_eap) {
+ if (!enumv) {
RERROR("You must set 'inner_eap_module' in the 'peap' configuration");
RERROR("This is required in order to proxy the inner EAP session.");
rcode = RLM_MODULE_REJECT;
* Run the EAP authentication.
*/
RDEBUG2("Calling authenticate in order to initiate tunneled EAP session");
- rcode = process_authenticate(auth_type_eap, fake);
+
+ unlang = cf_section_find(request->server_cs, "authenticate", enumv->alias);
+ if (!unlang) {
+ rcode = process_authenticate(enumv->value->vb_uint32, fake);
+ } else {
+ unlang_push_section(request, unlang, RLM_MODULE_FAIL);
+ rcode = unlang_interpret_continue(request);
+ }
+
if (rcode == RLM_MODULE_OK) {
/*
* Authentication succeeded! Rah!
fr_tls_conf_t *tls_conf;
char const *inner_eap_module; //!< module name for inner EAP
- int auth_type_eap;
+ fr_dict_enum_t *auth_type_eap;
bool use_tunneled_reply; //!< Use the reply attributes from the tunneled session in
//!< the non-tunneled reply to the client.
"The server cannot proxy inner-tunnel EAP packets",
inst->inner_eap_module, inst->virtual_server);
} else {
- inst->auth_type_eap = dv->value->vb_uint32;
+ inst->auth_type_eap = dv;
}
return 0;