From: Alan T. DeKok Date: Fri, 6 Aug 2010 15:26:56 +0000 (+0200) Subject: Regularize error messages X-Git-Tag: release_3_0_0_beta0~1308 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=freeradius.git;a=commitdiff_plain;h=651914f3e6ec157e23d0c4c8f0badcf73a0f3ef3 Regularize error messages --- diff --git a/src/modules/rlm_eap/libeap/eapcommon.c b/src/modules/rlm_eap/libeap/eapcommon.c index 651470b..889341b 100644 --- a/src/modules/rlm_eap/libeap/eapcommon.c +++ b/src/modules/rlm_eap/libeap/eapcommon.c @@ -361,7 +361,7 @@ eap_packet_t *eap_vp2packet(VALUE_PAIR *vps) */ first = pairfind(vps, PW_EAP_MESSAGE, 0); if (first == NULL) { - radlog(L_ERR, "rlm_eap: EAP-Message not found"); + DEBUG("rlm_eap: EAP-Message not found"); return NULL; } @@ -369,7 +369,7 @@ eap_packet_t *eap_vp2packet(VALUE_PAIR *vps) * Sanity check the length before doing anything. */ if (first->length < 4) { - radlog(L_ERR, "rlm_eap: EAP packet is too short."); + DEBUG("rlm_eap: EAP packet is too short."); return NULL; } @@ -384,7 +384,7 @@ eap_packet_t *eap_vp2packet(VALUE_PAIR *vps) * Take out even more weird things. */ if (len < 4) { - radlog(L_ERR, "rlm_eap: EAP packet has invalid length."); + DEBUG("rlm_eap: EAP packet has invalid length."); return NULL; } @@ -396,7 +396,7 @@ eap_packet_t *eap_vp2packet(VALUE_PAIR *vps) total_len += vp->length; if (total_len > len) { - radlog(L_ERR, "rlm_eap: Malformed EAP packet. Length in packet header does not match actual length"); + DEBUG("rlm_eap: Malformed EAP packet. Length in packet header does not match actual length"); return NULL; } } @@ -405,7 +405,7 @@ eap_packet_t *eap_vp2packet(VALUE_PAIR *vps) * If the length is SMALLER, die, too. */ if (total_len < len) { - radlog(L_ERR, "rlm_eap: Malformed EAP packet. Length in packet header does not match actual length"); + DEBUG("rlm_eap: Malformed EAP packet. Length in packet header does not match actual length"); return NULL; } diff --git a/src/modules/rlm_eap/rlm_eap.c b/src/modules/rlm_eap/rlm_eap.c index 120e119..a4391e6 100644 --- a/src/modules/rlm_eap/rlm_eap.c +++ b/src/modules/rlm_eap/rlm_eap.c @@ -257,6 +257,11 @@ static int eap_authenticate(void *instance, REQUEST *request) inst = (rlm_eap_t *) instance; + if (!pairfind(request->packet->vps, PW_EAP_MESSAGE)) { + RDEBUG("ERROR: You set 'Auth-Type = EAP' for a request that does not contain an EAP-Message attribute!"); + return RLM_MODULE_INVALID; + } + /* * Get the eap packet to start with */ @@ -512,6 +517,8 @@ static int eap_authorize(void *instance, REQUEST *request) return RLM_MODULE_FAIL; } pairadd(&request->config_items, vp); + } else { + RDEBUG2("WARNING: Auth-Type already set. Not setting to EAP"); } if (status == EAP_OK) return RLM_MODULE_OK;