--===============1589120028==
Content-Type: multipart/alternative;
boundary="=====================_321307984==.ALT"

--=====================_321307984==.ALT
Content-Type: text/plain; charset="iso-8859-1"; format=flowed
Content-Transfer-Encoding: quoted-printable

At 11:43 PM 9/27/2007, Jacques Beaudoin wrote:
>Hi,
>
>I want to filter out certain french characters
>in the new files names that my users create,
>can that be done in proftpd.conf or in linux.
>
>For exemple replace a ' with a space


I'm not sure about how to get your special=20
characters into the proftpd.conf, but I have a=20
"replace this with that" example.

I needed to 'help' a remote application that=20
couldn't help but use Windows path separators,=20
'\' backslashes. I needed to translate those=20
into 'normal' path delimiters,=20
forward-slashes. For this I used the mod_rewrite tool.

RewriteEngine on
# Define a map that uses the internal "replaceall" function
RewriteMap replace int:replaceall
# Try handling Windows-specific filepaths, converting any embedded
# backslash char path delimiters to forward-slash chars
RewriteCondition %m=20
"^(CWD|XCWD|MKD|XMKD|RMD|XRMD|APPE|STOR|RETR|LIST|N LST|R
RewriteRule ^(.*) "${replace:!$1!\\!/}"
# The log is _very_ nice while testing and trying to understand what
# is going on, but gets big quickly. Disable for production.
# RewriteLog /var/log/proftpd.rewrite.log

Once you have built/rebuilt with=20
"--with-modules=3D....:mod_rewrite:...", you still=20
need to enable the rewrite feature with the
RewriteEngine on
statement. I'm a bit hazy on 'why' the magic=20
with RewriteMap, but this allows me to use the string replacement feature.

I try to be careful which commands I do the=20
replace on, by using the RewriteCondition to say=20
only change the parameters of file-oriented=20
commands. For instance, one test I did was to=20
use backslashes in a password. Since 'PASS' is=20
not in this list the password worked just fine.

Finally there is the real magic - the=20
RewriteRule. This says to capture as the string=20
to process the entire parameter to the command=20
(that's the "^(.*)" part; hmm, maybe that=20
should've been "^(.*)$" to be more correct).

Then we have the actual replacement=20
request. Apply the 'replace' transformation to=20
the captured string value ("$1") by running the=20
regular expression "replace any backslash=20
characters with forward-slash characters".

It might be possible you could use something like
RewriteRule ^(.*) "${replace:/$1/`/ }"
RewriteRule ^(.*) "${replace:/$1/=E9/e}"
RewriteRule ^(.*) "${replace:/$1/=E8/e}"
all in sequence to do the character translations you want to do.

But unless it is just a few characters you might=20
want to investigate the map-type:txt version of=20
RewriteMap. TJ Saunders may have some helpful pointers to doing it that=
way.

The docs are=20
in doc/contrib/mod_rewrite.html and also at=20
http://www.castaglia.org/proftpd/mod...d_rewrite.html

I find the rewrite module *very* useful for=20
strange requirements like you mention. Thanks again TJ!


>Best regards
>
>Jacques-Beaudoin@cspi.qc.ca
>
>Agent d'administration
>Les services des technologies
>de l'information et des communications
>Commission scolaire de la Pointe de l'=CEle


--=====================_321307984==.ALT
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable



At 11:43 PM 9/27/2007, Jacques Beaudoin wrote:

Hi,


I want to filter out certain french characters

in the new files names that my users create,

can that be done in proftpd.conf or in linux.


For exemple replace a  '  with a space


I'm not sure about how to get your special characters into the
proftpd.conf, but I have a "replace this with that"
example.


I needed to 'help' a remote application that couldn't help but use
Windows path separators, '\' backslashes.  I needed to translate
those into 'normal' path delimiters, forward-slashes.  For this I
used the mod_rewrite tool.


  RewriteEngine     on

  # Define a map that uses the internal "replaceall"
function

  RewriteMap replace int:replaceall

  # Try handling Windows-specific filepaths, converting any
embedded

  #   backslash char path delimiters to forward-slash
chars

  RewriteCondition  %m 
"^(CWD|XCWD|MKD|XMKD|RMD|XRMD|APPE|STOR|RETR|LIST| NLST|R

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

  # The log is _very_ nice while testing and trying to understand
what

  #   is going on, but gets big quickly.  Disable for
production.

  # RewriteLog       
/var/log/proftpd.rewrite.log


Once you have built/rebuilt with
"--with-modules=3D....:mod_rewrite:...", you still need to enable
the rewrite feature with the

    RewriteEngine on

statement.  I'm a bit hazy on 'why' the magic with RewriteMap, but
this allows me to use the string replacement feature. 


I try to be careful which commands I do the replace on, by using the
RewriteCondition to say only change the parameters of file-oriented
commands.  For instance, one test I did was to use backslashes in a
password.  Since 'PASS' is not in this list the password worked just
fine.


Finally there is the real magic - the RewriteRule.  This says to
capture as the string to process the entire parameter to the command
(that's the "^(.*)" part; hmm, maybe that should've been
"^(.*)$" to be more correct). 


Then we have the actual replacement request.  Apply the 'replace'
transformation to the captured string value ("$1") by running
the regular expression "replace any backslash characters with
forward-slash characters".


It might be possible you could use something like

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

  RewriteRule       ^(.*)
"${replace:/$1/=E9/e}"

  RewriteRule       ^(.*)
"${replace:/$1/=E8/e}"

all in sequence to do the character translations you want to do.


But unless it is just a few characters you might want to investigate the
map-type:txt version of RewriteMap.   TJ Saunders may have some
helpful pointers to doing it that way.


The docs are in  doc/contrib/mod_rewrite.html  and also at
=3D"autourl">
http://www.castaglia.org/proftpd/modules/mod_rewrite.html



I find the rewrite module *very* useful for strange requirements like you
mention.  Thanks again TJ!




Best
regards


Jacques-Beaudoin@cspi.qc.ca


Agent d'administration

Les services des technologies

de l'information et des communications

Commission scolaire de la Pointe de l'=CEle



--=====================_321307984==.ALT--


--===============1589120028==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
--===============1589120028==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ProFTPD Users List
Unsubscribe problems?
http://www.proftpd.org/list-unsub.html
--===============1589120028==--