i do NOT smash the operators to '=' in paircmp(). Instead, leave
authoraland <aland>
Tue, 25 Jan 2000 15:07:01 +0000 (15:07 +0000)
committeraland <aland>
Tue, 25 Jan 2000 15:07:01 +0000 (15:07 +0000)
        them as they are, and let rlm_files take care of smashing them,
        AFTER the VALUE_PAIR list has been copied from the original.

        We need to smash the '==' and ':=' operators to '+=', so that
        when rlm_files calls pairmove(), then pairmove() WILL move the VP
items to the check_pairs list, no matter what the check operator
has been set to.

src/main/valuepair.c
src/modules/rlm_files/rlm_files.c

index 63bed34..dfb12c6 100644 (file)
@@ -173,7 +173,7 @@ int paircmp(VALUE_PAIR *request, VALUE_PAIR *check, VALUE_PAIR **reply)
                /*
                 *      If the user is setting a configuration value,
                 *      then don't bother comparing it to any attributes
-                *      sent to us by the user.
+                *      sent to us by the user.  It ALWAYS matches.
                 */
                if (check_item->operator == T_OP_SET) {
                        check_item = check_item->next;
@@ -261,7 +261,6 @@ int paircmp(VALUE_PAIR *request, VALUE_PAIR *check, VALUE_PAIR **reply)
 
                  }
 
-               check_item->operator = T_OP_EQ;
                if (result == 0)
                        check_item = check_item->next;
        }
index b1853ad..34c9920 100644 (file)
@@ -404,12 +404,18 @@ static int file_authorize(REQUEST *request, char *name,
                               pl->name, pl->lineno);
                        found = 1;
                        check_tmp = paircopy(pl->check);
+                       /*
+                        *      Smash the operators to '+=', so that
+                        *      pairmove() will do the right thing...
+                        */
+                       for (tmp = check_tmp; tmp; tmp = tmp->next) {
+                         tmp->operator = T_OP_ADD;
+                       }
                        reply_tmp = paircopy(pl->reply);
                        pairmove(reply_pairs, &reply_tmp);
                        pairmove(check_pairs, &check_tmp);
                        pairfree(reply_tmp);
-                       pairfree(check_tmp);
-
+                       pairfree(check_tmp); /* should be NULL */
                        /*
                         *      Fallthrough?
                         */
@@ -535,8 +541,10 @@ static int file_accounting(REQUEST *request)
         *      See if we have an accounting directory. If not,
         *      return.
         */
-       if (stat(radacct_dir, &st) < 0)
+       if (stat(radacct_dir, &st) < 0) {
+               DEBUG("No accounting directory %s", radacct_dir);
                return RLM_ACCT_OK;
+       }
        curtime = time(0);
 
        /*