This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lszyba1
Recipients Jeremy.Brock, giampaolo.rodola, lszyba1
Date 2015-01-30.17:45:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1422639936.77.0.660150883642.issue16318@psf.upfronthosting.co.za>
In-reply-to
Content
Hello,
We are having issues usign ftplib for implicit TLS over port 990

I'm referencing a solution that states 

"For the implicit FTP TLS/SSL(defualt port 990), our client program must build a TLS/SSL connection right after the socket is created. But python's class FTP_TLS doesn't reload the connect function from class FTP. We need to fix it:"



http://stackoverflow.com/questions/12164470/python-ftp-tls-connection-issue

{{{
#ImplicityTLS.py
from ftplib import FTP_TLS
import socket
import ssl

class tyFTP(FTP_TLS):
    def __init__(self, host='', user='', passwd='', acct='', keyfile=None, certfile=None, timeout=60):
        FTP_TLS.__init__(self, host, user, passwd, acct, keyfile, certfile, timeout)
    def connect(self, host='', port=0, timeout=-999):
        if host != '':
            self.host = host
        if port > 0:
            self.port = port
        if timeout != -999:
            self.timeout = timeout

        try: 
            self.sock = socket.create_connection((self.host, self.port), self.timeout)
            self.af = self.sock.family
            self.sock = ssl.wrap_socket(self.sock, self.keyfile, self.certfile, ssl_version=ssl.PROTOCOL_TLSv1)
            self.file = self.sock.makefile('rb')
            self.welcome = self.getresp()
        except Exception as e:
            print e
        return self.welcome
}}}


Then from my main application I did this:

{{{
from ImplicityTLS import tyFTP
server = tyFTP()
server.connect(host="xxxxx", port=990)
server.login(user="yyyy", passwd="fffff")
server.prot_p()
}}}
History
Date User Action Args
2015-01-30 17:45:36lszyba1setrecipients: + lszyba1, giampaolo.rodola, Jeremy.Brock
2015-01-30 17:45:36lszyba1setmessageid: <1422639936.77.0.660150883642.issue16318@psf.upfronthosting.co.za>
2015-01-30 17:45:36lszyba1linkissue16318 messages
2015-01-30 17:45:36lszyba1create