コード例 #1
0
    def tryTLS(self, code, resp, items):
        """Checks if the client has requested
           a secure SSL connection with the SMTP server.
           If not removes 'STARTTLS' from the servers
           capabilities list. Twisted automatically
           starts a TLS session if it sees a 'STARTTLS'
           in the server capabilities. This is not the
           desired behavior we want.

           Calls C{twisted.mail.smtp.ESMTPSender.tryTLS}
        """
        if not self.requireTransportSecurity:
            items = utils.disableTwistedTLS(items)

        return smtp.ESMTPSender.tryTLS(self, code, resp, items)
コード例 #2
0
ファイル: pop.py プロジェクト: HackLinux/chandler-1
    def __getCapabilities(self, caps):
        if self._timedOut:
            """If we have already timed out then gracefully exit the function"""
            return defer.succeed(True)

        if self.factory.useTLS:
            """The Twisted POP3Client will check to make sure the server can STARTTLS
               and raise an error if it can not"""
            d = self.startTLS(self.transport.contextFactory.getContext())
            d.addCallbacks(lambda _: self.delegate.loginClient(), self.delegate.catchErrors)
            return d

        else:
            """Remove the STLS from capabilities"""
            self._capCache = utils.disableTwistedTLS(caps, "STLS")
            self.delegate.loginClient()
コード例 #3
0
    def __getCapabilities(self, caps):
        if self._timedOut:
            """If we have already timed out then gracefully exit the function"""
            return defer.succeed(True)

        if self.factory.useTLS:
            """The Twisted POP3Client will check to make sure the server can STARTTLS
               and raise an error if it can not"""
            d = self.startTLS(self.transport.contextFactory.getContext())
            d.addCallbacks(lambda _: self.delegate.loginClient(),
                           self.delegate.catchErrors)
            return d

        else:
            """Remove the STLS from capabilities"""
            self._capCache = utils.disableTwistedTLS(caps, "STLS")
            self.delegate.loginClient()
コード例 #4
0
    def __getCapabilities(self, caps):
        if self.factory.useTLS:
            """The Twisted IMAP4Client will check to make sure the server can STARTTLS
               and raise an error if it can not"""
            d = self.startTLS(self.transport.contextFactory.getContext())

            d.addCallbacks(lambda _: self.delegate.loginClient(), \
                                     self.delegate.catchErrors)
            return d

        if 'LOGINDISABLED' in caps:
            e = errors.IMAPException(constants.DOWNLOAD_REQUIRES_TLS)
            self.delegate.catchErrors(e)

        else:
            """Remove the STARTTLS from capabilities"""
            self._capCache = utils.disableTwistedTLS(caps)
            self.delegate.loginClient()
コード例 #5
0
ファイル: imap.py プロジェクト: HackLinux/chandler-1
    def __getCapabilities(self, caps):
        if self.factory.useTLS:
            """The Twisted IMAP4Client will check to make sure the server can STARTTLS
               and raise an error if it can not"""
            d = self.startTLS(self.transport.contextFactory.getContext())

            d.addCallbacks(lambda _: self.delegate.loginClient(), \
                                     self.delegate.catchErrors)
            return d

        if 'LOGINDISABLED' in caps:
            e = errors.IMAPException(constants.DOWNLOAD_REQUIRES_TLS)
            self.delegate.catchErrors(e)

        else:
            """Remove the STARTTLS from capabilities"""
            self._capCache = utils.disableTwistedTLS(caps)
            self.delegate.loginClient()