Fixed --no-auth option in rncp

This commit is contained in:
Mark Qvist 2022-07-02 09:48:15 +02:00
parent 3e70dd6134
commit 2335a71427

View File

@ -96,6 +96,8 @@ def receive_link_established(link):
link.set_resource_concluded_callback(receive_resource_concluded) link.set_resource_concluded_callback(receive_resource_concluded)
def receive_sender_identified(link, identity): def receive_sender_identified(link, identity):
global allow_all
if identity.hash in allowed_identity_hashes: if identity.hash in allowed_identity_hashes:
RNS.log("Authenticated sender", RNS.LOG_VERBOSE) RNS.log("Authenticated sender", RNS.LOG_VERBOSE)
else: else:
@ -106,14 +108,17 @@ def receive_sender_identified(link, identity):
pass pass
def receive_resource_callback(resource): def receive_resource_callback(resource):
global allow_all
sender_identity = resource.link.get_remote_identity() sender_identity = resource.link.get_remote_identity()
if sender_identity != None: if sender_identity != None:
if sender_identity.hash in allowed_identity_hashes: if sender_identity.hash in allowed_identity_hashes:
print("Allowing sender")
return True return True
print("Rejecting sender") if allow_all:
return True
return False return False
def receive_resource_started(resource): def receive_resource_started(resource):