Commit 209a2d22 authored by Antenore Gatta's avatar Antenore Gatta

Better error handling

parent 4ca341ba
...@@ -239,13 +239,25 @@ static gint ...@@ -239,13 +239,25 @@ static gint
remmina_ssh_auth_auto_pubkey (RemminaSSH* ssh) remmina_ssh_auth_auto_pubkey (RemminaSSH* ssh)
{ {
TRACE_CALL("remmina_ssh_auth_auto_pubkey"); TRACE_CALL("remmina_ssh_auth_auto_pubkey");
gint ret; gint ret = ssh_userauth_autopubkey (ssh->session, NULL);
ret = ssh_userauth_autopubkey (ssh->session, "");
if(ret == SSH_AUTH_ERROR)
{
remmina_ssh_set_error (ssh, _("[SSH] automatic public key authentication failed: %s"));
return ret;
}
if (ret != SSH_AUTH_SUCCESS) if (ret != SSH_AUTH_SUCCESS)
{ {
remmina_ssh_set_error (ssh, _("SSH automatic public key authentication failed: %s")); remmina_ssh_set_error (ssh, _("[SSH] automatic public key authentication failed: %s"));
return 0; return ret;
}
if (ret != SSH_AUTH_PARTIAL)
{
remmina_ssh_set_error (ssh, _("[SSH] automatic public key authentication partially failed: %s"));
/* We should call remmina_ssh_auth_gui */
return ret;
} }
ssh->authenticated = TRUE; ssh->authenticated = TRUE;
...@@ -290,20 +302,20 @@ remmina_ssh_auth (RemminaSSH *ssh, const gchar *password) ...@@ -290,20 +302,20 @@ remmina_ssh_auth (RemminaSSH *ssh, const gchar *password)
switch (ssh->auth) switch (ssh->auth)
{ {
case SSH_AUTH_PASSWORD: case SSH_AUTH_PASSWORD:
return remmina_ssh_auth_password (ssh); return remmina_ssh_auth_password (ssh);
case SSH_AUTH_PUBLICKEY: case SSH_AUTH_PUBLICKEY:
return remmina_ssh_auth_pubkey (ssh); return remmina_ssh_auth_pubkey (ssh);
case SSH_AUTH_AGENT: case SSH_AUTH_AGENT:
return remmina_ssh_auth_agent (ssh); return remmina_ssh_auth_agent (ssh);
case SSH_AUTH_AUTO_PUBLICKEY: case SSH_AUTH_AUTO_PUBLICKEY:
return remmina_ssh_auth_auto_pubkey (ssh); return remmina_ssh_auth_auto_pubkey (ssh);
default: default:
return 0; return 0;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment