Accessing %{client:...} in C custom module
Boris Lytochkin
lytboris at yandex-team.ru
Wed Mar 2 08:52:21 CET 2016
...
On 02.03.2016 9:54, Boris Lytochkin wrote:
> mycp = cf_pair_find(request->client->cs, "group");
>> Is request a valid pointer? Is request->client a valid pointer?
>> Is request->client->cs a valid pointer?
> Yes they are all valid.
>>
>>> results in
>>> (gdb) p *mycp
>>> $2 = {item = {next = 0xa00000038, parent = 0x8034c2330, lineno =
>>> 805314604,
>>> filename = 0x800300034 <Error reading address 0x800300034: Bad
>>> address>, type = 1919181921}, attr = 0x0,
>>> value = 0xb0000003b <Error reading address 0xb0000003b: Bad
>>> address>, op = 172, lhs_type = T_INVALID, rhs_type = 73, pass2 = 19,
>>> parsed = false}
>> Which is garbage data. You've walked off of the end of a pointer
>> somewhere.
Tried using %{client:group} in radiusd.conf:
====
server default {
...
# Authorization.
authorize {
preprocess
auth_log
reply_log
suffix
if (%{client:group} == "8021X") {
eap
}
....
}
====
running radiusd -X will result in
====
...
(7) if (%{client:group} == "8021X") {
(7) if (%{client:group} == "8021X") -> FALSE
...
====
And I am more than sure that `group` attribute is defined for this client.
Additionally, you can not check for attribute existence:
/usr/local/etc/raddb/radiusd.conf[250]: Parse error in condition
/usr/local/etc/raddb/radiusd.conf[250]: (%{client:group}) {
/usr/local/etc/raddb/radiusd.conf[250]: ^ Expected a module return code
Is this expected? I am playing with 3.0.10.
--
Boris Lytochkin
Yandex NOC
+7 (495) 739 70 00 ext. 7671
More information about the Freeradius-Devel
mailing list