Re: evaluating unlang IF with sql results

2013-06-14 Thread Bill Schoolfield
Actually this particular issue was the parenthesis around the number. I had added them in the expression to make sure the math occurred before the logical comparison. Without them though, unlang's IF seems to evaluate the first expression (a subtraction) and ignores things afterwards. So the

Re: evaluating unlang IF with sql results

2013-06-14 Thread Alan DeKok
Bill Schoolfield wrote: Actually this particular issue was the parenthesis around the number. I had added them in the expression to make sure the math occurred before the logical comparison. The man unlang documentation describes the syntax it expects. Adding a random paranthesis won't

evaluating unlang IF with sql results

2013-06-13 Thread Bill Schoolfield
I can't seem to make this work. I'm comparing some values in the post-auth section: if((%{expr: %{check:Max-All-Session}-%{sql:select sum(acctsessiontime) from radacct where username='%{User-Name}'}}) (%{expr: %{sql:select unix_timestamp(str_to_date('%{check:Expiration}', '%%b %%d

Re: evaluating unlang IF with sql results

2013-06-13 Thread Alan DeKok
Bill Schoolfield wrote: The above code fails with a message (below) that says (Right field is not a number at: (1371158700)). I tried adding a zero to force a number interpretation but this does nothing. That error is produced by the SQL database, not by FreeRADIUS. My guess is that the