Skip to content

Commit

Permalink
Fix listing agent keys with forwarded agent (#363)
Browse files Browse the repository at this point in the history
Gracefully fail SSH1 agent requests
  • Loading branch information
yan4321 authored and manojampalam committed Jan 5, 2019
1 parent 54b0ce9 commit c6fa13b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions contrib/win32/win32compat/ssh-agent/agent-request.h
Original file line number Diff line number Diff line change
Expand Up @@ -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*);
Expand Down
9 changes: 8 additions & 1 deletion contrib/win32/win32compat/ssh-agent/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -175,4 +182,4 @@ process_request(struct agent_connection* con)
return r;
}

#pragma warning(pop)
#pragma warning(pop)
10 changes: 10 additions & 0 deletions contrib/win32/win32compat/ssh-agent/keyagent-request.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,16 @@ convert_blob(struct agent_connection* con, const char *blob, DWORD blen, char **

#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)
{
Expand Down

0 comments on commit c6fa13b

Please sign in to comment.