]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3102: FTP directory listing drops fist character of file names
authorMartin von Gagern <martin.vgagern@gmx.net>
Tue, 16 May 2017 06:38:36 +0000 (18:38 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 16 May 2017 06:38:36 +0000 (18:38 +1200)
src/clients/FtpGateway.cc

index 8e83f22a267e332fbf2268ee9c5ca8f21f12b01b..0ae873d54dab349cc161c079892e9552cd0edf23 100644 (file)
@@ -618,10 +618,17 @@ ftpListParseParts(const char *buf, struct Ftp::GatewayFlags flags)
                 while (strchr(w_space, *copyFrom))
                     ++copyFrom;
             } else {
-                /* XXX assumes a single space between date and filename
+                /* Handle the following four formats:
+                 * "MMM DD  YYYY Name"
+                 * "MMM DD  YYYYName"
+                 * "MMM DD YYYY  Name"
+                 * "MMM DD YYYY Name"
+                 * Assuming a single space between date and filename
                  * suggested by:  Nathan.Bailey@cc.monash.edu.au and
                  * Mike Battersby <mike@starbug.bofh.asn.au> */
-                copyFrom += strlen(tbuf) + 1;
+                copyFrom += strlen(tbuf);
+                if (strchr(w_space, *copyFrom))
+                    ++copyFrom;
             }
 
             p->name = xstrdup(copyFrom);