Modify

Opened 9 years ago

Closed 9 years ago

#3560 closed defect (fixed)

use_tls not actually used in AnnouncerPlugin

Reported by: Leonardo Rochael Almeida Owned by: Stephen Hansen
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 Leonardo Rochael Almeida 9 years ago.
Patch to actually enable use_tls on AnnouncerPlugin

Download all attachments as: .zip

Change History (10)

Changed 9 years ago by Leonardo Rochael Almeida

Patch to actually enable use_tls on AnnouncerPlugin

comment:1 Changed 9 years ago by Leonardo Rochael Almeida

Just realized this ticket is related to #3529

comment:2 Changed 9 years ago by anonymous

thanks for the patch leorochael commited: r4146

comment:3 Changed 9 years ago by Leonardo Rochael Almeida

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

comment:4 Changed 9 years ago by Robert Corsaro

Resolution: fixed
Status: newclosed

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

comment:5 Changed 9 years ago by anonymous

Resolution: fixed
Status: closedreopened

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

comment:6 Changed 9 years ago by Leonardo Rochael Almeida

Resolution: fixed
Status: reopenedclosed

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 9 years ago by Josh Benner

Resolution: fixed
Status: closedreopened

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 9 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 9 years ago by Robert Corsaro

Resolution: fixed
Status: reopenedclosed

fixed in -r4240

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

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Stephen Hansen.
The resolution will be deleted.

Add Comment


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

 
Note: See TracTickets for help on using tickets.