From afb4584b160bf427a633045ba810057fd6c07e85 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Thu, 28 Dec 2017 11:30:08 +0100 Subject: [PATCH] MailQueue.pm: create new TicketID when inserting data to CMSReceivers --- PMG/MailQueue.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/PMG/MailQueue.pm b/PMG/MailQueue.pm index b7dcb6c..37d30d7 100644 --- a/PMG/MailQueue.pm +++ b/PMG/MailQueue.pm @@ -170,6 +170,8 @@ sub quarantinedb_insert { my $now = time(); + my $tid = int(rand(0x0fffffff)); + foreach my $r (@$targets) { my $pmail = get_primary_mail ($ldap, $r); my $receiver; @@ -182,8 +184,11 @@ sub quarantinedb_insert { $pmail = $dbh->quote ($pmail); $insert_cmds .= "INSERT INTO CMSReceivers " . - "(CMailStore_CID, CMailStore_RID, PMail, Receiver, Status, MTime) " . - "VALUES ($lcid, currval ('cmailstore_id_seq'), $pmail, $receiver, 'N', $now); "; + "(CMailStore_CID, CMailStore_RID, PMail, Receiver, TicketID, Status, MTime) " . + "VALUES ($lcid, currval ('cmailstore_id_seq'), $pmail, $receiver, $tid, 'N', $now); "; + + # Note: Tuple (CID, RID, TicketID) must be unique + $tid = ($tid + 1) & 0x0fffffff; } $dbh->do ($insert_cmds); -- 2.39.5