Go Back   FlashFXP Forums > > > >

! Requests Need a script or some sort of cool .bat file ? Ask here!

Reply
 
Thread Tools Rate Thread Display Modes
Old 08-15-2004, 01:25 PM   #1
iam
Senior Member
 
Join Date: Mar 2004
Posts: 289
Default [REQ] Replace special characters on mkdir

When a user mkdir with special characters, a script replaces the character special:

& = And
space = _
? = _
' = deleted
etc.
iam is offline   Reply With Quote
Old 08-15-2004, 08:28 PM   #2
neoxed
Too much time...
FlashFXP Beta Tester
ioFTPD Scripter
 
Join Date: May 2003
Posts: 1,326
Default

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.
neoxed is offline   Reply With Quote
Old 08-17-2004, 12:01 PM   #3
mr_F_2
Senior Member
 
Join Date: Jan 2004
Posts: 203
Default

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"
mr_F_2 is offline   Reply With Quote
Old 08-17-2004, 03:54 PM   #4
SnypeTEST
Senior Member
ioFTPD Scripter
 
Join Date: Feb 2003
Posts: 458
Default

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.
SnypeTEST is offline   Reply With Quote
Old 08-17-2004, 04:42 PM   #5
ADDiCT
Senior Member
FlashFXP Beta Tester
ioFTPD Scripter
 
Join Date: Aug 2003
Posts: 517
Default

what about:

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

?
ADDiCT is offline   Reply With Quote
Old 08-18-2004, 04:42 AM   #6
iam
Senior Member
 
Join Date: Mar 2004
Posts: 289
Default

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
iam is offline   Reply With Quote
Old 08-18-2004, 05:15 AM   #7
Unique
Senior Member
 
Join Date: Jan 2003
Posts: 231
Default

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 )
Unique is offline   Reply With Quote
Old 08-18-2004, 05:44 AM   #8
bizniz
Banned
 
Join Date: Feb 2004
Posts: 19
Default

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
bizniz is offline   Reply With Quote
Old 08-18-2004, 08:17 AM   #9
iam
Senior Member
 
Join Date: Mar 2004
Posts: 289
Default

not working

MKD tes?t
and nothing to be created
iam is offline   Reply With Quote
Old 08-19-2004, 06:13 AM   #10
bizniz
Banned
 
Join Date: Feb 2004
Posts: 19
Default

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 is offline   Reply With Quote
Old 08-19-2004, 06:24 AM   #11
bizniz
Banned
 
Join Date: Feb 2004
Posts: 19
Default

bahg, fukit, cant return ioerror 1, or args as io freezes, GREAT!
bizniz is offline   Reply With Quote
Old 08-19-2004, 07:13 AM   #12
iam
Senior Member
 
Join Date: Mar 2004
Posts: 289
Default

bizniz your script it does not replace, it stop
You cannot make for replaces auto ?
iam is offline   Reply With Quote
Old 08-19-2004, 01:49 PM   #13
neoxed
Too much time...
FlashFXP Beta Tester
ioFTPD Scripter
 
Join Date: May 2003
Posts: 1,326
Default

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.
neoxed is offline   Reply With Quote
Old 08-20-2004, 10:06 AM   #14
bizniz
Banned
 
Join Date: Feb 2004
Posts: 19
Default

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
bizniz is offline   Reply With Quote
Old 08-24-2004, 04:07 AM   #15
iam
Senior Member
 
Join Date: Mar 2004
Posts: 289
Default

not working bizniz, freeze on mkdir
iam is offline   Reply With Quote
Reply

Tags
character, characters, deleted, mkdir, special

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 06:34 PM.

Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)