On Mon, Sep 30, 2002 at 12:30:13PM -0400, Alan DeKok wrote:
> Kevin Bonner <[EMAIL PROTECTED]> wrote:
> > I had a problem with radrelay where it segfaulted when it reached an
> > attribute of the type 'Attr-X', where X is an integer.  I could have
> > played with the dictionary file(s) to figure out what attribute it
> > was, but the information contained was not important to me.
> > Creating a patch where it skips all attributes beginning with
> > 'Attr-' fixed the problem.  I can post the patch if interested.
> 
>   I would rather figure out WHY it crashes on those attributes, and
> then fix the underlying problem, so that the attributes can be relayed
> properly.

Blah, radrelay was infact segfaulting on any A/V pair that
valuepair.c:userparse was having trouble with due to a stupid bug on my
part. Tiny patch included below to fix this.

Now radrelay will silently ignore any cruft that may have ended up in
the detail file for some reason, which is good.
The bad part is that attributes which don't have a dictionary entry when
they're added to the detail file (eg. Attr-X = "stuff" mentioned above)
will also be ignored since userparse doesn't seem to like those.

Is there any easy way included in lib/* to deal with those? If not I'll
put something together in radrelay to deal with it.

Either way, apply the patch below as a first step please, it will stop
the segfaulting.

Patch against current cvs version.

-- 
Simon



diff -urN --exclude=CVS radiusd.orig/src/main/radrelay.c radiusd/src/main/radrelay.c
--- radiusd.orig/src/main/radrelay.c    2002-08-26 20:48:37.000000000 +0200
+++ radiusd/src/main/radrelay.c 2002-10-01 22:26:43.000000000 +0200
@@ -256,13 +256,7 @@
                        }
                        if (!skip) {
                                vp = NULL;
-                               /*
-                                * FIXME: We should check that the attribute
-                                * we've read atleast remotely ressembles
-                                * a correct attribute, otherwise we run the
-                                * risk of segfaulting in userparse().
-                                */
-                               if (userparse(buf, &vp) >= 0 &&
+                               if (userparse(buf, &vp) > 0 &&
                                    (vp->attribute < 256 ||
                                     vp->attribute > 65535) &&
                                    vp->attribute != PW_VENDOR_SPECIFIC) {


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

Reply via email to