retailnext / node-radius

Node.js RADIUS library for packet encoding and decoding.
Other
200 stars 60 forks source link

Attribute length limit #33

Closed oriaa closed 8 years ago

oriaa commented 8 years ago

There is a length limit of attribute length of 256 chars. If more than that, the code failes with the following error: value is out of bounds at TypeError () at checkInt (buffer.js:784:11) at Buffer.writeUInt8 (buffer.js:794:5) at Object.Radius.encode_attributes (radius/lib/radius.js:850:12) at Object.Radius.encode_attributes (radius/lib/radius.js:832:29) at Object.Radius._encode_with_authenticator (radius/lib/radius.js:699:20) at Object.Radius.encode (radius/lib/radius.js:662:15)

Can this limit be removed? We have to send much bigger length.

psanford commented 8 years ago

The length restriction is part of the radius protocol and not specific to this library. The radius protocol uses 1 byte to encode the length of an attribute. Therefore the you cannot store more than 256 characters in a single attribute value.

According to rfc2865 the actual length limit for an attribute is 253 characters so we should probably add an explicit check for that.

I believe the normal way that people work around this restriction is to split long fields into multiple attributes. However remember that the maximum size of a radius packet is 4096 bytes according to rfc2865.