Log SSL default verification path for mailmerge debug

related: follow python recommendation and pass SSL contexts

Change-Id: I992535a7fbe0bd21ff1de8241715babc0cb5cdc3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155050
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
This commit is contained in:
Thorsten Behrens 2023-07-29 05:17:10 +02:00
parent 3e563f6ed4
commit d7b8dc9f3f

View file

@ -96,6 +96,8 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
if dbg:
print("Timeout: " + str(tout), file=sys.stderr)
if port == 465:
if dbg:
print("SSL config: " + str(ssl.get_default_verify_paths()), file=sys.stderr)
self.server = smtplib.SMTP_SSL(server, port, timeout=tout, context=ssl.create_default_context())
else:
self.server = smtplib.SMTP(server, port,timeout=tout)
@ -107,6 +109,8 @@ class PyMailSMTPService(unohelper.Base, XSmtpService):
if dbg:
print("ConnectionType: " + connectiontype, file=sys.stderr)
if connectiontype.upper() == 'SSL' and port != 465:
if dbg:
print("SSL config: " + str(ssl.get_default_verify_paths()), file=sys.stderr)
self.server.ehlo()
self.server.starttls(context=ssl.create_default_context())
self.server.ehlo()
@ -299,6 +303,8 @@ class PyMailIMAPService(unohelper.Base, XMailService):
print(connectiontype, file=sys.stderr)
print("BEFORE", file=sys.stderr)
if connectiontype.upper() == 'SSL':
if dbg:
print("SSL config: " + str(ssl.get_default_verify_paths()), file=sys.stderr)
self.server = imaplib.IMAP4_SSL(server, port, ssl_context=ssl.create_default_context())
else:
self.server = imaplib.IMAP4(server, port)
@ -368,6 +374,8 @@ class PyMailPOP3Service(unohelper.Base, XMailService):
print(connectiontype, file=sys.stderr)
print("BEFORE", file=sys.stderr)
if connectiontype.upper() == 'SSL':
if dbg:
print("SSL config: " + str(ssl.get_default_verify_paths()), file=sys.stderr)
self.server = poplib.POP3_SSL(server, port, context=ssl.create_default_context())
else:
tout = xConnectionContext.getValueByName("Timeout")