Failover for SQL lookup expansions?
Brian Candler
B.Candler at pobox.com
Sat Mar 12 12:02:45 CET 2011
Phil Mayers wrote:
> Correct. Virtual modules (e.g. "redundant") do not implement the "xlat"
> function.
...
> Unfortunately the "xlat" functions in FR don't return error/success codes.
> They return "length of result string", and 0 for any failure condition,
> which means it's impossible to distinguish a failure from an empty result,
> and also that you can't use "if (ok)" constructs.
OK, thanks for that. I wonder if it would be worth coding for this, e.g.
return -1 for fail? (although that would break everything which blindly uses
it as length of string :-)
It does seem that some string expansions fail silently at the moment, which
could perhaps do with being a bit more strict. e.g. I once wrote
"%{Reply:AttrName}"
instead of
"%{reply:AttrName}"
and it produced nothing more than a 'Warning' at freeradius -X.
> You will probably need something like this:
>
> update request {
> Attrib := "%{sql1:select ...}"
> }
> if (!Attrib) {
> update request {
> Attrib := "%{sql2:select ...}"
> }
> }
Thank you. I'll see what I can do.
Regards,
Brian.
More information about the Freeradius-Users
mailing list