Regularize error messages
authorAlan T. DeKok <aland@freeradius.org>
Fri, 6 Aug 2010 15:26:56 +0000 (17:26 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Sat, 7 Aug 2010 07:46:27 +0000 (09:46 +0200)
src/modules/rlm_eap/libeap/eapcommon.c
src/modules/rlm_eap/rlm_eap.c

index 651470b..889341b 100644 (file)
@@ -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;
        }
 
index 120e119..a4391e6 100644 (file)
@@ -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;