2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-22 20:23:18 +00:00

Merge "Support 20 byte passwords"

This commit is contained in:
Jenkins 2015-07-20 14:49:09 +00:00 committed by Gerrit Code Review
commit 786eddeb18

@ -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: