aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-04-19 17:17:01 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-04-19 17:17:01 +0100
commitcce0110d9ec635c47b8c557e3ecaa9c0936671a2 (patch)
treea2f325f6eee7d10b3a1a8e04b0ceffbcc328b188 /utils
parent523def594e31dd5b29e0899f51d69b8f940ffbc2 (diff)
downloadrspamd-cce0110d9ec635c47b8c557e3ecaa9c0936671a2.tar.gz
rspamd-cce0110d9ec635c47b8c557e3ecaa9c0936671a2.zip
[Minor] Support authenticated users in CGP helper
Diffstat (limited to 'utils')
-rw-r--r--utils/cgp_rspamd.pl14
1 files changed, 12 insertions, 2 deletions
diff --git a/utils/cgp_rspamd.pl b/utils/cgp_rspamd.pl
index 78ca89462..6851e6dd4 100644
--- a/utils/cgp_rspamd.pl
+++ b/utils/cgp_rspamd.pl
@@ -192,6 +192,7 @@ sub rspamd_scan {
my $from;
my @rcpts;
my $ip;
+ my $user;
foreach my $elt (@envelope) {
if ( $elt =~ /^P\s[^<]*(<[^>]*>).*$/ ) {
@@ -200,8 +201,13 @@ sub rspamd_scan {
elsif ( $elt =~ /^R\s[^<]*(<[^>]*>).*$/ ) {
push @rcpts, $1;
}
- elsif ( $elt =~ /^S .*\[(.+)\]/ ) {
- $ip = $1;
+ elsif ( $elt =~ /^S (?:<([^>]+)>)?\s*S.*\[(.+)\]/ ) {
+ if ($1) {
+ $user = $1;
+ }
+ if ($2) {
+ $ip = $2;
+ }
}
}
@@ -221,6 +227,10 @@ sub rspamd_scan {
$headers->{IP} = $ip;
}
+ if ($user) {
+ $headers->{User} = $user;
+ }
+
http_post(
"http://$rspamd_host/checkv2", $data,
timeout => $request_timeout,