Hi Folks,

Sorry to drag this old chestnut up again.

We are trying to replacing an old Windoze based FTP server with ProFTPD running on Debian, all good! The FTP server is used as patch source for a Windows based computer game and uses the now customary \ instead of / when traversing the FTP server.

Using a slightly modded version of the configuration found in this forum I can happily change this like cd \Patches to cd /Patches, all good. However annoyingly the gaming client issues a CD \ as it's first command, my guess is to escape a chroot'ed folder on the previous server. Unfortunately I can't seem to trap / replace this command and the resulting error causes the client to fail.

Any suggestions gratefully received.

Below is a manual example:

ftp x.x.x.x

Connected to x.x.x.x

220 ProFTPD 1.3.5d Server (Welcome to the EU x.x.x. Patching FTP service.) [10.1.13.15]

Name (x.x.x.x:root): ftp

331 Anonymous login ok, send your complete email address as your password

Password:

230 Anonymous access granted, restrictions apply

Remote system type is UNIX.

Using binary mode to transfer files.

ftp> cd \FTP_EraFableClientUpdate

250 CWD command successful

ftp> pwd

Remote directory: /FTP_EraFableClientUpdate

ftp> cd ..\

250 CWD command successful

ftp> pwd

Remote directory: /

ftp> cd \FTP_EraFableClientUpdate

250 CWD command successful

ftp> pwd

Remote directory: /FTP_EraFableClientUpdate

ftp> cd \ <---------- This is the command that breaks

(remote-directory)

501 Invalid number of arguments

ftp> pwd

Remote directory: /FTP_EraFableClientUpdate

ftp> quit

221 Goodbye.

Config snippet:

<IfModule mod_rewrite.c>

RewriteEngine on

RewriteLog /var/log/pfrewrite.log

RewriteMap replace int:replaceall

RewriteCondition %m CWD|STOR|PUT|GET

RewriteRule ^(.*) "${replace:!$1!\\\\!/}"

</IfModule>

Log:

017-03-07 22:09:17,493 mod_rewrite/0.9[30428]: rewrite_fixup(): skipping EPSV (no arg)

2017-03-07 22:09:17,630 mod_rewrite/0.9[30428]: rewrite_fixup(): skipping NLST (no arg)

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_fixup(): found RewriteRule

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_fixup(): examining RewriteRule conditions

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_match_cond(): original cond: '%m'

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_subst(): original pattern: '%m'

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_subst(): rule backref subst'd pattern: '%m'

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_subst(): pattern '%m' had no cond backrefs

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_subst_vars(): replacing variable '%m' with 'CWD'

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_subst(): var subst'd pattern: 'CWD'

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_parse_map_str(): parsing 'CWD'

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_subst(): maps subst'd pattern: 'CWD'

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_subst(): env subst'd pattern: 'CWD'

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_match_cond: subst'd cond: 'CWD'

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_match_cond(): checking regex cond against 'CWD'

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_fixup(): condition met

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_fixup(): executing RewriteRule

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_subst(): original pattern: '${replace:!$1!\\!/}'

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_subst_backrefs(): replacing backref '$1' with 'FTP_EraFableClientUpdate'

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_subst(): rule backref subst'd pattern: '${replace:!FTP_EraFableClientUpdate!\\!/}'

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_subst(): pattern '${replace:!$1!\\!/}' had no cond backrefs

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_subst(): var subst'd pattern: '${replace:!FTP_EraFableClientUpdate!\\!/}'

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_parse_map_str(): parsing '${replace:!FTP_EraFableClientUpdate!\\!/}'

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_subst_maps(): map name: 'replace'

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_subst_maps(): lookup key: '!FTP_EraFableClientUpdate!\\!/'

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_subst_maps(): default value: ''

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_subst_maps(): mapping '!FTP_EraFableClientUpdate!\\!/' using 'replace'

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_map_int_replaceall(): actual key: 'FTP_EraFableClientUpdate'

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_map_int_replaceall(): replacing '\\' with '/'

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_map_int_replaceall(): '\\' does not occur in given key 'FTP_EraFableClientUpdate'

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_subst_maps(): internal map 'replace' returned ''

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_subst_maps(): substituting '' for '${replace:!FTP_EraFableClientUpdate!\\!/}'

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_parse_map_str(): parsing ''

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_subst(): maps subst'd pattern: ''

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_subst(): env subst'd pattern: ''

2017-03-07 22:09:18,727 mod_rewrite/0.9[30428]: rewrite_fixup(): error processing RewriteRule

2017-03-07 22:09:18,793 mod_rewrite/0.9[30428]: rewrite_fixup(): skipping PWD (no arg)

2017-03-07 22:09:24,428 mod_rewrite/0.9[30428]: rewrite_fixup(): skipping CWD (no arg)

2017-03-07 22:09:29,912 mod_rewrite/0.9[30428]: rewrite_fixup(): skipping QUIT (no arg)