best way to split by "," and interate?
Jorge Pereira
jpereiran at gmail.com
Wed Sep 16 19:45:38 CEST 2015
The problem is the empty space...
"%{explode: &Tmp-String-1 ,}" << FAIL
"%{explode:&Tmp-String-1 ,}" << OK
looks like a little bug... missing a kind of trim()
--
Jorge Pereira
On Wed, Sep 16, 2015 at 2:36 PM, Jorge Pereira <jpereiran at gmail.com> wrote:
> nothing....
>
> Wed Sep 16 17:31:41 2015 : Debug: (1) EXPAND %{redis_conf:HGET
> "radius-configurations" Develop_MacAddress}
> Wed Sep 16 17:31:41 2015 : Debug: (1) -->
> ca:de:ca:fe:00:01,aa:bb:cc:dd:ee:ff
> Wed Sep 16 17:31:41 2015 : Debug: (1) &control:Tmp-String-1 :=
> ca:de:ca:fe:00:01,aa:bb:cc:dd:ee:ff
> Wed Sep 16 17:31:41 2015 : Debug: %{explode: %{control:Tmp-String-1} ,}
> Wed Sep 16 17:31:41 2015 : Debug: Parsed xlat tree:
> Wed Sep 16 17:31:41 2015 : Debug: xlat --> explode
> Wed Sep 16 17:31:41 2015 : Debug: {
> Wed Sep 16 17:31:41 2015 : Debug: literal -->
> Wed Sep 16 17:31:41 2015 : Debug: attribute --> Tmp-String-1
> Wed Sep 16 17:31:41 2015 : Debug: literal --> ,
> Wed Sep 16 17:31:41 2015 : Debug: }
> Wed Sep 16 17:31:41 2015 : ERROR: (1) Invalid attribute name
> Wed Sep 16 17:31:41 2015 : Debug: (1) EXPAND %{explode:
> %{control:Tmp-String-1} ,}
> Wed Sep 16 17:31:41 2015 : Debug: (1) -->
> Wed Sep 16 17:31:41 2015 : Debug: %{explode: %{control:Tmp-String-1} :}
> Wed Sep 16 17:31:41 2015 : Debug: Parsed xlat tree:
> Wed Sep 16 17:31:41 2015 : Debug: xlat --> explode
> Wed Sep 16 17:31:41 2015 : Debug: {
> Wed Sep 16 17:31:41 2015 : Debug: literal -->
> Wed Sep 16 17:31:41 2015 : Debug: attribute --> Tmp-String-1
> Wed Sep 16 17:31:41 2015 : Debug: literal --> :
> Wed Sep 16 17:31:41 2015 : Debug: }
> Wed Sep 16 17:31:41 2015 : ERROR: (1) Invalid attribute name
> Wed Sep 16 17:31:41 2015 : Debug: (1) EXPAND %{explode:
> %{control:Tmp-String-1} :}
> Wed Sep 16 17:31:41 2015 : Debug: (1) -->
> Wed Sep 16 17:31:41 2015 : Debug: %{explode: %{Tmp-String-1} ,}
> Wed Sep 16 17:31:41 2015 : Debug: Parsed xlat tree:
> Wed Sep 16 17:31:41 2015 : Debug: xlat --> explode
> Wed Sep 16 17:31:41 2015 : Debug: {
> Wed Sep 16 17:31:41 2015 : Debug: literal -->
> Wed Sep 16 17:31:41 2015 : Debug: attribute --> Tmp-String-1
> Wed Sep 16 17:31:41 2015 : Debug: literal --> ,
> Wed Sep 16 17:31:41 2015 : Debug: }
> Wed Sep 16 17:31:41 2015 : ERROR: (1) Invalid attribute name
> Wed Sep 16 17:31:41 2015 : Debug: (1) EXPAND %{explode:
> %{Tmp-String-1} ,}
> Wed Sep 16 17:31:41 2015 : Debug: (1) -->
> Wed Sep 16 17:31:41 2015 : Debug: %{explode: %{Tmp-String-1} :}
> Wed Sep 16 17:31:41 2015 : Debug: Parsed xlat tree:
> Wed Sep 16 17:31:41 2015 : Debug: xlat --> explode
> Wed Sep 16 17:31:41 2015 : Debug: {
> Wed Sep 16 17:31:41 2015 : Debug: literal -->
> Wed Sep 16 17:31:41 2015 : Debug: attribute --> Tmp-String-1
> Wed Sep 16 17:31:41 2015 : Debug: literal --> :
> Wed Sep 16 17:31:41 2015 : Debug: }
> Wed Sep 16 17:31:41 2015 : ERROR: (1) Invalid attribute name
> Wed Sep 16 17:31:41 2015 : Debug: (1) EXPAND %{explode:
> %{Tmp-String-1} :}
> Wed Sep 16 17:31:41 2015 : Debug: (1) -->
>
> --
> Jorge Pereira
>
> On Wed, Sep 16, 2015 at 2:21 PM, Jorge Pereira <jpereiran at gmail.com>
> wrote:
>
>> Ah! perfect, but i can't use Tmp-String with explode?
>>
>> Wed Sep 16 17:13:27 2015 : Debug: rlm_redis (redis_conf): Released
>> connection (1)
>> Wed Sep 16 17:13:27 2015 : Debug: (0) EXPAND %{redis_conf:HGET
>> "radius-configurations" Develop_MacAddress}
>> Wed Sep 16 17:13:27 2015 : Debug: (0) -->
>> ca:de:ca:fe:00:01,aa:bb:cc:dd:ee:ff
>> *Wed Sep 16 17:13:27 2015 : Debug: (0) &control:Tmp-String-1 :=
>> ca:de:ca:fe:00:01,aa:bb:cc:dd:ee:ff*
>> Wed Sep 16 17:13:27 2015 : Debug: (0) } # update = noop
>> Wed Sep 16 17:13:27 2015 : Debug: (0) if (&control:Tmp-String-0
>> && &control:Tmp-String-1) {
>> Wed Sep 16 17:13:27 2015 : Debug: (0) if (&control:Tmp-String-0
>> && &control:Tmp-String-1) -> TRUE
>> Wed Sep 16 17:13:27 2015 : Debug: (0) if (&control:Tmp-String-0
>> && &control:Tmp-String-1) {
>> *Wed Sep 16 17:13:27 2015 : Debug: %{explode: &control:Tmp-String-1 ,}*
>> Wed Sep 16 17:13:27 2015 : Debug: Parsed xlat tree:
>> Wed Sep 16 17:13:27 2015 : Debug: xlat --> explode
>> Wed Sep 16 17:13:27 2015 : Debug: {
>> Wed Sep 16 17:13:27 2015 : Debug: literal -->
>> &control:Tmp-String-1 ,
>> Wed Sep 16 17:13:27 2015 : Debug: }
>> *Wed Sep 16 17:13:27 2015 : ERROR: (0) Invalid attribute name*
>> Wed Sep 16 17:13:27 2015 : Debug: (0) EXPAND %{explode:
>> &control:Tmp-String-1 ,}
>> Wed Sep 16 17:13:27 2015 : Debug: (0) -->
>> Wed Sep 16 17:13:27 2015 : Debug: (0) foreach
>> &control:Tmp-String-1
>> Wed Sep 16 17:13:27 2015 : Debug: (0) if (&My-Mac-Address ==
>> "%{Foreach-Variable-0}") {
>> Wed Sep 16 17:13:27 2015 : Debug: (0) EXPAND TMPL XLAT STRUCT
>> Wed Sep 16 17:13:27 2015 : Debug: (0) EXPAND
>> Foreach-Variable-0
>> Wed Sep 16 17:13:27 2015 : Debug: (0) -->
>> ca:de:ca:fe:00:01,aa:bb:cc:dd:ee:ff
>> Wed Sep 16 17:13:27 2015 : Debug: (0) EXPAND
>> %{Foreach-Variable-0}
>> Wed Sep 16 17:13:27 2015 : Debug: (0) -->
>> ca:de:ca:fe:00:01,aa:bb:cc:dd:ee:ff
>> Wed Sep 16 17:13:27 2015 : Debug: (0) if (&My-Mac-Address ==
>> "%{Foreach-Variable-0}") -> FALSE
>> Wed Sep 16 17:13:27 2015 : Debug: (0) } # foreach
>> &control:Tmp-String-1 = noop
>> Wed Sep 16 17:13:27 2015 : Debug: (0) } # if
>> (&control:Tmp-String-0 && &control:Tmp-String-1) = noop
>>
>> --
>> Jorge Pereira
>>
>> On Wed, Sep 16, 2015 at 1:54 PM, Arran Cudbard-Bell <
>> a.cudbardb at freeradius.org> wrote:
>>
>>>
>>> > On 16 Sep 2015, at 17:39, Jorge Pereira <jpereiran at gmail.com> wrote:
>>> >
>>> > Hi,
>>> >
>>> > I have a list
>>> >
>>> > update control {
>>> > &Tmp-String-0 =
>>> "aa:bb:cc:dd:ee:ff,00:11:22:33:44:55,ff:ee:dd:cc:bb:aa"
>>> > }
>>> >
>>> > And I would like to know about the best approach to split by "," and
>>> check
>>> > if match with my ${Called-Station-Id}
>>> > someone have a idea?
>>>
>>> "%{explode:&Called-Station-ID ,}"
>>>
>>> foreach &Called-Station-ID {
>>> if ("%{Foreach-Variable-0}" =~ /expr/) {
>>> <stuff>
>>> }
>>> }
>>>
>>> Arran Cudbard-Bell <a.cudbardb at freeradius.org>
>>> FreeRADIUS development team
>>>
>>> FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2
>>>
>>>
>>> -
>>> List info/subscribe/unsubscribe? See
>>> http://www.freeradius.org/list/users.html
>>>
>>
>>
>
More information about the Freeradius-Users
mailing list