Bug#650883: proftpd-basic: mod_rewrite does not replace characters if there are more than 8 occurrences

trash4regs trash4regs at gmail.com
Sun Dec 4 10:17:53 UTC 2011


Package: proftpd-basic
Version: 1.3.3a-6squeeze4
Severity: important

I have this rewrite config:
  <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteLog /var/log/ftpd/rewrite.log

    # Define a map that uses the internal "replaceall" function
    RewriteMap replace int:replaceall

    # We only want to use this rule on STOR commands
    RewriteCondition %m STOR

    # Apply the map to the command parameters
    RewriteRule ^(.*) "${replace:/$1/ /_}"
  </IfModule>

I try to upload file: "file_with spaces                             test.jpg"
But spaces not replaced.
If file name is: "file test 234.jpg" it's normally replaced to
"file_test_234.jpg"
What rewrite rule must be? I think it's a bug.

Here's rewrite.log:

Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_match_cond(): checking regex
cond
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_fixup(): last condition not
met, skipping this RewriteRule
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_fixup(): skipping PASV (no
arg)
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_fixup(): found RewriteRule
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_fixup(): examining
RewriteRule
conditions
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_match_cond(): original cond:
'%m'
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_subst(): original pattern:
'%m'
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_subst(): rule backref
subst'd
pattern: '%m'
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_subst(): pattern '%m' had no
cond backrefs
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_subst_vars(): replacing
variable '%m' with 'STOR'
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_subst(): var subst'd
pattern:
'STOR'
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_parse_map_str(): parsing
'STOR'
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_subst(): maps subst'd
pattern:
'STOR'
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_subst(): env subst'd
pattern:
'STOR'
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_match_cond: subst'd cond:
'STOR'
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_match_cond(): checking regex
cond
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_fixup(): condition met
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_fixup(): executing
RewriteRule
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_subst(): original pattern:
'${replace:/$1/ /_}'
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_subst_backrefs(): replacing
backref '$1' with 'fil            e test 234.jpg'
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_subst(): rule backref
subst'd
pattern: '${replace:/fil            e test 234.jpg/ /_}'
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_subst(): pattern
'${replace:/$1/ /_}' had no cond backrefs
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_subst(): var subst'd
pattern:
'${replace:/fil            e test 234.jpg/ /_}'
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_parse_map_str(): parsing
'${replace:/fil            e test 234.jpg/ /_}'
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_subst_maps(): map name:
'replace'
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_subst_maps(): lookup key:
'/fil
           e test 234.jpg/ /_'
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_subst_maps(): default value:
''
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_subst_maps(): mapping '/fil
       e test 234.jpg/ /_' using 'replace'
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_map_int_replaceall(): actual
key: 'fil            e test 234.jpg'
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_map_int_replaceall():
replacing
' ' with '_'
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_subst_maps(): internal map
'replace' returned 'fil            e test 234.jpg'
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_subst_maps(): substituting
'fil
           e test 234.jpg' for '${replace:/fil            e test 234.jpg/ /_}'
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_parse_map_str(): parsing ''
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_subst(): maps subst'd
pattern:
'fil            e test 234.jpg'
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_subst(): env subst'd
pattern:
'fil            e test 234.jpg'
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_fixup(): STOR arg now 'fil
      e test 234.jpg'
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_fixup(): skipping PASV (no
arg)
Ноя 26 18:53:24 mod_rewrite/0.9[15081]: rewrite_fixup(): skipping MLSD (no
arg)

This bug fixed by developer here: http://bugs.proftpd.org/show_bug.cgi?id=3721



-- System Information:
Debian Release: 6.0.3
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/1 CPU core)
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages proftpd-basic depends on:
ii  adduser               3.112+nmu2         add and remove users and groups
ii  debconf               1.5.36.1           Debian configuration management sy
ii  debianutils           3.4                Miscellaneous utilities specific t
ii  libacl1               2.2.49-4           Access control list shared library
ii  libattr1              1:2.4.44-2         Extended attribute shared library
ii  libc6                 2.11.2-10          Embedded GNU C Library: Shared lib
ii  libcap2               1:2.19-3           support for getting/setting POSIX.
ii  libncurses5           5.7+20100313-5     shared libraries for terminal hand
ii  libpam-runtime        1.1.1-6.1+squeeze1 Runtime support for the PAM librar
ii  libpam0g              1.1.1-6.1+squeeze1 Pluggable Authentication Modules l
ii  libssl0.9.8           0.9.8o-4squeeze4   SSL shared libraries
ii  libwrap0              7.6.q-19           Wietse Venema's TCP wrappers libra
ii  netbase               4.45               Basic TCP/IP networking system
ii  sed                   4.2.1-7            The GNU sed stream editor
ii  ucf                   3.0025+nmu1        Update Configuration File: preserv
ii  update-inetd          4.38+nmu1+squeeze1 inetd configuration file updater
ii  zlib1g                1:1.2.3.4.dfsg-3   compression library - runtime

proftpd-basic recommends no packages.

Versions of packages proftpd-basic suggests:
pn  openbsd-inetd | inet-su <none>           (no description available)
ii  openssl                 0.9.8o-4squeeze4 Secure Socket Layer (SSL) binary a
pn  proftpd-doc             <none>           (no description available)
pn  proftpd-mod-ldap        <none>           (no description available)
pn  proftpd-mod-mysql       <none>           (no description available)
pn  proftpd-mod-odbc        <none>           (no description available)
pn  proftpd-mod-pgsql       <none>           (no description available)
pn  proftpd-mod-sqlite      <none>           (no description available)





More information about the Pkg-proftpd-maintainers mailing list