Can unlang do this?

Chris cjl at viptalk.net
Thu Apr 24 11:20:20 CEST 2008


On Apr 24, 2008, at 1:41 AM, Alan DeKok wrote:
> Chris wrote:
>> And what would the unlang syntax be for setting the value of an
>> arbitrarily-named variable like that?
>
> $ man unlang

I have.  Several times.  Maybe I'm just an idiot.

>
>
>  It's not an "arbitrarily named variable", it's defined in the private
> FreeRADIUS dictionary.  It's a string attribute, just like anything  
> else.

I've since learned this.  Thanks.

>
>  I hate guessing games.  Is it so difficult to give an example of what
> you tried to do?

Sorry, mate.

Currently, I'm here:
authorize {
switch "%{Huntgroup-Name}" {
         case dialup {
                 update control {
                    Tmp-String-1 := "ou=accounts,dc=viptalk,dc=net"
                 }
                 ldap-localhost
         }
}
}

modules {
ldap-localhost {
	basedn = "%{Tmp-String-1}"
}
}

And getting:

	expand: %{Tmp-String-1} ->
rlm_ldap: unable to create basedn.

And trying this:

ldap-localhost {
	basedn = "%{control:Tmp-String-1}"
}

gets me closer, but I have quoting issues:

expand: %{control:Tmp-String-1} -> ou\3daccounts\2cdc\3dviptalk\2cdc 
\3dnet

I couldn't get anything to set the variable until I used an update  
section.  "man unlang" seemed to indicate control was the place to put  
it.

>  And even the example is unnecessary.  The documentation explains how
> to assign values to attributes, and gives examples of doing it.  Copy
> the examples, and change the attribute name and value.

I'm doing exactly as you're suggesting and coming up empty.

When you say "documentation" I presume you mean the sample config files.

Lots of examples for setting variables in the users file.  Not so many  
for unlang.




More information about the Freeradius-Users mailing list