PDA

View Full Version : [TCL] FTP Connection with SSL/TLS


neXus
12-18-2003, 10:56 AM
hiho,

trying for hours .. but no success

package require tls 1.4
package require ftp

set ::ftp::VERBOSE 1
set ::ftp::DEBUG 1

set ftp(cntrl) [::ftp::Open $host $user $pass -port $prt -command [list ::tls::socket -require 1]]


debug messages


Starting new connection with:
-port = xxxx
-command = ::tls::socket -require 1
C: Connection from xx.xx.xx.xx:xxxx
[16:50] + SSL-FTP connection established - handle: 0
-> rc="220"
-> msgtext="welcome ...."
-> state="user"
---> USER neXus


error msg :

wrong # args: should be "tls::socket ?options? host port"
while executing
"::tls::socket -require 1 user"
("uplevel" body line 1)
invoked from within
"uplevel #0 $cb [list $msg] $args"
(procedure "Command" line 3)
invoked from within
"Command $ftp(Command) user"
("2" arm line 4)
invoked from within
"switch -exact -- $rc {
2 {
PutsCtrlSock $s "USER $ftp(User)"
set ftp(State) passwd
Comma..."
("user" arm line 2)
invoked from within
"switch -exact -- $ftp(State) {
user {
switch -exact -- $rc {
2 {
PutsCtrlSock $s "USER $ftp(U..."
(procedure "::ftp::StateHandler" line 69)
invoked from within
"::ftp::StateHandler 0 sock7"


after that i changed in ftp.tcl ( proc ::ftp::OpenControlConn {s {block 1}} { )

set rc [catch {set ftp(CtrlSock) [socket $ftp(RemoteHost) $ftp(Port)]} msg]
to set rc [catch {set ftp(CtrlSock) [::tls::socket $ftp(RemoteHost) $ftp(Port)]} msg]

that result in
Starting new connection with:
-port = xxxx
C: Connection from xx.xxx.xx.xx:xxx
SSL channel "sock7": error: unknown protocol
error reading "sock7": software caused connection abort
while executing
"gets $sock bufline"
(procedure "::ftp::StateHandler" line 16)
invoked from within
"::ftp::StateHandler 0 sock7"

maybe any1 can help