! Requests Need a script or some sort of cool .bat file ? Ask here! |
08-15-2004, 01:25 PM
|
#1
|
Senior Member
Join Date: Mar 2004
Posts: 289
|
[REQ] Replace special characters on mkdir
When a user mkdir with special characters, a script replaces the character special:
& = And
space = _
? = _
' = deleted
etc.
|
|
|
08-15-2004, 08:28 PM
|
#2
|
Too much time...
FlashFXP Beta Tester ioFTPD Scripter
Join Date: May 2003
Posts: 1,326
|
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.
|
|
|
08-17-2004, 12:01 PM
|
#3
|
Senior Member
Join Date: Jan 2004
Posts: 203
|
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"
|
|
|
08-17-2004, 03:54 PM
|
#4
|
Senior Member
ioFTPD Scripter
Join Date: Feb 2003
Posts: 458
|
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.
|
|
|
08-17-2004, 04:42 PM
|
#5
|
Senior Member
FlashFXP Beta Tester ioFTPD Scripter
Join Date: Aug 2003
Posts: 517
|
what about:
- script creates the "translated" directory itself
- script outputs "200 MKDIR ok."
- script returns nonzero value => ioFTPD does nothing.
?
|
|
|
08-18-2004, 04:42 AM
|
#6
|
Senior Member
Join Date: Mar 2004
Posts: 289
|
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
|
|
|
08-18-2004, 05:15 AM
|
#7
|
Senior Member
Join Date: Jan 2003
Posts: 231
|
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 )
|
|
|
08-18-2004, 05:44 AM
|
#8
|
Banned
Join Date: Feb 2004
Posts: 19
|
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
|
|
|
08-18-2004, 08:17 AM
|
#9
|
Senior Member
Join Date: Mar 2004
Posts: 289
|
not working
MKD tes?t
and nothing to be created
|
|
|
08-19-2004, 06:13 AM
|
#10
|
Banned
Join Date: Feb 2004
Posts: 19
|
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.
|
|
|
08-19-2004, 06:24 AM
|
#11
|
Banned
Join Date: Feb 2004
Posts: 19
|
bahg, fukit, cant return ioerror 1, or args as io freezes, GREAT!
|
|
|
08-19-2004, 07:13 AM
|
#12
|
Senior Member
Join Date: Mar 2004
Posts: 289
|
bizniz your script it does not replace, it stop
You cannot make for replaces auto ?
|
|
|
08-19-2004, 01:49 PM
|
#13
|
Too much time...
FlashFXP Beta Tester ioFTPD Scripter
Join Date: May 2003
Posts: 1,326
|
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.
|
|
|
08-20-2004, 10:06 AM
|
#14
|
Banned
Join Date: Feb 2004
Posts: 19
|
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
|
|
|
08-24-2004, 04:07 AM
|
#15
|
Senior Member
Join Date: Mar 2004
Posts: 289
|
not working bizniz, freeze on mkdir
|
|
|
Thread Tools |
|
Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 02:33 PM.
|