[prev in list] [next in list] [prev in thread] [next in thread] 

List:       proftpd-users
Subject:    Re: [Proftpd-user] Filtering out certain characters in files names
From:       Jacques Beaudoin <jacques-beaudoin () cspi ! qc ! ca>
Date:       2007-09-28 6:57:49
Message-ID: 20070928025749.mgo6o7ij6ss404ow () mail ! cspi ! qc ! ca
[Download RAW message or body]

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" <tshinnic@io.com>
Répondre à : proftp-user@lists.sourceforge.net
  Objet : Re: [Proftpd-user] Filtering out certain characters in files names
       À : ProFTPD <proftp-user@lists.sourceforge.net>


> 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=....: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/é/e}"
>   RewriteRule       ^(.*) "${replace:/$1/è/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/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'Île


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


----------------------------------------------------
Ce message a été acheminé 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   <proftpd-users@proftpd.org>
Unsubscribe problems?
http://www.proftpd.org/list-unsub.html

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic