\0 character at the end of the attibute value (authorization request)

Peter Balsianok balsianok.peter at gmail.com
Fri Mar 24 08:15:10 CET 2017


Hi,

Version:
FreeRADIUS Version 3.0.13
Copyright (C) 1999-2017 The FreeRADIUS server project and contributors
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE
You may redistribute copies of FreeRADIUS under the terms of the
GNU General Public License
For more information about these matters, see the file named COPYRIGHT
Starting - reading configuration files ...

Some client sends value + \0 character at the end of the attribute
Calling-Station-Id (e.g. 421945411479\0 ).

I am trying to fix / workaround this issue via unlang (in pre-proxy
section):

update {
  &proxy-request:Calling-Station-Id :=
"%{string:&proxy-request:Calling-Station-Id}"
}

Debug output:
update {
(0)       EXPAND %{string:&proxy-request:Calling-Station-Id}
(0)          --> 421945411479
(0)       &proxy-request:Calling-Station-Id := 421945411479
(0)     } # update = noop

Is it good approach ?

I have tried also fix it via following peace of unlang code (doesnt work):

if (&proxy-request:Calling-Station-Id && &proxy-request:Calling-Station-Id
=~ /([0-9]+)/) {
  update {
    &proxy-request:Calling-Station-Id := "%{0}"
  }
}

Debug ouput:
if (&proxy-request:Calling-Station-Id && &proxy-request:Calling-Station-Id
=~ /([0-9]+)/) {
(0)     ERROR: regex failed: Found null in subject at offset 12.  String
unsafe for evaluation
(0)     ERROR: Failed retrieving values required to evaluate condition


Could you please give me advice how to add \0 character at the end of the
attribute value, if i want to send (test request) via radclient ?

Thank you very much.


More information about the Freeradius-Users mailing list