Updated API for 2.2
[freeradius.git] / src / modules / rlm_soh / rlm_soh.c
index 027e0f6..00b0f60 100644 (file)
@@ -48,19 +48,19 @@ static size_t soh_xlat(UNUSED void *instance, REQUEST *request, char *fmt, char
         * FIXME: should have a #define for the attribute...
         * SoH-Supported == 2119 in dictionary.freeradius.internal
         */
-       vp[0] = pairfind(request->packet->vps, 2119);
+       vp[0] = pairfind(request->packet->vps, 2119, 0);
        if (!vp[0])
                return 0;
 
 
        if (strncasecmp(fmt, "OS", 2) == 0) {
                /* OS vendor */
-               vp[0] = pairfind(request->packet->vps, 2100);
-               vp[1] = pairfind(request->packet->vps, 2101);
-               vp[2] = pairfind(request->packet->vps, 2102);
-               vp[3] = pairfind(request->packet->vps, 2103);
-               vp[4] = pairfind(request->packet->vps, 2104);
-               vp[5] = pairfind(request->packet->vps, 2105);
+               vp[0] = pairfind(request->packet->vps, 2100, 0);
+               vp[1] = pairfind(request->packet->vps, 2101, 0);
+               vp[2] = pairfind(request->packet->vps, 2102, 0);
+               vp[3] = pairfind(request->packet->vps, 2103, 0);
+               vp[4] = pairfind(request->packet->vps, 2104, 0);
+               vp[5] = pairfind(request->packet->vps, 2105, 0);
 
                if (vp[0] && vp[0]->vp_integer == 311) {
                        if (!vp[1]) {
@@ -140,6 +140,7 @@ static int soh_instantiate(CONF_SECTION *conf, void **instance) {
 static int soh_postauth(UNUSED void * instance, REQUEST *request)
 {
 #ifdef WITH_DHCP
+       int rcode;
        VALUE_PAIR *vp;
 
        vp = pairfind(request->packet->vps, DHCP2ATTR(43));
@@ -176,7 +177,10 @@ static int soh_postauth(UNUSED void * instance, REQUEST *request)
                                        } else {
                                                RDEBUG("SoH decoding NAP from DHCP request");
                                                /* SoH payload */
-                                               soh_verify(request->packet->vps, data, vlen);
+                                               rcode = soh_verify(request, request->packet->vps, data, vlen);
+                                               if (rcode < 0) {
+                                                       return RLM_MODULE_FAIL;
+                                               }
                                        }
                                        break;
                                default:
@@ -205,7 +209,10 @@ static int soh_authorize(UNUSED void * instance, REQUEST *request)
 
        RDEBUG("SoH radius VP found");
        /* decode it */
-       rv = soh_verify(request->packet->vps, vp->vp_octets, vp->length);
+       rv = soh_verify(request, request->packet->vps, vp->vp_octets, vp->length);
+       if (rv < 0) {
+               return RLM_MODULE_FAIL;
+       }
 
        return RLM_MODULE_OK;
 }