summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lewis <exim@judo.za.org>2015-02-14 20:32:25 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2015-02-14 20:33:00 +0000
commit6c54be6459b83b955fbd2fd6d6a844f80c98427a (patch)
treeae7a9c39bd8a66319fd794a28ae0f3f550283425
parentf69979cfecf29a4910b5750cad41d21a5418c6c7 (diff)
Rspamd: add $authenticated_id as User to scan command
-rw-r--r--src/src/spam.c16
-rw-r--r--test/scripts/4000-scanning/40081
-rw-r--r--test/stdout/40081
3 files changed, 12 insertions, 6 deletions
diff --git a/src/src/spam.c b/src/src/spam.c
index 96780f59e..4b99aca4b 100644
--- a/src/src/spam.c
+++ b/src/src/spam.c
@@ -380,8 +380,9 @@ if (spamd_sock == -1)
if (sd->is_rspamd)
{ /* rspamd variant */
uschar *req_str;
- const char *helo;
- const char *fcrdns;
+ const uschar * helo;
+ const uschar * fcrdns;
+ const uschar * authid;
req_str = string_sprintf("CHECK RSPAMC/1.3\r\nContent-length: %lu\r\n"
"Queue-Id: %s\r\nFrom: <%s>\r\nRecipient-Number: %d\r\n", mbox_size,
@@ -394,10 +395,12 @@ if (sd->is_rspamd)
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);
}
- else
+else
{ /* spamassassin variant */
(void)string_format(spamd_buffer,
sizeof(spamd_buffer),
@@ -407,6 +410,7 @@ if (sd->is_rspamd)
/* send our request */
wrote = send(spamd_sock, spamd_buffer, Ustrlen(spamd_buffer), 0);
}
+
if (wrote == -1)
{
(void)close(spamd_sock);
@@ -527,9 +531,9 @@ if (sd->is_rspamd)
spamd_version, spamd_short_result, &spamd_score, &spamd_threshold,
&spamd_reject_score, &spamd_report_offset)) != 5)
{
- log_write(0, LOG_MAIN|LOG_PANIC,
- "%s cannot parse spamd output: %d", loglabel, r);
- return DEFER;
+ log_write(0, LOG_MAIN|LOG_PANIC,
+ "%s cannot parse spamd output: %d", loglabel, r);
+ return DEFER;
}
/* now parse action */
p = &spamd_buffer[spamd_report_offset];
diff --git a/test/scripts/4000-scanning/4008 b/test/scripts/4000-scanning/4008
index 30c1d94d0..c44b93854 100644
--- a/test/scripts/4000-scanning/4008
+++ b/test/scripts/4000-scanning/4008
@@ -7,6 +7,7 @@ server 11333
<Recipient-Number: 1
<Rcpt:
<Helo:
+<User:
<
<From
<X-Envelope-From
diff --git a/test/stdout/4008 b/test/stdout/4008
index 957fbd8c5..e41af881d 100644
--- a/test/stdout/4008
+++ b/test/stdout/4008
@@ -20,6 +20,7 @@ Connection request from [127.0.0.1]
<Recipient-Number: 1
<Rcpt: <userx@test.ex>
<Helo: test.ex
+<User: CALLER
<
<From MAILER-DAEMON Tue Mar 02 09:44:33 1999
<X-Envelope-From: <CALLER@myhost.test.ex>