summaryrefslogtreecommitdiff
path: root/daemon/gvfsbackendsftp.c
diff options
context:
space:
mode:
authorRoss Lagerwall <rosslagerwall@gmail.com>2015-07-19 08:50:22 +0100
committerRoss Lagerwall <rosslagerwall@gmail.com>2015-08-10 07:27:02 +0100
commit0da49dd9d18f8f930a20f89fdf46388dca21a0fa (patch)
tree36515ac0e187676e790a732128f55d4444bd66f9 /daemon/gvfsbackendsftp.c
parent3790e3bc20cc7880a494c2343fa3a6a489df7e1e (diff)
downloadgvfs-0da49dd9d18f8f930a20f89fdf46388dca21a0fa.tar.gz
sftp: Improve error messages on connection setup
Log all the messages from SSH's stderr. If the remote server does not have sftp setup correctly, it fails with "subsystem request failed". Report this as "Connection refused". If the error is unknown, report it as "Connection failed" rather than "SSH program unexpectedly exited" which shouldn't be exposed to users. https://bugzilla.gnome.org/show_bug.cgi?id=752403
Diffstat (limited to 'daemon/gvfsbackendsftp.c')
-rw-r--r--daemon/gvfsbackendsftp.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/daemon/gvfsbackendsftp.c b/daemon/gvfsbackendsftp.c
index c9758062..1411cea1 100644
--- a/daemon/gvfsbackendsftp.c
+++ b/daemon/gvfsbackendsftp.c
@@ -339,10 +339,11 @@ look_for_stderr_errors (Connection *conn, GError **error)
/* Error (real or WOULDBLOCK) or EOF */
g_set_error_literal (error,
G_IO_ERROR, G_IO_ERROR_FAILED,
- _("SSH program unexpectedly exited"));
+ _("Connection failed"));
return;
}
-
+
+ DEBUG ("stderr: %s\n", line);
if (strstr (line, "Permission denied") != NULL)
{
g_set_error_literal (error,
@@ -364,7 +365,8 @@ look_for_stderr_errors (Connection *conn, GError **error)
_("No route to host"));
return;
}
- else if (strstr (line, "Connection refused") != NULL)
+ else if (strstr (line, "Connection refused") != NULL ||
+ strstr (line, "subsystem request failed") != NULL)
{
g_set_error_literal (error,
G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
@@ -704,7 +706,7 @@ read_reply_sync (Connection *conn, gsize *len_out, GError **error)
{
g_set_error_literal (error,
G_IO_ERROR, G_IO_ERROR_FAILED,
- _("SSH program unexpectedly exited"));
+ _("Connection failed"));
return NULL;
}