0001-ctl-preserve-key-length-in-py3-38240.patch
tests/test_hobo.py | ||
---|---|---|
235 | 235 |
assert pub.get_site_option('portal_agent_url', 'variables') == 'http://agents.example.net/' |
236 | 236 |
assert pub.get_site_option('portal_url', 'variables') == 'http://portal.example.net/' |
237 | 237 |
assert pub.get_site_option('test_wcs_url', 'variables') == 'http://wcs.example.net/' |
238 |
assert (pub.get_site_option('authentic.example.net', 'api-secrets') |
|
239 |
== CmdCheckHobos.shared_secret(HOBO_JSON['services'][1]['secret_key'], |
|
240 |
HOBO_JSON['services'][2]['secret_key'])) |
|
241 |
assert (pub.get_site_option('authentic.example.net', 'wscall-secrets') |
|
242 |
== CmdCheckHobos.shared_secret(HOBO_JSON['services'][1]['secret_key'], |
|
243 |
HOBO_JSON['services'][2]['secret_key'])) |
|
238 |
key = '109fca71e7dc8ec49708a08fa7c02795de13f34f7d29d27bd150f203b3e0ab40' |
|
239 |
assert pub.get_site_option('authentic.example.net', 'api-secrets') == key |
|
240 |
assert pub.get_site_option('authentic.example.net', 'wscall-secrets') == key |
|
244 | 241 |
self_domain = urlparse.urlsplit(service.get('base_url')).netloc |
245 | 242 |
assert pub.get_site_option(self_domain, 'wscall-secrets') != '0' |
246 | 243 |
wcs/ctl/check_hobos.py | ||
---|---|---|
552 | 552 |
def shared_secret(cls, secret1, secret2): |
553 | 553 |
secret1 = hashlib.sha256(force_bytes(secret1)).hexdigest() |
554 | 554 |
secret2 = hashlib.sha256(force_bytes(secret2)).hexdigest() |
555 |
return hex(int(secret1, 16) ^ int(secret2, 16))[2:-1] |
|
555 |
# rstrip('L') for py2/3 compatibility, as py2 formats number as 0x...L, and py3 as 0x... |
|
556 |
return hex(int(secret1, 16) ^ int(secret2, 16))[2:].rstrip('L') |
|
556 | 557 | |
557 | 558 | |
558 | 559 |
CmdCheckHobos.register() |
559 |
- |