You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by fu...@apache.org on 2020/01/06 23:34:17 UTC
svn commit: r1872398 - in /subversion/trunk/tools/hook-scripts/mailer:
mailer.conf.example mailer.py
Author: futatuki
Date: Mon Jan 6 23:34:17 2020
New Revision: 1872398
URL: http://svn.apache.org/viewvc?rev=1872398&view=rev
Log:
Add new option smtp_port to specifiy the port to connect
* tools/hook-scripts/mailer/mailer.py (SMTPOutput.finish):
Specify the port number to connect for SMTP/SMTP_SSL explicitly, by new option
general.smtp_port.
* tools/hook-scripts/mailer/mailer.conf.example ([genral]):
New option 'smtp_port'
Modified:
subversion/trunk/tools/hook-scripts/mailer/mailer.conf.example
subversion/trunk/tools/hook-scripts/mailer/mailer.py
Modified: subversion/trunk/tools/hook-scripts/mailer/mailer.conf.example
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/hook-scripts/mailer/mailer.conf.example?rev=1872398&r1=1872397&r2=1872398&view=diff
==============================================================================
--- subversion/trunk/tools/hook-scripts/mailer/mailer.conf.example (original)
+++ subversion/trunk/tools/hook-scripts/mailer/mailer.conf.example Mon Jan 6 23:34:17 2020
@@ -23,6 +23,10 @@
# This option specifies the hostname for delivery via SMTP.
#smtp_hostname = localhost
+# This option specifies the TCP port number to connect for SMTP.
+# If it is not specified, 25 is used by default.
+#smtp_port = 25
+
# Username and password for SMTP servers requiring authorisation.
#smtp_username = example
#smtp_password = example
Modified: subversion/trunk/tools/hook-scripts/mailer/mailer.py
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/hook-scripts/mailer/mailer.py?rev=1872398&r1=1872397&r2=1872398&view=diff
==============================================================================
--- subversion/trunk/tools/hook-scripts/mailer/mailer.py (original)
+++ subversion/trunk/tools/hook-scripts/mailer/mailer.py Mon Jan 6 23:34:17 2020
@@ -299,11 +299,15 @@ class SMTPOutput(MailedOutput):
(to minimize the chances of said lockout).
"""
+ if self.cfg.is_set('general.smtp_port'):
+ smtp_port = self.cfg.general.smtp_port
+ else:
+ smtp_port = smtplib.SMTP_PORT
try:
if self.cfg.is_set('general.smtp_ssl') and self.cfg.general.smtp_ssl == 'yes':
- server = smtplib.SMTP_SSL(self.cfg.general.smtp_hostname)
+ server = smtplib.SMTP_SSL(self.cfg.general.smtp_hostname, smtp_port)
else:
- server = smtplib.SMTP(self.cfg.general.smtp_hostname)
+ server = smtplib.SMTP(self.cfg.general.smtp_hostname, smtp_port)
except Exception as detail:
sys.stderr.write("mailer.py: Failed to instantiate SMTP object: %s\n" % (detail,))
# Any error to instantiate is fatal
Now mailer.py can specify TCP port to connect for SMTP and SMTP_SSL
(Re: svn commit: r1872398 - in /subversion/trunk/tools/hook-scripts/mailer:
mailer.conf.example mailer.py)
Posted by Yasuhito FUTATSUKI <fu...@poem.co.jp>.
I forgot inform this...
On 2020/01/07 10:10, Yasuhito FUTATSUKI wrote:
> On 2020/01/07 9:40, Daniel Shahaf wrote:
>> futatuki@apache.org wrote on Mon, Jan 06, 2020 at 23:34:17 -0000:
>>> +++ subversion/trunk/tools/hook-scripts/mailer/mailer.conf.example Mon Jan 6 23:34:17 2020
>>> @@ -23,6 +23,10 @@
>>> # This option specifies the hostname for delivery via SMTP.
>>> #smtp_hostname = localhost
>>>
>>> +# This option specifies the TCP port number to connect for SMTP.
>>> +# If it is not specified, 25 is used by default.
>>> +#smtp_port = 25
>>> +
>>> +++ subversion/trunk/tools/hook-scripts/mailer/mailer.py Mon Jan 6 23:34:17 2020
>>> @@ -299,11 +299,15 @@ class SMTPOutput(MailedOutput):
>>> (to minimize the chances of said lockout).
>>> """
>>>
>>> + if self.cfg.is_set('general.smtp_port'):
>>> + smtp_port = self.cfg.general.smtp_port
>>> + else:
>>> + smtp_port = smtplib.SMTP_PORT
>>> try:
>>> if self.cfg.is_set('general.smtp_ssl') and self.cfg.general.smtp_ssl == 'yes':
>>> - server = smtplib.SMTP_SSL(self.cfg.general.smtp_hostname)
>>> + server = smtplib.SMTP_SSL(self.cfg.general.smtp_hostname, smtp_port)
>>
>> This seems to be a breaking change. The old code, «smtplib.SMTP_SSL(foo)»,
>> used port 465; the new code, «smtplib.SMTP_SSL(foo, smtplib.SMTP_PORT)», will
>> try to connect to port 25 using SMTP-over-SSL until the administrator sets
>> smtp_port=465 in the config file.
>
> Thank you for the report. I've fixed it in r1872403.
Now we can specifiy the TCP port that mailer.py uses to connect for SMTP
and SMTP-over-SSL, to connect submission port, or non-privileged port
for testing.
Cheers,
--
Yasuhito FUTATSUKI <fu...@yf.bsdclub.org> / <fu...@poem.co.jp>
Re: svn commit: r1872398 - in
/subversion/trunk/tools/hook-scripts/mailer: mailer.conf.example mailer.py
Posted by Yasuhito FUTATSUKI <fu...@poem.co.jp>.
On 2020/01/07 9:40, Daniel Shahaf wrote:
> futatuki@apache.org wrote on Mon, Jan 06, 2020 at 23:34:17 -0000:
>> +++ subversion/trunk/tools/hook-scripts/mailer/mailer.conf.example Mon Jan 6 23:34:17 2020
>> @@ -23,6 +23,10 @@
>> # This option specifies the hostname for delivery via SMTP.
>> #smtp_hostname = localhost
>>
>> +# This option specifies the TCP port number to connect for SMTP.
>> +# If it is not specified, 25 is used by default.
>> +#smtp_port = 25
>> +
>> +++ subversion/trunk/tools/hook-scripts/mailer/mailer.py Mon Jan 6 23:34:17 2020
>> @@ -299,11 +299,15 @@ class SMTPOutput(MailedOutput):
>> (to minimize the chances of said lockout).
>> """
>>
>> + if self.cfg.is_set('general.smtp_port'):
>> + smtp_port = self.cfg.general.smtp_port
>> + else:
>> + smtp_port = smtplib.SMTP_PORT
>> try:
>> if self.cfg.is_set('general.smtp_ssl') and self.cfg.general.smtp_ssl == 'yes':
>> - server = smtplib.SMTP_SSL(self.cfg.general.smtp_hostname)
>> + server = smtplib.SMTP_SSL(self.cfg.general.smtp_hostname, smtp_port)
>
> This seems to be a breaking change. The old code, «smtplib.SMTP_SSL(foo)»,
> used port 465; the new code, «smtplib.SMTP_SSL(foo, smtplib.SMTP_PORT)», will
> try to connect to port 25 using SMTP-over-SSL until the administrator sets
> smtp_port=465 in the config file.
Thank you for the report. I've fixed it in r1872403.
Cheers,
--
Yasuhito FUTATSUKI <fu...@yf.bsdclub.org> / <fu...@poem.co.jp>
Re: svn commit: r1872398 - in
/subversion/trunk/tools/hook-scripts/mailer: mailer.conf.example mailer.py
Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
futatuki@apache.org wrote on Mon, Jan 06, 2020 at 23:34:17 -0000:
> +++ subversion/trunk/tools/hook-scripts/mailer/mailer.conf.example Mon Jan 6 23:34:17 2020
> @@ -23,6 +23,10 @@
> # This option specifies the hostname for delivery via SMTP.
> #smtp_hostname = localhost
>
> +# This option specifies the TCP port number to connect for SMTP.
> +# If it is not specified, 25 is used by default.
> +#smtp_port = 25
> +
> +++ subversion/trunk/tools/hook-scripts/mailer/mailer.py Mon Jan 6 23:34:17 2020
> @@ -299,11 +299,15 @@ class SMTPOutput(MailedOutput):
> (to minimize the chances of said lockout).
> """
>
> + if self.cfg.is_set('general.smtp_port'):
> + smtp_port = self.cfg.general.smtp_port
> + else:
> + smtp_port = smtplib.SMTP_PORT
> try:
> if self.cfg.is_set('general.smtp_ssl') and self.cfg.general.smtp_ssl == 'yes':
> - server = smtplib.SMTP_SSL(self.cfg.general.smtp_hostname)
> + server = smtplib.SMTP_SSL(self.cfg.general.smtp_hostname, smtp_port)
This seems to be a breaking change. The old code, «smtplib.SMTP_SSL(foo)»,
used port 465; the new code, «smtplib.SMTP_SSL(foo, smtplib.SMTP_PORT)», will
try to connect to port 25 using SMTP-over-SSL until the administrator sets
smtp_port=465 in the config file.
Cheers,
Daniel
> else:
> - server = smtplib.SMTP(self.cfg.general.smtp_hostname)
> + server = smtplib.SMTP(self.cfg.general.smtp_hostname, smtp_port)
Re: svn commit: r1872398 - in
/subversion/trunk/tools/hook-scripts/mailer: mailer.conf.example mailer.py
Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
futatuki@apache.org wrote on Mon, Jan 06, 2020 at 23:34:17 -0000:
> +++ subversion/trunk/tools/hook-scripts/mailer/mailer.conf.example Mon Jan 6 23:34:17 2020
> @@ -23,6 +23,10 @@
> # This option specifies the hostname for delivery via SMTP.
> #smtp_hostname = localhost
>
> +# This option specifies the TCP port number to connect for SMTP.
> +# If it is not specified, 25 is used by default.
> +#smtp_port = 25
> +
> +++ subversion/trunk/tools/hook-scripts/mailer/mailer.py Mon Jan 6 23:34:17 2020
> @@ -299,11 +299,15 @@ class SMTPOutput(MailedOutput):
> (to minimize the chances of said lockout).
> """
>
> + if self.cfg.is_set('general.smtp_port'):
> + smtp_port = self.cfg.general.smtp_port
> + else:
> + smtp_port = smtplib.SMTP_PORT
> try:
> if self.cfg.is_set('general.smtp_ssl') and self.cfg.general.smtp_ssl == 'yes':
> - server = smtplib.SMTP_SSL(self.cfg.general.smtp_hostname)
> + server = smtplib.SMTP_SSL(self.cfg.general.smtp_hostname, smtp_port)
This seems to be a breaking change. The old code, «smtplib.SMTP_SSL(foo)»,
used port 465; the new code, «smtplib.SMTP_SSL(foo, smtplib.SMTP_PORT)», will
try to connect to port 25 using SMTP-over-SSL until the administrator sets
smtp_port=465 in the config file.
Cheers,
Daniel
> else:
> - server = smtplib.SMTP(self.cfg.general.smtp_hostname)
> + server = smtplib.SMTP(self.cfg.general.smtp_hostname, smtp_port)