From 0a3b5d51dfbabfe45b08fef061c4838e87a50df5 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Thu, 11 Oct 2012 12:57:23 +0200 Subject: [PATCH] =?UTF-8?q?Troncage=20du=20sujet=20apr=C3=A8s=20les=20255?= =?UTF-8?q?=20premiers=20caract=C3=A8res?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- root/usr/share/qpsmtpd/plugins/logging/log2sql | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/root/usr/share/qpsmtpd/plugins/logging/log2sql b/root/usr/share/qpsmtpd/plugins/logging/log2sql index 124616e..24d1241 100644 --- a/root/usr/share/qpsmtpd/plugins/logging/log2sql +++ b/root/usr/share/qpsmtpd/plugins/logging/log2sql @@ -136,8 +136,13 @@ my($header) = $transaction->header(); #'touch' this message :-)) $header->add("X-Sql-Log-ID",$mail_id); +my $subject = scalar $header->get("Subject"); +chomp($subject); +# Only keep the first 255 chars to be sure it can be inserted in the table +$subject= substr $subject, 0, 254; + my($statement) = "UPDATE ".$mail_table." SET subject=". - $dbh->quote(scalar $header->get("Subject")). + $dbh->quote($subject). ",header_size=".$dbh->quote(length($header->as_string())). ",body_size=".$dbh->quote($transaction->body_size()). " WHERE mail_id=".$mail_id;