UNCLASSIFIED
-----Original Message----- From: freeradius-users-bounces+frank.ranner=defence.gov.au@lists.fre eradius.org [mailto:freeradius-users-> bounces+frank.ranner=defence.gov.au@lists.freeradius.org] On Behalf Of Josip Rodin Sent: Friday, 18 July 2008 23:19 To: FreeRadius users mailing list Subject: Re: debug log [was Re: freeradius ippool issue]
[snip]
Oh. These seemingly random expansions have always surprised me. The other day I just happened to stumble upon that when writing:
if ((Connect-Info != "NONE") && (Connect-Info < "%Y%m%d")) {
It would be good if this was documented somewhere - I actually looked in the unlang manual page for a way to get a date string, but found nothing.
So I tried running date(1) inside backticks for a start, but then I noticed that freeradius was expanding those expressions in the command line arguments. Then I tried to get the same in a normal quoted string, and it worked. Magic. :)
The unlang(5) manual says:
Double-quoted strings are expanded by inserting the value of any variables (see VARIABLES, below) before being evaluated.
However, the VARIABLES section doesn't mention that those date-format strings are actually treated as variables whose names are single letters. It does mention the results of regular expression matches, where there are eight variables whose names are single numbers, so this looks like an omission.
See variables.txt :- One-character variables ----------------------- The following one-character variables are also defined. However, they are duplicates of the previous general cases, and are only provided for backwards compatibility. They WILL BE removed in a future release. They also do NOT permit the use of conditional syntax (':-'), as described above. Variable Description Proper Equivalent -------- ----------- ---------------- %a Protocol (SLIP/PPP) %{Framed-Protocol} %c Callback-Number %{Callback-Number} %d request day (DD) [snip] %C clientname %D request date (YYYYMMDD) %H request hour %L radlog_dir %{config:logdir} %M MTU %{Framed-MTU} %R radius_dir %{config:raddbdir} %S request timestamp in SQL format %T request timestamp in database format %U Stripped User name %{Stripped-User-Name} %V Request-Authenticator (Verified/None) %Y request year (YYYY) %Z All request attributes except password (must have a big buffer) This is from 1.1.x - I assume the file still exists in version 2.x Regards, Frank Ranner