Page MenuHomePhorge

D5475.1775353563.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D5475.1775353563.diff

diff --git a/docker/postfix/rootfs/usr/libexec/postfix/kolab_contentfilter_cli b/docker/postfix/rootfs/usr/libexec/postfix/kolab_contentfilter_cli
--- a/docker/postfix/rootfs/usr/libexec/postfix/kolab_contentfilter_cli
+++ b/docker/postfix/rootfs/usr/libexec/postfix/kolab_contentfilter_cli
@@ -53,7 +53,18 @@
filename='/var/log/kolab/postfix-content-filter.log',
filemode='a')
- content = ''.join(sys.stdin.readlines())
+ content = sys.stdin.read()
+
+ # To debug what we actually get in terms of line endings
+ # I've tested sys.stdin.buffer, but it seems we get LF line endings from postfix
+ # logcontent = content
+ # logcontent = logcontent.replace("\r", "CR")
+ # logcontent = logcontent.replace("\n", "LF\n")
+ # logging.info(logcontent)
+
+ # Normalize to CRLF line endings.
+ content = content.replace('\r\n', '\n')
+ content = content.replace('\n', '\r\n')
try:
to = ','.join(cli_to)
diff --git a/src/app/Policy/Mailfilter/MailParser.php b/src/app/Policy/Mailfilter/MailParser.php
--- a/src/app/Policy/Mailfilter/MailParser.php
+++ b/src/app/Policy/Mailfilter/MailParser.php
@@ -400,6 +400,13 @@
break;
}
+ // All emails MUST have CRLF line endings, per RFC and the parser does not work otherwise.
+ if (!str_ends_with($line, "\r\n")) {
+ $line = str_replace("\r", 'CR', $line);
+ $line = str_replace("\n", 'LF', $line);
+ throw new \Exception("Email with non CRLF line-ending detected: $line");
+ }
+
if ($line == "\n" || $line == "\r\n") {
break;
}

File Metadata

Mime Type
text/plain
Expires
Sun, Apr 5, 1:46 AM (8 h, 19 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18831873
Default Alt Text
D5475.1775353563.diff (1 KB)

Event Timeline