Skip to content

Commit

Permalink
Merge pull request #112 from dhke/unbreak_starttls
Browse files Browse the repository at this point in the history
fix starttls
  • Loading branch information
tonioo authored Apr 16, 2024
2 parents 3ccb90b + 21f0cde commit f164615
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sievelib/managesieve.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,10 +481,12 @@ def __starttls(self, keyfile=None, certfile=None) -> bool:
code, data = self.__send_command("STARTTLS")
if code != "OK":
return False
context = ssl.SSLContext()
context = ssl.create_default_context()
if certfile is not None:
context.load_cert_chain(certfile, keyfile=keyfile)
try:
# nsock = ssl.wrap_socket(self.sock, keyfile, certfile)
nsock = context.wrap_socket(self.sock, keyfile, certfile)
nsock = context.wrap_socket(self.sock, server_hostname=self.srvaddr)
except ssl.SSLError as e:
raise Error("SSL error: %s" % str(e))
self.sock = nsock
Expand Down

0 comments on commit f164615

Please sign in to comment.