gvfs code freeze break request



Hello there,

I would like to request code freeze break for gvfs in order to fix a
critical bug in the SFTP backend:

https://bugzilla.gnome.org/show_bug.cgi?id=629184
gvfs-1.6.3 using openssh-5.6 fails to open sftp with "Error reading from
Unix: Input/output error"

With the current code, users are unable to mount SFTP/SSH filesystem
when using password authentification (works with kerberos or private
key).

I've tested the proposed patch, did a cleanup (attached) and can confirm
it works just fine.

Once (dis-)approved, I'll also roll a 1.6.4 tarball for the final gnome
2.32.0 release.

Thanks,
-- 
Tomas Bzatek <tbzatek redhat com>

>From 4e8e85c9b86ac1fa8f333ffd30e5961f9b493bc1 Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek redhat com>
Date: Mon, 27 Sep 2010 16:10:07 +0200
Subject: [PATCH] sftp: Use poll() to cope with openssh-5.6 changes

Patch by Otto Allmendinger
See bug 629184 for details.
---
 daemon/gvfsbackendsftp.c |   22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/daemon/gvfsbackendsftp.c b/daemon/gvfsbackendsftp.c
index 76ce64b..9fecf6a 100644
--- a/daemon/gvfsbackendsftp.c
+++ b/daemon/gvfsbackendsftp.c
@@ -24,6 +24,7 @@
 #include <config.h>
 
 #include <stdlib.h>
+#include <sys/poll.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/time.h>
@@ -837,10 +838,9 @@ handle_login (GVfsBackend *backend,
   GVfsBackendSftp *op_backend = G_VFS_BACKEND_SFTP (backend);
   GInputStream *prompt_stream;
   GOutputStream *reply_stream;
-  fd_set ifds;
-  struct timeval tv;
   int ret;
   int prompt_fd;
+  struct pollfd fds[2];
   char buffer[1024];
   gsize len;
   gboolean aborted = FALSE;
@@ -864,14 +864,12 @@ handle_login (GVfsBackend *backend,
   ret_val = TRUE;
   while (1)
     {
-      FD_ZERO (&ifds);
-      FD_SET (stdout_fd, &ifds);
-      FD_SET (prompt_fd, &ifds);
+      fds[0].fd = stdout_fd;
+      fds[0].events = POLLIN;
+      fds[1].fd = prompt_fd;
+      fds[1].events = POLLIN;
       
-      tv.tv_sec = SFTP_READ_TIMEOUT;
-      tv.tv_usec = 0;
-      
-      ret = select (MAX (stdout_fd, prompt_fd)+1, &ifds, NULL, NULL, &tv);
+      ret = poll(fds, 2, SFTP_READ_TIMEOUT);
       
       if (ret <= 0)
         {
@@ -882,11 +880,11 @@ handle_login (GVfsBackend *backend,
           break;
         }
       
-      if (FD_ISSET (stdout_fd, &ifds))
+      if (fds[0].revents)
         break; /* Got reply to initial INIT request */
       
-      g_assert (FD_ISSET (prompt_fd, &ifds));
-      
+      if (!(fds[1].revents & POLLIN))
+        continue;
       
       len = g_input_stream_read (prompt_stream,
                                  buffer, sizeof (buffer) - 1,
-- 
1.7.3



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]