PDA

View Full Version : How to catch STOR filename errors ?


Mouton
08-31-2003, 05:27 PM
[23:57:54] STOR 08.rar
[23:57:54] 550 08.rar: No such file or directory.
[23:57:54] Transfer Failed!

How can I catch those ?
I have an event in [Pre] STOR, and I would need to undo what it has done if the STOR doesn't start. OnUploadError event isn't called :\

The [Pre] STOR event is used to prevent two users from overwriting each other if "SIZE filename" return 0 but the file was already started by someone else (dark said it's because of OS disk caching).

Any idea ?

FTPServerTools
09-01-2003, 05:14 AM
?? undo what is has done??
Your [Pre] STOR could always try an fopen and if file doesnt exist do xxx else if file exists but is locked do YYY else some other error.

Mouton
09-01-2003, 09:12 AM
That's what i can't do. The file isn't on disk yet. My Pre STOR event just logs the filename in .ioFTPD.xdupe and return 0 if it wasn't there already, and 1 if it was. That way, no one can overwrite someone else file.

The solution I found is to make the xdupe log expire after 5 secs. So nobody can overwrite any file that was "STOR filename" in the last 5 secs. That should fix the cached file overwrite problem, and allow failed STOR command to be restart after 5 secs.

FTPServerTools
09-02-2003, 02:40 AM
?? it isnt on disk yet?? I would guess darkone uses a CreateFile thus it would appear immediately as a 0 byte locked file on your HD.
Probably I dont understand your question. See ya on irc.

Mouton
09-02-2003, 07:07 AM
is not on disk yet as in STOR filename on one sessions starts, another session (set in ffxp to skip all) sends SIZE filename to know if the file exists at the same time, and gets File not found, so it do a STOR filename. 2 sessions are uploading the same file, overwriting each other.

You can reproduce by uploading a bunch of small files using 2 or more ffxp sessions, and reply skip all on overwrite prompt. You'll see what happens.