Skip to content

Fix listing agent keys with forwarded agent #363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per http://api.libssh.org/rfc/PROTOCOL.agent, you'll need to return a response containing SSH_AGENT_FAILURE
SSH_AGENT_FAILURE messages are also sent in reply to unknown request types.
recommend adding a routine called process_unsupported_request() and populating "response" with SSH_AGENT_FAILURE.

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