FlashFXP Forums

FlashFXP Forums (https://oss.azurewebsites.net/forum/)
-   ! Requests (https://oss.azurewebsites.net/forum/ioftpd/ioftpd/scripting/-requests/)
-   -   [Filled] Replace special characters on mkdir (https://oss.azurewebsites.net/forum/ioftpd/ioftpd/scripting/-requests/8903-filled-replace-special-characters-mkdir.html)

iam 08-15-2004 01:25 PM

[REQ] Replace special characters on mkdir
 
When a user mkdir with special characters, a script replaces the character special:

& = And
space = _
? = _
' = deleted
etc.

neoxed 08-15-2004 08:28 PM

This is a script request, therefore it belongs in the Scripting - Requests category. I suggest you read the forum rules, since you seem to have a hard time following them.

http://www.ioftpd.com/board/announce...p?s=&forumid=2

Thread moved and renamed.

mr_F_2 08-17-2004 12:01 PM

hey iam,

there's a few problems with your script request:

1) if a user makes the folder and then a script tries to modify it (by renaming & -> And ...etc) it will fail because the user is still in that folder

2) the only method I could think of was to tell the user that the mkdir failed, then mkdir with the renamed syntax. Like:

MKDIR /apps/My Hate's You!!
550 Command Failed
... then script makes
/apps/My_Hates_You!! in the background

2 problems with this
1) the user won't know that it was created until he lists directory again
2) most ftp clients will tell the user that mkdir has failed and the queue item will have failed, therefore the rest of the files will not be transferred.

The best way to go about this is just deny paths with characters that you want removed or renamed and send the user a message:
"& is not an allowed character"

SnypeTEST 08-17-2004 03:54 PM

hmm i though d1 had a command to change the current pwd of the user usoing one of those ! things...

I guess u can make the new folder, DONT delete the old one, but make it into a symlink

then delete l8r ?? or something

blah! too complicated, i quit.

ADDiCT 08-17-2004 04:42 PM

what about:

- script creates the "translated" directory itself
- script outputs "200 MKDIR ok."
- script returns nonzero value => ioFTPD does nothing.

?

iam 08-18-2004 04:42 AM

The best way to go about this is just deny paths with characters that you want removed or renamed and send the user a message:
"& is not an allowed character"
=> yes with a zipscript denied But not best the solution

request script impossible to make ?

blah! too complicated, i quit.
=> LoL

Unique 08-18-2004 05:15 AM

Cant a script just make "test_space" when it gets a mkdir "test space"
And if the client sends a cwd to "test space" script auto changes it to "test_space" so the cwd will work anywayz..

Believe gl does it like this (didnt test though :P )

bizniz 08-18-2004 05:44 AM

jesus guys, ur all thicko or what? :P

[pre]
mkd = TCL ..\scripts\mkdir.itcl

Code:

set banned {
"\?"
"\*"
"\'"
" "
}
foreach ban $banned {
 if {[string match *$ban* [lindex $args 1]} {
  regsub -all -- [subst -nocommands {$ban}] [lindex $args 1] {_} narg
  set args "MKD $narg"
 }
}
return 0


iam 08-18-2004 08:17 AM

not working

MKD tes?t
and nothing to be created

bizniz 08-19-2004 06:13 AM

Code:

set chmod        755
set banned        {
"\?"
"\*"
"'"
" "
"`"
"!"
"%"
"\{"
"\}"
}
set folder [string range $args 4 end]
foreach ban $banned {
        if {[string match *$ban* $folder]} {
                regsub -all -- [subst -nocommands {[$ban]}] $folder {_} folder
        }
}
if {[set defpem [lindex [config read "VFS" "Default_Directory_Attributes"] 0]] == ""} {
        set defpem $chmod
}
catch {file mkdir $path/$folder}
catch {vfs write $path/$folder [resolve user $user] [resolve group $group] $defpem}
iputs "553 '[string range $args 4 end]' renamed to '$folder'"
global ioerror ; set ioerror 1
return 0

for some reason setting args on pre doesnt get passed to io, so fukit, try this.

bizniz 08-19-2004 06:24 AM

bahg, fukit, cant return ioerror 1, or args as io freezes, GREAT!

iam 08-19-2004 07:13 AM

bizniz your script it does not replace, it stop
You cannot make for replaces auto ?

neoxed 08-19-2004 01:49 PM

Quote:

Originally posted by bizniz
bahg, fukit, cant return ioerror 1, or args as io freezes, GREAT!
If you return non-zero (or in TCL, setting ioerror to a non-zero value) you must print an error message for pre/post events. By the way, it's the client that "freezes", not ioFTPD - since the client is expecting a reply message.

bizniz 08-20-2004 10:06 AM

Quote:

Originally posted by iam
bizniz your script it does not replace, it stop
You cannot make for replaces auto ?

well even if u put output, args stay the same, so io then cant find the dir as it dont exist, args need to be changed some how and passed to io for next op

iam 08-24-2004 04:07 AM

not working bizniz, freeze on mkdir


All times are GMT -5. The time now is 03:12 AM.

Powered by vBulletin® Version 3.8.11 Alpha 3
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)