GNOME Bugzilla – Bug 151594
Directory listings parsed wrong on windows ftp server
Last modified: 2005-01-28 13:45:48 UTC
The directory listings are not parsed correctly when connected to a Windows NT ftp server. I end up with filenames like "1009 May 17 15:58 errors.txt". The version string returned by the server is: ftp> quote syst 215 Windows_NT version 5.0 The problem seems to be that gnome-vfs is expecting the directory style to be in an msdos 'dir' style output. However, this server defaults at least to the more "standard" Unix layout (Windows is trying to behave as something of a good citizen for once, and vfs isnt expecting it :-P). It is possible to toggle the output with the "site dirstyle" command: ftp> site dirstyle 200 MSDOS-like directory output is on ftp> site dirstyle 200 MSDOS-like directory output is off "site dirstyle" only toggles msdos style on and off, you cannot say "turn on" or "turn off" Perhaps a sensible thing to do in the case of connecting to an NT server would be to execute the "site dirstyle" command before doing any directory listings, so that the directory style is known before doing parsing. I doubt it matters which style is used as it seems unlikely one style is going to give much more if any more information over the other. This is only for version 5.0; I dont know how earlier versions behave/behaved.
There is apparently a registry key in Windows to toggle the default, so it is not possible to rely on the IIS FTP server being in either mode at startup: http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q103/0/75.asp&NoWebContent=1 "site dirstyle" has apparently been supported since NT server 3.1 at least. KDE's kioslave just uses this command to toggle into Unix-style output. Is the DOS-style output parsing code in gnome-vfs redundant?
By the way, if you want to see this effect for yourself, pointing Nautilus at ftp://ftp.microsoft.com/ seems to demonstrate it fairly effectively.
Created attachment 36639 [details] [review] Patch to fix Windows NT servers I have tested this on a couple of servers and viewed the traffic under Ethereal. It seems to work properly.
> I have tested this on a couple of server Only windows servers, or did you also test unix servers (I don't see how your patch could affect unix servers, but a quick test doesn't hurt ;) Did you get a chance to test it with old (eg winnt 4.0) servers? Apart from that, this patch looks fine.
I figured you were right, and I should probably do some more comprehensive testing. As usual, Google is a great thing. By searching for login banners, I managed to turn up servers running the following: * NETWARE * Microsoft FTP v3.0 * Microsoft FTP v4.0 * Microsoft FTP v5.0 * wu-2.6.2 * sftpd * proftpd 1.2.9 * SunOS 5.8 In each of these cases the patched version runs fine.
Great, thanks for the testing ;) Can you replace the // comments with /* .. */ comments (otherwise it won't compile on some platforms). Apart from that, the patch looks fine.
Created attachment 36645 [details] [review] fixed patch to fix windows nt servers Ok, here you go.
*** Bug 155748 has been marked as a duplicate of this bug. ***
commited to HEAD, thanks