(RADIATOR) using Util::format_special() in setVariable

Mariano Absatz radiator at lists.com.ar
Fri Oct 5 18:05:04 CDT 2001


Hi people,

I added one more level of indirection in my config files and everything went 
nuts... my  %{GlobalVar:xxx}'s went crazy.

Then I noted that the problem was that I was setting %{GlobalVar:xxx}'s whose 
contents included other %{GlobalVar:xxx}'s and this ones weren't translated...

I made a really small change to radiusd and it started working (I think)... 
Am I the first one to try to do this?

The idea is that now setVariable (in radiusd) sets the global variable to the 
value of its argument, but first calls Util::format_special() so, for my 
particular case, it can interpolate previously defined global variables, but 
you might use it for any of the %XXX stuff that make sense while parsing the 
config files...

Can this change have unwanted side-effects?

I think it's a really small and useful patch (well, if I'm the first, maybe 
my concept of useful is completely insane)
:-D

So, FWIW, here's the patch (based on 2.18.2):

# diff -C5 radiusd.ORI radiusd
*** radiusd.ORI        Fri Oct  5 19:41:09 2001
--- radiusd     Fri Oct  5 19:42:11 2001
***************
*** 275,285 ****
  # as %{GlobalVar:name}
  sub setVariable
  {
      my ($name, $value) = @_;
  
!     $main::globals{$name} = $value;
  }
  
  sub getVariable
  {
      return $main::globals{$_[0]};
--- 275,285 ----
  # as %{GlobalVar:name}
  sub setVariable
  {
      my ($name, $value) = @_;
  
!     $main::globals{$name} = &Radius::Util::format_special($value);
  }
  
  sub getVariable
  {
      return $main::globals{$_[0]};

--
Mariano Absatz
El Baby
----------------------------------------------------------
Sorry, I choose to date people higher on the food chain.

===
Archive at http://www.open.com.au/archives/radiator/
Announcements on radiator-announce at open.com.au
To unsubscribe, email 'majordomo at open.com.au' with
'unsubscribe radiator' in the body of the message.


More information about the radiator mailing list