Concatenating Attributes with semi-colon (;)

Alan DeKok aland at deployingradius.com
Tue Dec 7 16:34:23 CET 2021


On Dec 7, 2021, at 3:18 AM, Dean Arnold <dean at 31st.me> wrote:
> I am using FreeRadius with Google Secure LDAP & WPA2 Enterprise Auth and
> it's working great!

  That's good to hear.

> Is there a way to create a semi-colon (;) delimiter list from a multi
> valued attribute?

  Um... no.  :(

  So I've added it to v3.0.x branch on GitHub:

https://github.com/FreeRADIUS/freeradius-server/commit/b8ad37d305b1c55ab22fda0fd1089530be708e1c

  That patch *should* apply cleanly to 3.0.20 or later. But whatever you do, you'll have to re-build the server with the patch.

> Thank you in advance.
> 
> This is my default site post-auth:
> 
>        foreach &reply:ldapMemberOf {
>                if ("%{Foreach-Variable-0}" =~ /cn=([^,=]+)/) {
>                        update reply { classMemberOf += "%{1}" }
>                }
>        }
>        update reply { Class = "%{reply:classMemberOf[*]}"

  You can also do:

       foreach &reply:ldapMemberOf {
               if ("%{Foreach-Variable-0}" =~ /cn=([^,=]+)/) {
                       update reply { classMemberOf := "%{classMemberOf};%{1}" }
               }
       }

  Which should work.  But it's a little fugly.

  I've added:

	%{concat:foo[*] ;}

  So you could  do:

       foreach &reply:ldapMemberOf {
               if ("%{Foreach-Variable-0}" =~ /cn=([^,=]+)/) {
                       update reply { classMemberOf += "%{1}" }
               }
       }
	update reply {
		Class += %{concat:reply:classMemberOf[*] ;}"
	}

  And that would work.

  Alan DeKok.




More information about the Freeradius-Users mailing list