From: Andrew Lewis Date: Wed, 11 Feb 2015 13:37:38 +0000 (+0200) Subject: Make Exim pass usernames to Rspamd X-Git-Tag: 0.9.0~729^2~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e77f51f8742e5d7fe13bcc709e263cb8bd2955bf;p=rspamd.git Make Exim pass usernames to Rspamd --- diff --git a/contrib/exim/patch-exim-src_spam.c.diff b/contrib/exim/patch-exim-src_spam.c.diff index 0dd8f09ba..f6005e0f8 100644 --- a/contrib/exim/patch-exim-src_spam.c.diff +++ b/contrib/exim/patch-exim-src_spam.c.diff @@ -1,6 +1,6 @@ diff -ru a/src/expand.c b/src/expand.c ---- a/src/expand.c 2014-08-09 14:44:29.000000000 +0200 -+++ b/src/expand.c 2015-01-31 20:08:55.022488664 +0200 +--- a/src/expand.c 2015-02-11 14:32:38.787982270 +0200 ++++ b/src/expand.c 2015-02-11 14:32:53.467982467 +0200 @@ -641,6 +641,7 @@ { "sn8", vtype_filter_int, &filter_sn[8] }, { "sn9", vtype_filter_int, &filter_sn[9] }, @@ -10,8 +10,8 @@ diff -ru a/src/expand.c b/src/expand.c { "spam_report", vtype_stringptr, &spam_report }, { "spam_score", vtype_stringptr, &spam_score }, diff -ru a/src/globals.c b/src/globals.c ---- a/src/globals.c 2014-08-09 14:44:29.000000000 +0200 -+++ b/src/globals.c 2015-01-31 20:08:55.026488703 +0200 +--- a/src/globals.c 2015-02-11 14:32:38.815982283 +0200 ++++ b/src/globals.c 2015-02-11 14:32:53.467982467 +0200 @@ -1257,6 +1257,7 @@ uschar *spamd_address = US"127.0.0.1 783"; uschar *spam_bar = NULL; @@ -21,8 +21,8 @@ diff -ru a/src/globals.c b/src/globals.c uschar *spam_score_int = NULL; #endif diff -ru a/src/globals.h b/src/globals.h ---- a/src/globals.h 2014-08-09 14:44:29.000000000 +0200 -+++ b/src/globals.h 2015-01-31 20:08:55.038488822 +0200 +--- a/src/globals.h 2015-02-11 14:32:38.835982265 +0200 ++++ b/src/globals.h 2015-02-11 14:32:53.467982467 +0200 @@ -803,6 +803,7 @@ extern uschar *spamd_address; /* address for the spamassassin daemon */ extern uschar *spam_bar; /* the spam "bar" (textual representation of spam_score) */ @@ -32,8 +32,8 @@ diff -ru a/src/globals.h b/src/globals.h extern uschar *spam_score_int; /* spam_score * 10 (int) */ #endif diff -ru a/src/spam.c b/src/spam.c ---- a/src/spam.c 2014-08-09 14:44:29.000000000 +0200 -+++ b/src/spam.c 2015-01-31 20:09:51.091042510 +0200 +--- a/src/spam.c 2015-02-11 14:32:38.803982272 +0200 ++++ b/src/spam.c 2015-02-11 14:34:39.287981868 +0200 @@ -14,6 +14,7 @@ uschar spam_score_buffer[16]; uschar spam_score_int_buffer[16]; @@ -111,7 +111,7 @@ diff -ru a/src/spam.c b/src/spam.c (void)fclose(mbox_file); (void)close(spamd_sock); return DEFER; -@@ -230,22 +257,47 @@ +@@ -230,22 +257,50 @@ return DEFER; } @@ -129,6 +129,7 @@ diff -ru a/src/spam.c b/src/spam.c + /* rspamd variant */ + const char *helo; + const char *fcrdns; ++ const char *authid; + uschar *req_str; + + req_str = string_sprintf("CHECK RSPAMC/1.3\r\nContent-length: %lu\r\n" @@ -142,6 +143,8 @@ diff -ru a/src/spam.c b/src/spam.c + req_str = string_sprintf("%sHostname: %s\r\n", req_str, fcrdns); + if (sender_host_address != NULL) + req_str = string_sprintf("%sIP: %s\r\n", req_str, sender_host_address); ++ if ((authid = expand_string(US"$authenticated_id")) != NULL && *authid != '\0') ++ req_str = string_sprintf("%sUser: %s\r\n", req_str, authid); + req_str = string_sprintf("%s\r\n", req_str); + wrote = send(spamd_sock, req_str, Ustrlen(req_str), 0); + } @@ -169,7 +172,7 @@ diff -ru a/src/spam.c b/src/spam.c /* now send the file */ /* spamd sometimes accepts conections but doesn't read data off -@@ -348,60 +400,93 @@ +@@ -348,60 +403,93 @@ /* reading done */ (void)close(spamd_sock); @@ -292,7 +295,7 @@ diff -ru a/src/spam.c b/src/spam.c } spam_bar_buffer[i] = '\0'; spam_bar = spam_bar_buffer; -@@ -417,12 +502,12 @@ +@@ -417,12 +505,12 @@ /* compare threshold against score */ if (spamd_score >= spamd_threshold) { @@ -310,8 +313,8 @@ diff -ru a/src/spam.c b/src/spam.c /* remember expanded spamd_address if needed */ diff -ru a/src/spam.h b/src/spam.h ---- a/src/spam.h 2014-08-09 14:44:29.000000000 +0200 -+++ b/src/spam.h 2015-01-31 20:08:55.054488979 +0200 +--- a/src/spam.h 2015-02-11 14:32:38.775982314 +0200 ++++ b/src/spam.h 2015-02-11 14:32:53.467982467 +0200 @@ -22,7 +22,8 @@ typedef struct spamd_address_container { diff --git a/contrib/exim/patch-exim-src_spam.c.diff.exim-4.85.diff b/contrib/exim/patch-exim-src_spam.c.diff.exim-4.85.diff index 0fb3ab4f1..7d6029f2d 100644 --- a/contrib/exim/patch-exim-src_spam.c.diff.exim-4.85.diff +++ b/contrib/exim/patch-exim-src_spam.c.diff.exim-4.85.diff @@ -1,33 +1,33 @@ 2,4c2,4 -< --- a/src/expand.c 2014-08-09 14:44:29.000000000 +0200 -< +++ b/src/expand.c 2015-01-31 20:08:55.022488664 +0200 +< --- a/src/expand.c 2015-02-11 14:32:38.787982270 +0200 +< +++ b/src/expand.c 2015-02-11 14:32:53.467982467 +0200 < @@ -641,6 +641,7 @@ --- > --- a/src/expand.c 2015-01-06 01:40:11.000000000 +0200 -> +++ b/src/expand.c 2015-01-31 19:40:00.965376958 +0200 +> +++ b/src/expand.c 2015-02-11 15:01:19.287978945 +0200 > @@ -652,6 +652,7 @@ 13,15c13,15 -< --- a/src/globals.c 2014-08-09 14:44:29.000000000 +0200 -< +++ b/src/globals.c 2015-01-31 20:08:55.026488703 +0200 +< --- a/src/globals.c 2015-02-11 14:32:38.815982283 +0200 +< +++ b/src/globals.c 2015-02-11 14:32:53.467982467 +0200 < @@ -1257,6 +1257,7 @@ --- > --- a/src/globals.c 2015-01-06 01:40:11.000000000 +0200 -> +++ b/src/globals.c 2015-01-31 19:40:00.977377440 +0200 +> +++ b/src/globals.c 2015-02-11 15:01:19.287978945 +0200 > @@ -1276,6 +1276,7 @@ 24,26c24,26 -< --- a/src/globals.h 2014-08-09 14:44:29.000000000 +0200 -< +++ b/src/globals.h 2015-01-31 20:08:55.038488822 +0200 +< --- a/src/globals.h 2015-02-11 14:32:38.835982265 +0200 +< +++ b/src/globals.h 2015-02-11 14:32:53.467982467 +0200 < @@ -803,6 +803,7 @@ --- > --- a/src/globals.h 2015-01-06 01:40:11.000000000 +0200 -> +++ b/src/globals.h 2015-01-31 19:40:00.985377380 +0200 +> +++ b/src/globals.h 2015-02-11 15:01:19.287978945 +0200 > @@ -819,6 +819,7 @@ 35,36c35,36 -< --- a/src/spam.c 2014-08-09 14:44:29.000000000 +0200 -< +++ b/src/spam.c 2015-01-31 20:09:51.091042510 +0200 +< --- a/src/spam.c 2015-02-11 14:32:38.803982272 +0200 +< +++ b/src/spam.c 2015-02-11 14:34:39.287981868 +0200 --- > --- a/src/spam.c 2015-01-06 01:40:11.000000000 +0200 -> +++ b/src/spam.c 2015-01-31 19:45:27.496599625 +0200 +> +++ b/src/spam.c 2015-02-11 15:17:20.867976302 +0200 70,71c70,72 < - if( sscanf(CS address, "%s %u", this_spamd->tcp_addr, &(this_spamd->tcp_port)) != 2 ) { < + if( sscanf(CS address, "%23s %hu", this_spamd->tcp_addr, &(this_spamd->tcp_port)) != 2 ) { @@ -45,20 +45,20 @@ --- > @@ -210,12 +221,28 @@ 114c114 -< @@ -230,22 +257,47 @@ +< @@ -230,22 +257,50 @@ --- -> @@ -231,22 +258,47 @@ -172c172 -< @@ -348,60 +400,93 @@ +> @@ -231,22 +258,50 @@ +175c175 +< @@ -348,60 +403,93 @@ --- -> @@ -349,60 +401,93 @@ -295c295 -< @@ -417,12 +502,12 @@ +> @@ -349,60 +404,93 @@ +298c298 +< @@ -417,12 +505,12 @@ --- -> @@ -418,12 +503,12 @@ -313,314c313,314 -< --- a/src/spam.h 2014-08-09 14:44:29.000000000 +0200 -< +++ b/src/spam.h 2015-01-31 20:08:55.054488979 +0200 +> @@ -418,12 +506,12 @@ +316,317c316,317 +< --- a/src/spam.h 2015-02-11 14:32:38.775982314 +0200 +< +++ b/src/spam.h 2015-02-11 14:32:53.467982467 +0200 --- > --- a/src/spam.h 2015-01-06 01:40:11.000000000 +0200 -> +++ b/src/spam.h 2015-01-31 19:40:01.005377591 +0200 +> +++ b/src/spam.h 2015-02-11 15:01:19.291978935 +0200