Closed nward closed 3 years ago
I've subsequently added a fix for #152, and tests for it. Thanks!
I need these changes too. I also have "juniper", and I have similar error.
Thanks @nerosketch - I have no idea why I used type() rather than isinstance.. brain fart perhaps!
looks good to me - I'll try to push a new version this weekend.
The juniper/ERX dictionary from the FreeRADIUS project includes using octets attributes with values, which are written in the dictionary as integers, i.e.:
pyrad doesn't parse this at present, and errors out as
"1"
in python is not of bytes type.This PR adds this functionality, by allowing either str or bytes starting with
0x
, and checking for digits-only values, and packing them as an integer to get a bytes output the same as if the0x
integer value had been passed.Additionally, in the
EncodeOctets
function (and many Encode* function in tools.py) the parameter is calledstr
, which conflicts with the python basic string type. In the EncodeOctets function I have renamed this tooctetstring
.