projects
/
gnucomo.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
529d9e3
)
spamdetect: Log all mail header lines
author
Arjen Baart
<arjen@andromeda.nl>
Fri, 25 Sep 2020 16:49:57 +0000
(18:49 +0200)
committer
Arjen Baart
<arjen@andromeda.nl>
Fri, 25 Sep 2020 16:49:57 +0000
(18:49 +0200)
src/gcm_input/spamdetect.cpp
patch
|
blob
|
history
diff --git
a/src/gcm_input/spamdetect.cpp
b/src/gcm_input/spamdetect.cpp
index
cfe3367
..
38487fe
100644
(file)
--- 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 fwd_header("---- .+ Message -----");
regex received("^Received:");
regex from("^From:");
+ regex subject("^Subject:");
regex returnpath("^Return-Path:");
openlog("gnucomo", 0, LOG_MAIL);
regex returnpath("^Return-Path:");
openlog("gnucomo", 0, LOG_MAIL);
@@
-64,6
+65,7
@@
int main(int argc, char *argv[])
while (std::cin >> line)
{
while (std::cin >> line)
{
+ //std::cout << "[" << state << "] checking " << line << "\n"; // DEBUG
switch (state)
{
case 0:
switch (state)
{
case 0:
@@
-75,7
+77,7
@@
int main(int argc, char *argv[])
case 1:
// Inside the forwarded header
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;
{
header = line;
state = 2;
@@
-84,14
+86,10
@@
int main(int argc, char *argv[])
case 2:
if (line == regex("^[^ ]+: "))
{
case 2:
if (line == regex("^[^ ]+: "))
{
+ //std::cout << "Header: " << header << "\n"; // DEBUG
syslog(LOG_WARNING, "%s", (char *)header);
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(""))
{
}
else if (line == String(""))
{