| 716 | ssl_version = ssl.PROTOCOL_TLS_CLIENT |
| 717 | |
| 718 | def __init__(self, host='', user='', passwd='', acct='', |
| 719 | keyfile=None, certfile=None, context=None, |
| 720 | timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=None, *, |
| 721 | encoding='utf-8'): |
| 722 | if context is not None and keyfile is not None: |
| 723 | raise ValueError("context and keyfile arguments are mutually " |
| 724 | "exclusive") |
| 725 | if context is not None and certfile is not None: |
| 726 | raise ValueError("context and certfile arguments are mutually " |
| 727 | "exclusive") |
| 728 | if keyfile is not None or certfile is not None: |
| 729 | import warnings |
| 730 | warnings.warn("keyfile and certfile are deprecated, use a " |
| 731 | "custom context instead", DeprecationWarning, 2) |
| 732 | self.keyfile = keyfile |
| 733 | self.certfile = certfile |
| 734 | if context is None: |
| 735 | context = ssl._create_stdlib_context(self.ssl_version, |
| 736 | certfile=certfile, |
| 737 | keyfile=keyfile) |
| 738 | self.context = context |
| 739 | self._prot_p = False |
| 740 | super().__init__(host, user, passwd, acct, |
| 741 | timeout, source_address, encoding=encoding) |
| 742 | |
| 743 | def login(self, user='', passwd='', acct='', secure=True): |
| 744 | if secure and not isinstance(self.sock, ssl.SSLSocket): |