[Dovecot] Fix memory leak when quarantine sender has non-ascii chars in mail address

This commit is contained in:
andryyy 2019-05-16 19:44:14 +02:00
parent 6a8c4e332b
commit 389317e9e4
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF

View File

@ -83,13 +83,14 @@ def notify_rcpt(rcpt, msg_count, quarantine_acl):
msg.attach(html_part) msg.attach(html_part)
msg['To'] = str(rcpt) msg['To'] = str(rcpt)
text = msg.as_string() text = msg.as_string()
server.sendmail(msg['From'], msg['To'], text) server.sendmail(msg['From'].encode("ascii", errors="ignore"), msg['To'], text)
server.quit() server.quit()
for res in meta_query: for res in meta_query:
query_mysql('UPDATE quarantine SET notified = 1 WHERE id = "%d"' % (res['id']), update = True) query_mysql('UPDATE quarantine SET notified = 1 WHERE id = "%d"' % (res['id']), update = True)
r.hset('Q_LAST_NOTIFIED', record['rcpt'], time_now) r.hset('Q_LAST_NOTIFIED', record['rcpt'], time_now)
break break
except Exception as ex: except Exception as ex:
server.quit()
print '%s' % (ex) print '%s' % (ex)
time.sleep(3) time.sleep(3)