Fix listing agent keys with forwarded agent (#363)

Gracefully fail SSH1 agent requests
This commit is contained in:
Yan Tesis 2019-01-04 23:44:34 -08:00 committed by Manoj Ampalam
parent 54b0ce9b56
commit c6fa13b82e
3 changed files with 19 additions and 1 deletions

View File

@ -11,6 +11,7 @@ typedef unsigned __int64 u_int64_t;
/* key management */
int process_unsupported_request(struct sshbuf*, struct sshbuf*, struct agent_connection*);
int process_add_identity(struct sshbuf*, struct sshbuf*, struct agent_connection*);
int process_request_identities(struct sshbuf*, struct sshbuf*, struct agent_connection*);
int process_sign_request(struct sshbuf*, struct sshbuf*, struct agent_connection*);

View File

@ -134,6 +134,13 @@ process_request(struct agent_connection* con)
debug("process agent request type %d", type);
switch (type) {
case SSH_AGENTC_REQUEST_RSA_IDENTITIES:
case SSH_AGENTC_RSA_CHALLENGE:
case SSH_AGENTC_ADD_RSA_IDENTITY:
case SSH_AGENTC_REMOVE_RSA_IDENTITY:
case SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES:
r = process_unsupported_request(request, response, con);
break;
case SSH2_AGENTC_ADD_IDENTITY:
r = process_add_identity(request, response, con);
break;
@ -175,4 +182,4 @@ done:
return r;
}
#pragma warning(pop)
#pragma warning(pop)

View File

@ -115,6 +115,16 @@ done:
#define REG_KEY_SDDL L"D:P(A;; GA;;; SY)(A;; GA;;; BA)"
int
process_unsupported_request(struct sshbuf* request, struct sshbuf* response, struct agent_connection* con)
{
int r = 0;
debug("ssh protocol 1 is not supported");
if (sshbuf_put_u8(response, SSH_AGENT_FAILURE) != 0)
r = -1;
return r;
}
int
process_add_identity(struct sshbuf* request, struct sshbuf* response, struct agent_connection* con)
{