2
0
mirror of https://opendev.org/x/pyghmi synced 2025-07-24 13:11:11 +00:00

Ignore packet overrun in RAKP2 and RAKP4

At least one BMC with one firmware sends junk data
at the end of their RAKP2 and RAKP4 messages.  Tolerate
by ignoring that data, since it is harmless to ignore

Change-Id: I9417f26649c1be527fd9de7b648121f49452031b
This commit is contained in:
Jarrod Johnson
2015-02-18 14:10:41 -05:00
parent f0d3050a79
commit cc0559d9b9

View File

@@ -1271,7 +1271,8 @@ class Session(object):
struct.pack("2B", self.nameonly | self.privlevel, userlen) +\
self.userid
expectedhash = hmac.new(self.password, hmacdata, hashlib.sha1).digest()
givenhash = struct.pack("%dB" % len(data[40:]), *data[40:])
hashlen = len(expectedhash)
givenhash = struct.pack("%dB" % hashlen, *data[40:hashlen + 40])
if givenhash != expectedhash:
self.sessioncontext = "FAILED"
self.onlogon({'error': "Incorrect password provided"})
@@ -1337,7 +1338,8 @@ class Session(object):
self.remoteguid
expectedauthcode = hmac.new(self.sik, hmacdata,
hashlib.sha1).digest()[:12]
authcode = struct.pack("%dB" % len(data[8:]), *data[8:])
aclen = len(expectedauthcode)
authcode = struct.pack("%dB" % aclen, *data[8:aclen + 8])
if authcode != expectedauthcode:
self.onlogon({'error': "Invalid RAKP4 integrity code (wrong Kg?)"})
return