[PATCH 7/8] Be less strict in leading spaces of FEAT reply.



Some ftp servers apparently doesn't output the
exact amount of leading space specified in the RFC.

Researched by Oliver Joos. Apparently common,
one affected ftp server visible in bug #556809.
---
 daemon/gvfsbackendftp.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/daemon/gvfsbackendftp.c b/daemon/gvfsbackendftp.c
index c4b45d1..7e021f9 100644
--- a/daemon/gvfsbackendftp.c
+++ b/daemon/gvfsbackendftp.c
@@ -648,7 +648,12 @@ ftp_connection_parse_features (FtpConnection *conn)
       const char *feature = supported[i];
       if (feature[0] != ' ')
 	continue;
-      feature++;
+
+      /* There should just be one space according to RFC2389, but some
+       * servers have more so we deal with any number of leading spaces.
+       */
+      while (feature[0] == ' ')
+        feature++;
       for (j = 0; j < G_N_ELEMENTS (features); j++)
 	{
 	  if (g_ascii_strcasecmp (feature, features[j].name) == 0)
-- 
1.5.6.5



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