diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-07-31 19:42:21 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-07-31 19:42:21 +0400 |
commit | a9c4a7af9415b57397687bd3005dfcd96a01881d (patch) | |
tree | 3aba3246cfe4284ed40ed14c2e1a1d59518de30c /rspamc.pl.in | |
parent | b227b759d6775b4ad3dc1a9739e16ed93e0e345e (diff) | |
download | rspamd-a9c4a7af9415b57397687bd3005dfcd96a01881d.tar.gz rspamd-a9c4a7af9415b57397687bd3005dfcd96a01881d.zip |
* Make fuzzy storage working (tested checking, adding and deleting of fuzzy hashes from storage)
* Fix stupid bug in fuzzy distance calculations
Diffstat (limited to 'rspamc.pl.in')
-rwxr-xr-x | rspamc.pl.in | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/rspamc.pl.in b/rspamc.pl.in index ccbc73cc4..4185039de 100755 --- a/rspamc.pl.in +++ b/rspamc.pl.in @@ -188,6 +188,30 @@ sub do_control_command { print "Authentication failed\n"; } } + elsif ($cfg{'command'} =~ /(fuzzy_add|fuzzy_del)/i) { + while (defined (my $line = <>)) { + $input .= $line; + } + + if (do_ctrl_auth ($sock)) { + my $len = length ($input); + print "Sending $len bytes...\n"; + syswrite $sock, $cfg{'command'} . " $len" . $CRLF; + syswrite $sock, $input . $CRLF; + if (defined (my $reply = <$sock>)) { + if ($reply =~ /^OK/) { + print $cfg{'command'} . " succeed\n"; + } + else { + print $cfg{'command'} . " failed\n"; + } + } + } + else { + print "Authentication failed\n"; + } + + } else { syswrite $sock, $cfg{'command'} . $CRLF; while (defined (my $line = <$sock>)) { @@ -240,7 +264,7 @@ if ($cmd =~ /(SYMBOLS|SCAN|PROCESS|CHECK|REPORT_IFSPAM|REPORT|URLS|EMAILS)/i) { $cfg{'command'} = $1; $cfg{'control'} = 0; } -elsif ($cmd =~ /(STAT|LEARN|SHUTDOWN|RELOAD|UPTIME|COUNTERS)/i) { +elsif ($cmd =~ /(STAT|LEARN|SHUTDOWN|RELOAD|UPTIME|COUNTERS|FUZZY_ADD|FUZZY_DEL)/i) { $cfg{'command'} = $1; $cfg{'control'} = 1; } |