Skip to content
Snippets Groups Projects
Commit 5a128712 authored by Daniel P. Berrangé's avatar Daniel P. Berrangé
Browse files

rpc: fix handling of SSH auth failure code


The result of libssh2_userauth_password is being assigned to 'ret' in
one branch and 'rc' in the other branch. Checks are all done against the
'ret' variable, so one branch never does the correct check.

Reviewed-by: default avatarAndrea Bolognani <abologna@redhat.com>
Signed-off-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
parent a017bae1
Branches
Tags v4.9.0-rc1
No related merge requests found
......@@ -706,9 +706,9 @@ virNetSSHAuthenticatePassword(virNetSSHSessionPtr sess,
if (priv->password) {
/* tunelled password authentication */
if ((ret = libssh2_userauth_password(sess->session,
priv->username,
priv->password)) == 0) {
if ((rc = libssh2_userauth_password(sess->session,
priv->username,
priv->password)) == 0) {
ret = 0;
goto cleanup;
}
......@@ -737,7 +737,7 @@ virNetSSHAuthenticatePassword(virNetSSHSessionPtr sess,
goto cleanup;
}
if (ret != LIBSSH2_ERROR_AUTHENTICATION_FAILED)
if (rc != LIBSSH2_ERROR_AUTHENTICATION_FAILED)
break;
VIR_FREE(password);
......@@ -750,10 +750,10 @@ virNetSSHAuthenticatePassword(virNetSSHSessionPtr sess,
_("authentication failed: %s"), errmsg);
/* determine exist status */
if (ret == LIBSSH2_ERROR_AUTHENTICATION_FAILED)
return 1;
if (rc == LIBSSH2_ERROR_AUTHENTICATION_FAILED)
ret = 1;
else
return -1;
ret = -1;
cleanup:
VIR_FREE(password);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment