From 26e624c1b7fe7dee02e5e8abeb89dac82c97811f Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 26 Aug 2011 13:22:09 +0200 Subject: 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 ;) --- src/auth.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/auth.c') 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.", -- cgit