"Walter Stroebel" <[EMAIL PROTECTED]> wrote:
> Let me rephrase the bug description:
>
> My module contains the following code to determine the length of a
> attribute:
>
> if (pair->type == PW_TYPE_STRING || pair->type == PW_TYPE_IPADDR) {
> sLen = strlen (pair->strvalue);
> } else {
> sLen = pair->length;
> }
That code is wrong. You should ALWAYS use pair->length.
> This fails, due to the type being PW_TYPE_STRING when the module
> operates in a SECONDARY FreeRadius server (ie. one that gets its
> requests proxied by the PRIMARY server).
>
> Which leaves me with these questions:
> 1. If not caused by the code in proxy.c I indicated, what is causing
> this discrepancy?
The code in proxy.c could be better (but your module is wrong, too).
The CHAP-Challenge attribute should be of type OCTETS, not of type
STRING.
But the code in proxy.c *does* set pair->length to the correct
value. If your module does 'strlen(pair->strvalue)', then your module
should be fixed.
> 2. Why is pair->length correct for numbers but not for IP addresses?
That's a bug elsewhere in the code. 'pair->length' should ALWAYS be
set to a good value. If it isn't, then the code which created the
attribute should be fixed.
> 3. Is pair->length always correct for strings?
Yes. If it isn't, then there's a bug we need to fix.
Alan DeKok.
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html