ASCII NUL in NAS-Filter-Rule
Hi All My nas box can use attribute NAS-Filter-Rule from radius server to construct filter rules per subscriber "on the fly". Accodingly to rfc 4849 this attribute should contain ascii NUL (0x00) as a delimiter between individual filter rules and at the end of rules. Freeradius define this attribute as a string and I do not know how to create valid string with nul character. I changed attribute type to octets and successfully add null character but a whole string converted to hex also and attribute was not readable. How to send nul character without changing attribute type ?
Is my question about sending ascii nul in string attribute is wrong or nobody run into this situation ?
Hi All
My nas box can use attribute NAS-Filter-Rule from radius server to construct filter rules per subscriber "on the fly". Accodingly to rfc 4849 this attribute should contain ascii NUL (0x00) as a delimiter between individual filter rules and at the end of rules. Freeradius define this attribute as a string and I do not know how to create valid string with nul character. I changed attribute type to octets and successfully add null character but a whole string converted to hex also and attribute was not readable. How to send nul character without changing attribute type ? - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
.
Just a guess, but is sounds like a "string array" to me. char **string_array ; Look up malloc and related functions to designate space for additions to the array. This is NOT how you do it but this is the general idea : $string_array[0] = "filter entry 1" ; $string_array[1] = "filter entry 2" ; An "automated" way of "creating" a string array is to use a delimited the use index or rindex to find the delimiter then replace the delimiter with '\0'. If you have experienced programing in C, you should know how to find all the functions required to carry this out. On 2011-Apr-20, at 06:38, Ruslan Pustovoytov wrote:
Is my question about sending ascii nul in string attribute is wrong or nobody run into this situation ?
Hi All
My nas box can use attribute NAS-Filter-Rule from radius server to construct filter rules per subscriber "on the fly". Accodingly to rfc 4849 this attribute should contain ascii NUL (0x00) as a delimiter between individual filter rules and at the end of rules. Freeradius define this attribute as a string and I do not know how to create valid string with nul character. I changed attribute type to octets and successfully add null character but a whole string converted to hex also and attribute was not readable. How to send nul character without changing attribute type ? - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
.
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
-- Guy Fraser Network Administrator The Internet Centre 1-888-450-6787 (780)450-6787
On 04/15/2011 09:05 AM, Ruslan Pustovoytov wrote:
Hi All
My nas box can use attribute NAS-Filter-Rule from radius server to construct filter rules per subscriber "on the fly". Accodingly to rfc 4849 this attribute should contain ascii NUL (0x00) as a delimiter between individual filter rules and at the end of rules. Freeradius define this attribute as a string and I do not know how to create valid string with nul character. I changed attribute type to octets and successfully add null character but a whole string converted to hex also and attribute was not readable. How to send nul character without changing attribute type ?
Try this: update reply { NAS-Filter-Rule = "string1\000string2" }
Phil, this construction does not send string2. I assume when freeradius see nul character it stops reading the string. Also I cannot send different rules for each customers in such manner. I found one decision for my problem. If I send additional NAS-Filter-Rule attribute equal to "0x00" after each of my own, character nul is successfully sending. Phil Mayers wrote:
On 04/15/2011 09:05 AM, Ruslan Pustovoytov wrote:
Hi All
My nas box can use attribute NAS-Filter-Rule from radius server to construct filter rules per subscriber "on the fly". Accodingly to rfc 4849 this attribute should contain ascii NUL (0x00) as a delimiter between individual filter rules and at the end of rules. Freeradius define this attribute as a string and I do not know how to create valid string with nul character. I changed attribute type to octets and successfully add null character but a whole string converted to hex also and attribute was not readable. How to send nul character without changing attribute type ?
Try this:
update reply { NAS-Filter-Rule = "string1\000string2" }
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
Ruslan Pustovoytov wrote:
Phil, this construction does not send string2. I assume when freeradius see nul character it stops reading the string. Also I cannot send different rules for each customers in such manner.
I found one decision for my problem. If I send additional NAS-Filter-Rule attribute equal to "0x00" after each of my own, character nul is successfully sending.
OK. It may be useful (eventually) to add some code making that easier to do. Alan DeKok.
participants (4)
-
Alan DeKok -
Guy Fraser -
Phil Mayers -
Ruslan Pustovoytov