aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2011-08-26 13:22:09 +0200
committerAndreas Schneider <asn@cryptomilk.org>2011-08-26 13:34:40 +0200
commit26e624c1b7fe7dee02e5e8abeb89dac82c97811f (patch)
treefe9ecb3d9d872c25a2d0f426b8144956321da1ef
parentf8c987d1d405b249bb6e166ba9e0904e80ceb715 (diff)
downloadlibssh-26e624c1b7fe7dee02e5e8abeb89dac82c97811f.tar.gz
libssh-26e624c1b7fe7dee02e5e8abeb89dac82c97811f.tar.xz
libssh-26e624c1b7fe7dee02e5e8abeb89dac82c97811f.zip
auth: Don't fail in publickey_auto if we can't read the key.
We should go on and try the next one as it was before. Also make sure we don't leak memory ;)
-rw-r--r--src/auth.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/auth.c b/src/auth.c
index e620f98..8ce20ff 100644
--- a/src/auth.c
+++ b/src/auth.c
@@ -1103,6 +1103,7 @@ int ssh_userauth_publickey_auto(ssh_session session,
SSH_FATAL,
"Failed to read private key: %s",
privkey_file);
+ continue;
return SSH_AUTH_ERROR;
} else if (rc == SSH_EOF) {
/* If the file doesn't exist, continue */
@@ -1155,13 +1156,15 @@ int ssh_userauth_publickey_auto(ssh_session session,
auth_data,
&privkey);
if (rc == SSH_ERROR) {
+ ssh_key_free(pubkey);
ssh_set_error(session,
SSH_FATAL,
"Failed to read private key: %s",
privkey_file);
- return SSH_AUTH_ERROR;
+ continue;
} else if (rc == SSH_EOF) {
/* If the file doesn't exist, continue */
+ ssh_key_free(pubkey);
ssh_log(session,
SSH_LOG_PACKET,
"Private key %s doesn't exist.",