In paircompare, don't get excited if the first attribute
authoraland <aland>
Tue, 23 Nov 2004 17:20:23 +0000 (17:20 +0000)
committeraland <aland>
Tue, 23 Nov 2004 17:20:23 +0000 (17:20 +0000)
doesn't exist.  It may be a "virtual" attribute, and there may
be a comparison function registered for it.

src/main/valuepair.c

index b73fb77..deeffed 100644 (file)
@@ -91,12 +91,16 @@ static int paircompare(REQUEST *req, VALUE_PAIR *request, VALUE_PAIR *check,
 
        /*
         *      See if there is a special compare function.
+        *
+        *      FIXME: use new RB-Tree code.
         */
        for (c = cmp; c; c = c->next)
                if (c->attribute == check->attribute)
                        return (c->compare)(c->instance, req, request, check,
                                check_pairs, reply_pairs);
 
+       if (!request) return -1; /* doesn't exist, don't compare it */
+
        switch(check->type) {
 #ifdef ASCEND_BINARY
                /*
@@ -362,7 +366,7 @@ int paircmp(REQUEST *req, VALUE_PAIR *request, VALUE_PAIR *check, VALUE_PAIR **r
                        case T_OP_REG_EQ:
                        {
                                int i;
-                               regmatch_t rxmatch[9];
+                               regmatch_t rxmatch[REQUEST_MAX_REGEX + 1];
 
                                /*
                                 *      Include substring matches.