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

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

[Help-gnu-radius] How to create missing attribute ?


From: Vlad -
Subject: [Help-gnu-radius] How to create missing attribute ?
Date: Sun, 05 Oct 2003 23:23:45 +0400

> > 1. Is it possible to verify attribute existence and if it  missing create 
> > it with some rules?
> > 
> > 2. How to check existance attribute in rewriting function? 
> > What value will be returned by expression 
> > 
> > if (%[Attribute])
> 
> To check for existence of an attribute, use the following construct:
> 
>  if (*%[Attribute]) ...
> 
> In your case, the rewrite function will look like:
> 
> integer
> foo()
> {
>       if (!*%[User-Name])
>          %[User-Name] = "...";
>       return 0;
> }
> 
> Invoke the function from your raddb/hints file.
> 

gnu-radius get acct-request packet from NAS, fix it and proxying
it to remote radius (Merit based).

In this configuration after right attribute User-Name radius send another one 
empty attribute User-Name (bytes 5A and 5B in dump):
And, naturally, remote radius get last User-Name.

testing with:
radtest> send acct 4 NAS-IP-Address=127.0.0.1 NAS-Port-Id=1 
Acct-Session-Id="02" Acct-Status-Type=Start

22:59:09.957988 somehost.radacct > remote_radius.radacct:  rad-account-re
q 86 [id 11] Attr[  NAS_ipaddr{localhost} NAS_port{1} Acct_session_id{02} Acct_s
tatus{#257} address@hidden User Proxy_state{........ b.........} ]
0x0000   4500 0072 80e9 0000 4011 3290 c313 ddea        address@hidden
0x0010   c383 6280 0715 0715 005e d3f6 040b 0056        ..b......^.....V
0x0020   5f94 c80f 30d5 0268 e137 b141 fef2 70e9        _...0..h.7.A..p.
0x0030   0406 7f00 0001 0506 0000 0001 2c04 3032        ............,.02
0x0040   2806 0000 0001 0114 6e6f 626f 6479 4073        (address@hidden
0x0050   6f6d 6568 6f73 742e 7275 0102 2116 eadd        omehost.ru..!...
0x0060   13c3 0b00 0000 8062 83c3 0100 007f 1500        .......b........
0x0070   0000                                           ..


I check this in two different servers. 
My config:

rewrite:
---------
integer
n_fixup()
{

       if ( *%[User-Name])
        %[User-Name] = "address@hidden";
        return 0;
}

hints:
------
DEFAULT         Rewrite-Function = "n_fixup"        NULL


radiusd: GNU Radius version 1.1 (i386-unknown-freebsd4.4)
Compilation platform: FreeBSD
Debugging flags:
Compilation flags: USE_SERVER_GUILE

-- 
Thank you

Vlad





reply via email to

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