Skip to content

Commit

Permalink
fix python 3.4 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
GIC-de committed Oct 19, 2019
1 parent 046cecc commit 9ba4876
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyrad/packet.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ def VerifyChapPasswd(self, userpwd):
challenge = self.authenticator
if 'CHAP-Challenge' in self:
challenge = self['CHAP-Challenge'][0]
return password == md5_constructor(b'%s%s%s' % (chapid, userpwd, challenge)).digest()
return password == md5_constructor(chapid + userpwd + challenge).digest()

def VerifyAuthRequest(self):
"""Verify request authenticator.
Expand Down
8 changes: 4 additions & 4 deletions pyrad/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ def EncodeAscendBinary(str):
terms[key] = struct.pack('B', int(value))

trailer = 8 * b'\x00'
result = b'%s%s%s\x00%s%s%s%s%s\x00%s%s%s%s\x00\x00' % (
terms['family'], terms['action'], terms['direction'], terms['src'],
terms['dst'], terms['srcl'], terms['dstl'], terms['proto'],
terms['sport'], terms['dport'], terms['sportq'], terms['dportq']) + trailer

result = b''.join((terms['family'], terms['action'], terms['direction'], b'\x00',
terms['src'], terms['dst'], terms['srcl'], terms['dstl'], terms['proto'], b'\x00',
terms['sport'], terms['dport'], terms['sportq'], terms['dportq'], b'\x00\x00', trailer))
return result


Expand Down

0 comments on commit 9ba4876

Please sign in to comment.