diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2019-10-31 16:06:06 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2019-12-09 16:08:03 +0100 |
commit | 1be68139bbf34cfce21fe36ae0328440fffcabcb (patch) | |
tree | 62ba18a16a4a137171095d5a372ef379f498f36c | |
parent | c820d2a2dcd18d58603ca41bdc0a38410227b29b (diff) | |
download | libssh-1be68139bbf34cfce21fe36ae0328440fffcabcb.tar.gz libssh-1be68139bbf34cfce21fe36ae0328440fffcabcb.tar.xz libssh-1be68139bbf34cfce21fe36ae0328440fffcabcb.zip |
agent: Return uint32_t for ssh_agent_get_ident_count()
Fixes T188
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
-rw-r--r-- | include/libssh/agent.h | 2 | ||||
-rw-r--r-- | src/agent.c | 16 |
2 files changed, 9 insertions, 9 deletions
diff --git a/include/libssh/agent.h b/include/libssh/agent.h index 0142f575..d4eefbbf 100644 --- a/include/libssh/agent.h +++ b/include/libssh/agent.h @@ -104,7 +104,7 @@ void ssh_agent_free(struct ssh_agent_struct *agent); */ int ssh_agent_is_running(struct ssh_session_struct *session); -int ssh_agent_get_ident_count(struct ssh_session_struct *session); +uint32_t ssh_agent_get_ident_count(struct ssh_session_struct *session); ssh_key ssh_agent_get_next_ident(struct ssh_session_struct *session, char **comment); diff --git a/src/agent.c b/src/agent.c index d35e45a2..4c297be4 100644 --- a/src/agent.c +++ b/src/agent.c @@ -307,7 +307,7 @@ static int agent_talk(struct ssh_session_struct *session, return 0; } -int ssh_agent_get_ident_count(struct ssh_session_struct *session) +uint32_t ssh_agent_get_ident_count(struct ssh_session_struct *session) { ssh_buffer request = NULL; ssh_buffer reply = NULL; @@ -319,19 +319,19 @@ int ssh_agent_get_ident_count(struct ssh_session_struct *session) request = ssh_buffer_new(); if (request == NULL) { ssh_set_error_oom(session); - return -1; + return 0; } if (ssh_buffer_add_u8(request, SSH2_AGENTC_REQUEST_IDENTITIES) < 0) { ssh_set_error_oom(session); ssh_buffer_free(request); - return -1; + return 0; } reply = ssh_buffer_new(); if (reply == NULL) { ssh_buffer_free(request); ssh_set_error(session, SSH_FATAL, "Not enough space"); - return -1; + return 0; } if (agent_talk(session, request, reply) < 0) { @@ -347,7 +347,7 @@ int ssh_agent_get_ident_count(struct ssh_session_struct *session) ssh_set_error(session, SSH_FATAL, "Bad authentication reply size: %d", rc); ssh_buffer_free(reply); - return -1; + return 0; } #ifdef WORDS_BIGENDIAN type = bswap_32(type); @@ -364,7 +364,7 @@ int ssh_agent_get_ident_count(struct ssh_session_struct *session) ssh_set_error(session, SSH_FATAL, "Bad authentication reply message type: %u", type); ssh_buffer_free(reply); - return -1; + return 0; } rc = ssh_buffer_get_u32(reply, &count); @@ -373,7 +373,7 @@ int ssh_agent_get_ident_count(struct ssh_session_struct *session) SSH_FATAL, "Failed to read count"); ssh_buffer_free(reply); - return -1; + return 0; } session->agent->count = ntohl(count); SSH_LOG(SSH_LOG_DEBUG, "Agent count: %d", @@ -383,7 +383,7 @@ int ssh_agent_get_ident_count(struct ssh_session_struct *session) "Too many identities in authentication reply: %d", session->agent->count); ssh_buffer_free(reply); - return -1; + return 0; } if (session->agent->ident) { |