scripting/source/pyprov/mailmerge.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
New commits: commit d46695fd8352c80229010b444cf1dcb3e6a8f4d7 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Fri Jul 28 12:13:41 2023 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon Aug 7 11:00:18 2023 +0200 follow python recommendation and pass SSL contexts i.e. https://docs.python.org/3/library/ssl.html#security-considerations Change-Id: I67a0f9e1c25abc6644412b014f30933a7e681da2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155016 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> (cherry picked from commit 7c1bc868c506dd505a70400e87c394f2263da085) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155032 (cherry picked from commit 3326ae0a9902395224ddd95ca3df069ebffe2990) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155145 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Tested-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/scripting/source/pyprov/mailmerge.py b/scripting/source/pyprov/mailmerge.py index 0ef37b477c81..6bd80430d147 100644 --- a/scripting/source/pyprov/mailmerge.py +++ b/scripting/source/pyprov/mailmerge.py @@ -47,7 +47,7 @@ from email.utils import formatdate from email.utils import parseaddr from socket import _GLOBAL_DEFAULT_TIMEOUT -import sys, smtplib, imaplib, poplib +import sys, ssl, smtplib, imaplib, poplib dbg = False # pythonloader looks for a static g_ImplementationHelper variable @@ -96,7 +96,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService): if dbg: print("Timeout: " + str(tout), file=sys.stderr) if port == 465: - self.server = smtplib.SMTP_SSL(server, port,timeout=tout) + self.server = smtplib.SMTP_SSL(server, port, timeout=tout, context=ssl.create_default_context()) else: self.server = smtplib.SMTP(server, port,timeout=tout) @@ -108,7 +108,7 @@ class PyMailSMTPService(unohelper.Base, XSmtpService): print("ConnectionType: " + connectiontype, file=sys.stderr) if connectiontype.upper() == 'SSL' and port != 465: self.server.ehlo() - self.server.starttls() + self.server.starttls(context=ssl.create_default_context()) self.server.ehlo() user = xAuthenticator.getUserName() @@ -299,7 +299,7 @@ class PyMailIMAPService(unohelper.Base, XMailService): print(connectiontype, file=sys.stderr) print("BEFORE", file=sys.stderr) if connectiontype.upper() == 'SSL': - self.server = imaplib.IMAP4_SSL(server, port) + self.server = imaplib.IMAP4_SSL(server, port, ssl_context=ssl.create_default_context()) else: self.server = imaplib.IMAP4(server, port) print("AFTER", file=sys.stderr) @@ -368,7 +368,7 @@ class PyMailPOP3Service(unohelper.Base, XMailService): print(connectiontype, file=sys.stderr) print("BEFORE", file=sys.stderr) if connectiontype.upper() == 'SSL': - self.server = poplib.POP3_SSL(server, port) + self.server = poplib.POP3_SSL(server, port, context=ssl.create_default_context()) else: tout = xConnectionContext.getValueByName("Timeout") if dbg: