aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Volpe <pvolpe@redhat.com>2015-07-10 15:34:34 -0700
committerAndreas Schneider <asn@cryptomilk.org>2015-07-30 10:51:42 +0200
commitdc9c4d22ab25771cae66dc0f3f1662bfa4376cab (patch)
tree4b9ef5260102d7580724c3db2fd24d56cd171b8f /src
parent71d86be42ec5ba4217cebaea1b65bd169c77f3ce (diff)
downloadlibssh-dc9c4d22ab25771cae66dc0f3f1662bfa4376cab.tar.gz
libssh-dc9c4d22ab25771cae66dc0f3f1662bfa4376cab.tar.xz
libssh-dc9c4d22ab25771cae66dc0f3f1662bfa4376cab.zip
auth: Fix return status for ssh_userauth_agent()
BUG: https://red.libssh.org/issues/201 Return SSH_AUTH_DENIED instead of SSH_AUTH_ERROR when the provided agent offers no public keys. Signed-off-by: Peter Volpe <pvolpe@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src')
-rw-r--r--src/auth.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/auth.c b/src/auth.c
index 77b99a73..13817741 100644
--- a/src/auth.c
+++ b/src/auth.c
@@ -786,6 +786,11 @@ int ssh_userauth_agent(ssh_session session,
state = session->agent_state;
if (state->pubkey == NULL)
state->pubkey = ssh_agent_get_first_ident(session, &state->comment);
+
+ if (state->pubkey == NULL) {
+ return SSH_AUTH_DENIED;
+ }
+
while (state->pubkey != NULL) {
if(state->state == SSH_AGENT_STATE_NONE){
SSH_LOG(SSH_LOG_DEBUG,