Hi,
I am wondering if rlm_expr can be used with config items. My current guess
is that it cannot be used, though I would find it quite useful.
I am currently using CVS snapshot 20030611. My users-file looks like this
(I am using NAS-Port attribute just as an example for testing this feature):
DEFAULT NAS-Port := `%{expr: 1+1}`
Fall-Through = Yes
DEFAULT NAS-Port == 2, Auth-Type := Reject
Reply-Message := "NAS-Port was indeed calculated, and it was 2",
Fall-Through = No
DEFAULT
NAS-Port := `%{expr: 2+2}`,
Reply-Message := "NAS-Port was calculated for the reply attributes",
Fall-Through = No
Then I use radclient to send a simple authentication request and radius logs
the following:
rad_recv: Access-Request packet from host 127.0.0.1:34593, id=76, length=43
User-Name = "abc"
User-Password = "def"
modcall: entering group authorize
modcall[authorize]: module "preprocess" returns ok
rlm_realm: No '@' in User-Name = "abc", looking up realm NULL
rlm_realm: No such realm "NULL"
modcall[authorize]: module "suffix" returns noop
users: Matched DEFAULT at 1
users: Matched DEFAULT at 8
radius_xlat: Running registered xlat function of module expr for string ' 2+2'
radius_xlat: ' 2+2'
radius_xlat: '4'
...
Sending Access-Accept of id 108 to 127.0.0.1:34593
NAS-Port := 4
Reply-Message := "NAS-Port was calculated for the reply attributes"
...
ie. it matches the first entry in the users file where I would like to
calculate NAS-Port for the check items. I would think after that entry has
been processes check item NAS-Port would be set to 2, and then the next match
would be at line 4 (DEFAULT NAS-Port == 2, Auth-Type := Reject). But no, the
processing continues at line 8. rlm_expr is obviously working with reply items
as can be seen in the log file, it is correctly calculating the NAS-Port as
specified on line 9.
So now I am wondering can rlm_expr be used with check items at all, or
am I missing something obvious? Would rlm_attr_rewrite be more useful, can
it perform simple arithmetics?
--
Tero Turtiainen
Sonera Oyj
[EMAIL PROTECTED]
Tel: +358 40 702 8754
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html