Tcl Library Source Code

View Ticket
Login
Ticket UUID: 2928355
Title: ftp::Rename causes ftpd to crash
Type: Bug Version: None
Submitter: martinao Created on: 2010-01-08 16:25:19
Subsystem: ftpd Assigned To: andreas_kupries
Priority: 5 Medium Severity:
Status: Open Last Modified: 2010-01-21 01:29:54
Resolution: None Closed By:
    Closed on:
Description:
Calling ftp::Rename as client causes the ftp-daemon into which I logged in to crash in proc ::ftpd::command::RNTO, because the variable sock is unknown. Including "upvar #0 ::ftpd::$sock data" - as used in the other procs - resolves the application error.
User Comments: andreas_kupries added on 2010-01-21 01:29:54:
Fixed the missing upvar in CVS head. Thanks.

Regarding the authentication ... The high-level rename is apparently implemented in ftp via 2 commands, RNFR, and RNTO, to specify source and destination path ... Currently both these commands auth-check their path for "write" ... Seems that we need new modes, for "rename-src" and "rename-dst" ?

Reading "fileAuth" I am unable to understand it any longer. Should rewrite it to separate the handling of the modes, instead of having the mode and file checks mixed with each other.

martinao added on 2010-01-20 21:08:53:
I noticed incorrect return values of Rename also. I did not mention this, as I did not want to "overload" the above bug report.
Also, I did not see any easy correction possibility like above- this needs a deeper insight into ftpd.tcl. Therefore I currently use the workaround (client side):
1) Check, if a file with the target name already exists. If yes, delete that file.
2) Call Rename.
3) Check on the target file.

keithv added on 2010-01-20 08:04:46:
the crash is caused by a missing line:
    upvar #0 ::ftpd::$sock data

But a bigger problem is that permission logic in authFileCmd is wrong for renaming. It returns not ok if the file doesn't exist and okay if the file does exists.