Maaalenky bug with a locale in ftpd in FreeBSD

    Once upon a time I encountered a problem when none of the clients, such as Filezilla, Far FTP Plugin, Far Navigator and others, can display the contents of directories when connected to the server.
    FAR FTP Plugin swears that it cannot parse output, Filezilla shows files by mixing the date and file name and does not allow moving through directories.


    As it turned out, ftpd inherits the locale of the user who started or restarted the daemon via /etc/rc.d/ and gives the data in this locale to all clients that connect to the server.
    Having LANG = ru_RU.UTF-8 (ru_RU.KOI8-R) and restarting ftpd via /etc/rc.d/ftpd restart, when connected via a regular ftp client we get the following picture.

    ftp> ls test
    229 Entering Extended Passive Mode (|||64671|)
    150 Opening ASCII mode data connection for '/bin/ls'.
    total 212
    -rw-r--r-- 1 aborche wheel 15457 23 п╟п©я─ 10:51 crypttest.txt
    -rw-r--r-- 1 aborche wheel 193509 29 я▐пҐп╡ 2009 falling_into_a_black_hole.jpg
    drwxr-xr-x 2 aborche wheel 512 27 п╟п╡пЁ 11:36 geo
    drwxr-xr-x 2 aborche wheel 512 27 п╟п╡пЁ 11:36 release
    drwxr-xr-x 3 aborche wheel 512 27 п╟п╡пЁ 11:36 scripts
    226 Transfer complete.

    Accordingly, the same curve is output to all other customers who simply can not parse the received data. Therefore, the file name interferes with the date or does not show anything at all. If suddenly the client is able to use full UTF-8, then the output will still be correctly visible in the client, but the client will not be able to do anything with the files.

    when you restart ftpd with LANG = C, everything returns to square one. The problem is that start scripts do not clear the LANG value, inheriting it from the current user. Keep this in mind when setting up your servers.
    ftp> ls test
    229 Entering Extended Passive Mode (|||64395|)
    150 Opening ASCII mode data connection for '/bin/ls'.
    total 212
    -rw-r--r-- 1 aborche wheel 15457 Apr 23 10:51 crypttest.txt
    -rw-r--r-- 1 aborche wheel 193509 Jan 29 2009 falling_into_a_black_hole.jpg
    drwxr-xr-x 2 aborche wheel 512 Aug 27 11:36 geo
    drwxr-xr-x 2 aborche wheel 512 Aug 27 11:36 release
    drwxr-xr-x 3 aborche wheel 512 Aug 27 11:36 scripts
    226 Transfer complete.




    (C) Aborche 2009

    Also popular now: