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

master
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
1 changed files with 2 additions and 1 deletions

View File

@ -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)