some patches for branch v2.1.x

Arran Cudbard-Bell a.cudbardb at freeradius.org
Wed Aug 17 13:32:42 CEST 2011


On 17 Aug 2011, at 12:34, Oliver Schröder wrote:

> Am 17.08.2011 12:01, schrieb Arran Cudbard-Bell:
>> 
>> On 17 Aug 2011, at 10:38, Oliver Schröder wrote:
>>> The original module does not create parent directories when needed. The patch fixes this behavior, so you can define filenames for logging like:
>>> 	filename = ${logdir}/whatever/%Y/%m/detail.%d
>>> 
>> 
>> There's already code to recursively create directories in /src/main please call this if you want to add the functionality.
> 
> My patch uses this code. See the attached .diff


Could you please submit it via GitHub. http://wiki.freeradius.org/GitHub

That way you get the credit/blame :)

> 
> 
>>> DEFAULT NAS-IP-Address =~ "(1.2.3.4|4.3.2.1)"
>>> 	LDap-basedn             := "ou=Service-11200,ou=people,dc=company,dc=com",
>>> 	LDap-Multimap-reply     := "RadiusReplyattrDSL",
>>> 	LDap-Multimap-check     := "RadiusCheckattrDSL"
>>> 
>>> rlm_ldap will then look for values in these fields and attach them to the reply set.
>>> 
>> 
>> No, the same can be achieved with unlang.
> 
> I have not found any documentation helping me to implement this via unlang. Can you nudge me in the right direction?


If(%{my_attribute} =~ /^([^,]+)?,?([^,]+)?,?([^,]+)?,?([^,]+)?,([^,]+)?,?([^,]+)?,?([^,]+)?,?([^,]+)?$/){
	update reply {
		my_reply_attr_0 := "%{1}"
		my_reply_attr_1 := "%{2}"
		...
	}
}

or

if(%{parent_attribute} =~ /my_attribute=([^,]+)/){
	update reply {
		my_attribute := "%{1}"
	}
}


You can still use the users file to set a reply attribute with the comma delimited value, and then process it with unlang later.

Yes it's not perfect, but unlang/regexps are pretty fast, and you're not likely to have more than a few attributes in the response.

Group the unlang statements in a policy to avoid duplication.

-Arran

Arran Cudbard-Bell
a.cudbardb at freeradius.org

RADIUS - Half the complexity of Diameter





More information about the Freeradius-Devel mailing list