From 389317e9e4fb3f35e9021c6dea36a10ee49d96d3 Mon Sep 17 00:00:00 2001 From: andryyy Date: Thu, 16 May 2019 19:44:14 +0200 Subject: [PATCH] [Dovecot] Fix memory leak when quarantine sender has non-ascii chars in mail address --- data/Dockerfiles/dovecot/quarantine_notify.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data/Dockerfiles/dovecot/quarantine_notify.py b/data/Dockerfiles/dovecot/quarantine_notify.py index 28a7aabe..b1af332a 100755 --- a/data/Dockerfiles/dovecot/quarantine_notify.py +++ b/data/Dockerfiles/dovecot/quarantine_notify.py @@ -83,13 +83,14 @@ def notify_rcpt(rcpt, msg_count, quarantine_acl): msg.attach(html_part) msg['To'] = str(rcpt) text = msg.as_string() - server.sendmail(msg['From'], msg['To'], text) + server.sendmail(msg['From'].encode("ascii", errors="ignore"), msg['To'], text) server.quit() for res in meta_query: query_mysql('UPDATE quarantine SET notified = 1 WHERE id = "%d"' % (res['id']), update = True) r.hset('Q_LAST_NOTIFIED', record['rcpt'], time_now) break except Exception as ex: + server.quit() print '%s' % (ex) time.sleep(3)