diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2011-08-26 13:22:09 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2011-08-26 13:34:40 +0200 |
commit | 26e624c1b7fe7dee02e5e8abeb89dac82c97811f (patch) | |
tree | fe9ecb3d9d872c25a2d0f426b8144956321da1ef /src/auth.c | |
parent | f8c987d1d405b249bb6e166ba9e0904e80ceb715 (diff) | |
download | libssh-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 ;)
Diffstat (limited to 'src/auth.c')
-rw-r--r-- | src/auth.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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.", |