mirror of
https://opendev.org/x/pyghmi
synced 2025-01-15 12:17:44 +00:00
Support 20 byte passwords
The IPMI 2.0 spec allows 20 byte passwords. If a password is less than 16 bytes, then use the 1.5 scheme as before. If between 16 and 21, then attempt IPMI 2.0 scheme. Raise when over 20. Change-Id: I25016b8608d9dbf5d436afd75bd07f0d4eed6d81
This commit is contained in:
parent
d89be6b894
commit
9dbb24236f
@ -1211,9 +1211,13 @@ class Command(object):
|
||||
data = [uid, mode_mask[mode]]
|
||||
if password:
|
||||
password = str(password)
|
||||
if len(password) > 16:
|
||||
raise Exception('password has limit of 16 chars')
|
||||
password = password.ljust(16, "\x00")
|
||||
if 21 > len(password) > 16:
|
||||
password = password.ljust(20, '\x00')
|
||||
data[0] |= 0b10000000
|
||||
elif len(password) > 20:
|
||||
raise Exception('password has limit of 20 chars')
|
||||
else:
|
||||
password = password.ljust(16, "\x00")
|
||||
data.extend([ord(x) for x in password])
|
||||
response = self.raw_command(netfn=0x06, command=0x47, data=data)
|
||||
if 'error' in response:
|
||||
|
Loading…
x
Reference in New Issue
Block a user