help-gnu-radius
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gnu-radius] Rewrite-Function


From: Sergey Poznyakoff
Subject: Re: [Help-gnu-radius] Rewrite-Function
Date: Fri, 15 Nov 2002 11:57:19 +0200

> DEFAULT Auth-Type = SQL,
>         Simultaneous-Use = 1
>         Service-Type = Login-User,
>         Rewrite-Function = "my_function"

Rewrite-Function attribute should be used either in hints or in
huntgroups. Do not use it in raddb/users. In your example, add
the following entry to your raddb/hints:

DEFAULT       Rewrite-Function = "my_function"  NULL

This will do the trick.

A rewrite function can be called from RHS of a raddb/users profile
using the following syntax:

          Attribute = "=function_name()"

Notice the difference between this invocation and the one using
Rewrite-Function: the latter simply invokes the functon and ignores
any value it returns, whereas the former invokes the function and
assigns it return value to the attribute Attribute. An example of
such invocation might be:

          Framed-IP-Address = "=get_ip_from_pool()"

> Do I have to 
> modify something in users file so this rewrite function will apply to 
> accounting not authentication packets ?

No, you need not. Notice however, that accounting requests are passed
only through hints and huntgroups, the 'users' file has no effect
on them. It is used only for authentication requests. Therefore,
if you want your function to apply to accounting requests as well, be
sure to invoke it from huntgroups or hints.

It might also be a good idea to test for existence of an attribute
before trying to access it, e.g.:

integer
my_function()
{
        if (*%[Attribute3]) {
           %[Attribute1]="test";
           %[Attribute2]=%[Attribute3];
        }
        return 1;
}


Regards,
Sergey




reply via email to

[Prev in Thread] Current Thread [Next in Thread]