Hello, aland!

I found bug source.

in radiusd/src/lib/filters.c we have follow code:


  1176      switch( tok ) {
  ....
  1180        case RAD_FILTER_IP:                      <--- we go here
  1181          rc = parseIpFilter( valstr, &radFil );
  1182          break;

       /* RAD_FILTER_IP and others RAD_FILTER_* defined as: */
       /* 42  #define RAD_FILTER_GENERIC      0             */
       /* 43  #define RAD_FILTER_IP           1             */
       /* 44  #define RAD_FILTER_IPX          2             */


  1214      if( rc != -1 && tok == FILTER_GENERIC_TYPE ) {
  1215          if( radFil.u.generic.more ) {
  1216              prevRadPair = pair;
  1217          }
  1218      }

  FILTER_GENERIC_TYPE specified in enum:
  
   271  typedef enum {
   272      FILTER_IP_TYPE,
   273      FILTER_GENERIC_TYPE,
   274      FILTER_IN,
  i.e. FILTER_GENERIC_TYPE == 1


  So, in line 1176 we have "switch( tok )". tok==RAD_FILTER_IP==1
  But in 1214 tok == 1 == FILTER_GENERIC_TYPE   ;-)
  
  after this "if( radFil.u.generic.more )" evaluated whith unknown condition
- radFil.u.generic.more have something from radFil.u.generic.
  In some cases "prevRadPair = pair;" executed.

I think patch must look like follow:
===============================================
--- lib.orig/filters.c       Thu Feb  8 06:04:24 2001
+++ lib/filters.c     Wed Aug 29 01:55:02 2001
@@ -269,8 +269,8 @@
 };

 typedef enum {
-    FILTER_IP_TYPE,
     FILTER_GENERIC_TYPE,
+    FILTER_IP_TYPE,
     FILTER_IN,
     FILTER_OUT,
     FILTER_FORWARD,
===============================================


  
> Michael Chernyakhovsky <[EMAIL PROTECTED]> wrote:
>> Bug in Data-Filter found.

>   Yes, there are times when it over-writes some data.

>> Something wrong in radiusd/src/lib/filters.c ?

>   Yes.

>   See the code around line 1198.  It eventually sets 'gen->more =
> FALSE', which is the problem you see.

>   I haven't come up with a generic && correct solution for it yet.
> Patches are welcome.

>   Alan DeKok.

> - 
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html



- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to