Merge pull request #394 from romanz/latest-ssh

Don't fail if not all request is parsed
This commit is contained in:
Roman Zeyde
2022-05-21 13:17:26 +03:00
committed by GitHub
2 changed files with 8 additions and 5 deletions

View File

@@ -76,5 +76,7 @@ def parse_ssh_blob(data):
public_key = util.read_frame(i)
res['public_key'] = formats.parse_pubkey(public_key)
assert not i.read()
unparsed = i.read()
if unparsed:
log.warning('unparsed blob: %r', unparsed)
return res

View File

@@ -88,7 +88,7 @@ class Handler:
msg_code('SSH_AGENTC_REQUEST_RSA_IDENTITIES'): _legacy_pubs,
msg_code('SSH2_AGENTC_REQUEST_IDENTITIES'): self.list_pubs,
msg_code('SSH2_AGENTC_SIGN_REQUEST'): self.sign_message,
msg_code('SSH_AGENTC_EXTENSION'): self.unsupported_extension,
msg_code('SSH_AGENTC_EXTENSION'): _unsupported_extension,
}
def handle(self, msg):
@@ -166,6 +166,7 @@ class Handler:
code = util.pack('B', msg_code('SSH2_AGENT_SIGN_RESPONSE'))
return util.frame(code, data)
def unsupported_extension(self, buf):
code = util.pack('B', msg_code('SSH_AGENT_EXTENSION_FAILURE'))
return util.frame(code)
def _unsupported_extension():
code = util.pack('B', msg_code('SSH_AGENT_EXTENSION_FAILURE'))
return util.frame(code)