Modify

Opened 6 years ago

Closed 6 years ago

#3560 closed defect (fixed)

use_tls not actually used in AnnouncerPlugin

Reported by: leorochael Owned by: 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 (1)

announcerplugin-actually-enable-tls.diff (577 bytes) - added by leorochael 6 years ago.
Patch to actually enable use_tls on AnnouncerPlugin

Download all attachments as: .zip

Change History (10)

Changed 6 years ago by leorochael

Patch to actually enable use_tls on AnnouncerPlugin

comment:1 Changed 6 years ago by leorochael

Just realized this ticket is related to #3529

comment:2 Changed 6 years ago by anonymous

thanks for the patch leorochael
commited:
r4146

comment:3 Changed 6 years ago by leorochael

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

comment:4 Changed 6 years ago by doki_pen

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:5 Changed 6 years ago by anonymous

  • Resolution fixed deleted
  • Status changed from closed to reopened

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

comment:6 Changed 6 years ago by leorochael

  • Resolution set to fixed
  • Status changed from reopened to closed

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.

comment:7 Changed 6 years ago by joshbenner

  • Resolution fixed deleted
  • Status changed from closed to reopened

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.

comment:8 Changed 6 years ago by anonymous

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

comment:9 Changed 6 years ago by doki_pen

  • Resolution set to fixed
  • Status changed from reopened to closed

fixed in -r4240

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

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.