Thanks Thomas you gave me the info I was looking for.

Best regards

Jacques


----- Message de tshinnic@io.com ---------
Date : Fri, 28 Sep 2007 01:39:58 -0500
De : "Thomas L. Shinnick"
R=E9pondre =E0 : proftp-user@lists.sourceforge.net
Objet : Re: [Proftpd-user] Filtering out certain characters in files names
=C0 : ProFTPD


> 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|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 "--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
> http://www.castaglia.org/proftpd/mod...d_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



----- Fin du message de tshinnic@io.com -----


----------------------------------------------------
Ce message a =E9t=E9 achemin=E9 par le Webmail de la CSPI.


-------------------------------------------------------------------------
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/
_______________________________________________
ProFTPD Users List
Unsubscribe problems?
http://www.proftpd.org/list-unsub.html