fix issue with hblink.py

This commit is contained in:
KF7EEL 2021-05-10 13:02:53 -07:00
parent 6ddfb2b1c1
commit 2159d09525

View File

@ -432,6 +432,9 @@ class HBSYSTEM(DatagramProtocol):
if len(self._peers) < self._config['MAX_PEERS']:
# Check for valid Radio ID
#print(self.check_user_man(_peer_id))
print('---')
print(self._config)
print('---')
if self._config['USE_USER_MAN'] == True:
self.ums_response = self.check_user_man(_peer_id)
## print(self.ums_response)
@ -441,6 +444,7 @@ class HBSYSTEM(DatagramProtocol):
user_auth = False
print(user_auth)
if self._config['USE_USER_MAN'] == False:
print('Falsae')
if acl_check(_peer_id, self._CONFIG['GLOBAL']['REG_ACL']) and acl_check(_peer_id, self._config['REG_ACL']):
user_auth = True
if user_auth == True:
@ -491,7 +495,8 @@ class HBSYSTEM(DatagramProtocol):
_this_peer['LAST_PING'] = time()
_sent_hash = _data[8:]
_salt_str = bytes_4(_this_peer['SALT'])
print(self.ums_response)
#print(self.ums_response)
if self._config['USE_USER_MAN'] == True:
try:
if self.ums_response['mode'] == 'legacy':
_calc_hash = bhex(sha256(_salt_str+self._config['PASSPHRASE']).hexdigest())
@ -510,6 +515,8 @@ class HBSYSTEM(DatagramProtocol):
calc_passphrase = base64.b64encode((_peer_id) + int(1).to_bytes(2, 'big'))
_calc_hash = bhex(sha256(_salt_str+calc_passphrase).hexdigest())
ums_down = True
if self._config['USE_USER_MAN'] == False:
_calc_hash = bhex(sha256(_salt_str+self._config['PASSPHRASE']).hexdigest())
if _sent_hash == _calc_hash or (ums_down == True and _sent_hash == _calc_hash):
_this_peer['CONNECTION'] = 'WAITING_CONFIG'
self.send_peer(_peer_id, b''.join([RPTACK, _peer_id]))