foreach attribute array

Aaron Paetznick aaronp at critd.com
Fri May 7 23:11:55 CEST 2010


I'm having some trouble working with attribute arrays.  My Cisco NASes 
don't seem to always want to send their Cisco-AVPair attribute in the 
same order, so I can't be sure I want to reference %{Cisco-AVPair[0]}, 
or %{Cisco-AVPair[1]}, or other positions.

So far, I've worked around this by doing things like this:

         if ("%{Cisco-AVPair[0]}" =~ /^client-mac-address=(.+)$/ || 
"%{Cisco-AVPair[1]}" =~ /^client-mac-address=(.+)$/) {
                 update request {
                                 Client-MAC-Address := "%{1}"
                 }
         }


I also have other Cisco-AVPairs that I'm checking, and they are also not 
always coming in a guaranteed order.

Is there a way to do a each, while, for, or foreach on an attribute array?

Thanks!


--Aaron





More information about the Freeradius-Users mailing list