From: Arjen Baart Date: Fri, 25 Sep 2020 16:49:57 +0000 (+0200) Subject: spamdetect: Log all mail header lines X-Git-Url: http://www.andromeda.nl/gitweb/?p=gnucomo.git;a=commitdiff_plain;h=29fac597a43b1cffe2b6de60cb8e4c69f7ca435e spamdetect: Log all mail header lines --- diff --git a/src/gcm_input/spamdetect.cpp b/src/gcm_input/spamdetect.cpp index cfe3367..38487fe 100644 --- a/src/gcm_input/spamdetect.cpp +++ b/src/gcm_input/spamdetect.cpp @@ -57,6 +57,7 @@ int main(int argc, char *argv[]) regex fwd_header("---- .+ Message -----"); regex received("^Received:"); regex from("^From:"); + regex subject("^Subject:"); regex returnpath("^Return-Path:"); openlog("gnucomo", 0, LOG_MAIL); @@ -64,6 +65,7 @@ int main(int argc, char *argv[]) while (std::cin >> line) { + //std::cout << "[" << state << "] checking " << line << "\n"; // DEBUG switch (state) { case 0: @@ -75,7 +77,7 @@ int main(int argc, char *argv[]) case 1: // Inside the forwarded header - if (line == received || line == from || line == returnpath) + if (line == received || line == from || line == returnpath || line == subject) { header = line; state = 2; @@ -84,14 +86,10 @@ int main(int argc, char *argv[]) case 2: if (line == regex("^[^ ]+: ")) { + //std::cout << "Header: " << header << "\n"; // DEBUG syslog(LOG_WARNING, "%s", (char *)header); - header = ""; - state = 1; - if (line == received || line == from || line == returnpath) - { - header = line; - state = 2; - } + + header = line; } else if (line == String("")) {