New feature in v3: cast!

Brian Candler B.Candler at pobox.com
Tue May 14 10:58:15 CEST 2013


On Mon, May 13, 2013 at 11:45:52AM -0400, Alan DeKok wrote:
>   No... this should work:
> 
> 	if (reply:Session-Timeout < 100)

Great, thank you - I have some configs I can simplify now. (But I still
don't think I can use list qualifiers in attributes returned by rlm_sql
or rlm_files, correct?)

Incidentally, I tested with

        if (reply:Framed-IP-Address =~ /./) {
                update reply {
                        Reply-Message += "Congratulations on your static IP"
                }
        }

and this works. But I get a syntax error if I change the first line to

        if (reply:Framed-IP-Address =* 0.0.0.0) {

Expected comparison at: =*
/Users/brian/Build/freeradius/etc/raddb/sites-enabled/default[69]: Errors parsing authorize section.

Looking at the 2.2.x source code, the =* operator (T_OP_CMP_TRUE) is
explicitly forbidden here:

                token = gettoken(&p, comp, sizeof(comp));
                if ((token < T_OP_NE) || (token > T_OP_CMP_EQ) ||
                    (token == T_OP_CMP_TRUE)) {
                        radlog(L_ERR, "Expected comparison at: %s", comp);
                        return FALSE;
                }

After a bit of thought, I found I could rewrite it more simply as

        if (reply:Framed-IP-Address) {
                update reply {
                        Reply-Message += "Congratulations on your static IP"
                }
        }

Still, this appears to be a minor inconsistency between unlang and checkitem
operators.

Regards,

Brian.


More information about the Freeradius-Devel mailing list