From e04da2de09b820c70f0308bab2b56571942affb8 Mon Sep 17 00:00:00 2001 From: TCL987 Date: Fri, 23 Aug 2013 09:54:37 -0700 Subject: [PATCH 1/2] Treat encrypted attributes as bytestrings to avoid UTF-8 decoding errors. --- pyrad/packet.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyrad/packet.py b/pyrad/packet.py index 53d533a..6a6cbac 100644 --- a/pyrad/packet.py +++ b/pyrad/packet.py @@ -114,7 +114,10 @@ def _DecodeValue(self, attr, value): if attr.values.HasBackward(value): return attr.values.GetBackward(value) else: - return tools.DecodeAttr(attr.type, value) + if attr.encrypt: + return tools.DecodeAttr('octets', value) + else: + return tools.DecodeAttr(attr.type, value) def _EncodeValue(self, attr, value): if attr.values.HasForward(value): From b4087246c80186df2076f71890f8b7d7f8d74e9a Mon Sep 17 00:00:00 2001 From: TCL987 Date: Fri, 23 Aug 2013 09:56:29 -0700 Subject: [PATCH 2/2] Do not include non-existent dictionary files and encrypt passwords. --- example/dictionary | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/example/dictionary b/example/dictionary index 93f4685..98758b9 100644 --- a/example/dictionary +++ b/example/dictionary @@ -36,29 +36,29 @@ # directive to the end of the file if you want to see the old names # in the logfiles too. # -$INCLUDE dictionary.compat # compability issues -$INCLUDE dictionary.acc -$INCLUDE dictionary.ascend -$INCLUDE dictionary.bay -$INCLUDE dictionary.cisco -$INCLUDE dictionary.livingston -$INCLUDE dictionary.microsoft -$INCLUDE dictionary.quintum -$INCLUDE dictionary.redback -$INCLUDE dictionary.shasta -$INCLUDE dictionary.shiva -$INCLUDE dictionary.tunnel -$INCLUDE dictionary.usr -$INCLUDE dictionary.versanet -$INCLUDE dictionary.erx -$INCLUDE dictionary.freeradius -$INCLUDE dictionary.alcatel +#$INCLUDE dictionary.compat # compability issues +#$INCLUDE dictionary.acc +#$INCLUDE dictionary.ascend +#$INCLUDE dictionary.bay +#$INCLUDE dictionary.cisco +#$INCLUDE dictionary.livingston +#$INCLUDE dictionary.microsoft +#$INCLUDE dictionary.quintum +#$INCLUDE dictionary.redback +#$INCLUDE dictionary.shasta +#$INCLUDE dictionary.shiva +#$INCLUDE dictionary.tunnel +#$INCLUDE dictionary.usr +#$INCLUDE dictionary.versanet +#$INCLUDE dictionary.erx +#$INCLUDE dictionary.freeradius +#$INCLUDE dictionary.alcatel # # Following are the proper new names. Use these. # ATTRIBUTE User-Name 1 string -ATTRIBUTE User-Password 2 string +ATTRIBUTE User-Password 2 string encrypt=1 ATTRIBUTE CHAP-Password 3 octets ATTRIBUTE NAS-IP-Address 4 ipaddr ATTRIBUTE NAS-Port 5 integer