Ticket #3560 (closed defect: fixed)

Opened 4 months ago

Last modified 3 months ago

use_tls not actually used in AnnouncerPlugin

Reported by: leorochael Assigned to: ixokai
Priority: normal Component: AnnouncerPlugin
Severity: major Keywords:
Cc: Trac Release: 0.11

Description

in distributors/email_distributor.py, the use_tls configuration setting is read from the configuration file, but never actually used.

Patch attached.

Without this patch, configuring AnnouncerPlugin for use with, say, gmail, while specifying user and password for authentication, will cause messages not to be sent. The log will report:

2008-08-15 11:57:19,644 Trac[api] ERROR: AnnouncementSystem failed.
Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/AnnouncerPlugin-0.2-py2.5.egg/announcerplugin/api.py", line 377, in _real_send
    distributor.distribute(transport, packages[transport], evt)
  File "/usr/lib/python2.5/site-packages/AnnouncerPlugin-0.2-py2.5.egg/announcerplugin/distributors/email_distributor.py", line 194, in distribute
    self._do_send(transport, event, format, messages[format], formats[format], None, to, public_cc)
  File "/usr/lib/python2.5/site-packages/AnnouncerPlugin-0.2-py2.5.egg/announcerplugin/distributors/email_distributor.py", line 276, in _do_send
    self._transmit(*package)
  File "/usr/lib/python2.5/site-packages/AnnouncerPlugin-0.2-py2.5.egg/announcerplugin/distributors/email_distributor.py", line 285, in _transmit
    smtp.login(self.smtp_user, self.smtp_password)
  File "/usr/lib/python2.5/smtplib.py", line 554, in login
    raise SMTPException("SMTP AUTH extension not supported by server.")
SMTPException: SMTP AUTH extension not supported by server.

Attachments

announcerplugin-actually-enable-tls.diff (0.6 kB) - added by leorochael on 08/15/08 11:27:04.
Patch to actually enable use_tls on AnnouncerPlugin

Change History

08/15/08 11:27:04 changed by leorochael

  • attachment announcerplugin-actually-enable-tls.diff added.

Patch to actually enable use_tls on AnnouncerPlugin

08/15/08 11:31:28 changed by leorochael

Just realized this ticket is related to #3529

08/15/08 11:56:27 changed by anonymous

thanks for the patch leorochael commited: r4146

08/15/08 13:20:06 changed by leorochael

This attachment on #2503 fixes both this bug and the proper declaration of international chars on e-mail messages.

08/19/08 12:34:58 changed by doki_pen

  • status changed from new to closed.
  • resolution set to fixed.

(In [4154]) fixes #2503 and #3560, thanks leorochael

09/05/08 08:09:37 changed by anonymous

  • status changed from closed to reopened.
  • resolution deleted.

You need another smtp.ehlo() AFTER smtp.starttls() (yes, two calls to smtp.ehlo(), one before, and one after starttls)

09/05/08 08:53:09 changed by leorochael

  • status changed from reopened to closed.
  • resolution set to fixed.

Actually, you don't need another .ehlo().

If you read the documentation for the `.login()` and .sendmail() methods, you'll see they both call .ehlo() if it hasn't been called before.

09/05/08 13:55:21 changed by joshbenner

  • status changed from closed to reopened.
  • resolution deleted.

I'm running a system using gmail with TLS -- it works with the two .ehlo(), without the second .ehlo() it fails claiming the server doesn't support authentication.

If I understand the linked documentation correctly, .login() won't call .ehlo() again if it has already been called during the current session... but .ehlo() is called once before .starttls(), therefore .login() won't trigger another .ehlo().

Also, see trac's implementation of smtplib with TLS -- they call .ehlo() twice.

09/05/08 14:06:19 changed by anonymous

Yes, I agree. It should be implemented the same way as trac. If trac changes, we will change.

09/05/08 14:11:07 changed by doki_pen

  • status changed from reopened to closed.
  • resolution set to fixed.

fixed in -r4240

connection establishment now matches the trac notification impl so behavior shouldn't change when using announcerplugin.


Add/Change #3560 (use_tls not actually used in AnnouncerPlugin)




Change Properties
Action