If we match a huntgroup, then add an attribute saying that
authoraland <aland>
Thu, 21 Feb 2002 19:11:01 +0000 (19:11 +0000)
committeraland <aland>
Thu, 21 Feb 2002 19:11:01 +0000 (19:11 +0000)
to the request.  This is so it can be used && examined later.

Based on a patch from Simon Allard <simon.allard@staff.ihug.co.nz>

src/modules/rlm_preprocess/rlm_preprocess.c

index 98ccf82..4a7bfbc 100644 (file)
@@ -497,6 +497,27 @@ static int huntgroup_access(PAIR_LIST *huntgroups, VALUE_PAIR *request_pairs)
                 */
                r = RLM_MODULE_REJECT;
                if (hunt_paircmp(request_pairs, i->reply) == 0) {
+                       VALUE_PAIR *vp;
+
+                       /*
+                        *  We've matched the huntgroup, so add it in
+                        *  to the list of request pairs.
+                        */
+                       vp = pairfind(request_pairs, PW_HUNTGROUP_NAME);
+                       if (!vp) {
+                               vp = paircreate(PW_HUNTGROUP_NAME,
+                                               PW_TYPE_STRING);
+                               if (!vp) {
+                                       radlog(L_ERR, "No memory");
+                                       exit(1);
+                               }
+                               
+                               strNcpy(vp->strvalue, i->name,
+                                       sizeof(vp->strvalue));
+                               vp->length = strlen(vp->strvalue);
+
+                               pairadd(&request_pairs, vp);
+                       }
                        r = RLM_MODULE_OK;
                }
                break;