summaryrefslogtreecommitdiffstats
path: root/src/fuzzy_storage.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <none@none>2010-05-08 02:21:05 +0400
committerVsevolod Stakhov <none@none>2010-05-08 02:21:05 +0400
commita5b2977921dfdeee2cacdf4569dd662358775812 (patch)
treee565bd576b7a55bd30b83f007749d034272bc8b1 /src/fuzzy_storage.c
parent21550cd5e4fe1ff6058720db006ce417a3cb0068 (diff)
downloadrspamd-a5b2977921dfdeee2cacdf4569dd662358775812.tar.gz
rspamd-a5b2977921dfdeee2cacdf4569dd662358775812.zip
* Fix fuzzy storage interaction with old rspamd
Diffstat (limited to 'src/fuzzy_storage.c')
-rw-r--r--src/fuzzy_storage.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c
index 3be999720..8957c9d35 100644
--- a/src/fuzzy_storage.c
+++ b/src/fuzzy_storage.c
@@ -668,6 +668,12 @@ accept_fuzzy_socket (int fd, short what, void *arg)
struct rspamd_worker *worker = (struct rspamd_worker *)arg;
struct fuzzy_session session;
ssize_t r;
+ struct {
+ u_char cmd;
+ uint32_t blocksize;
+ int32_t value;
+ u_char hash[FUZZY_HASHLEN];
+ } legacy_cmd;
session.worker = worker;
@@ -685,6 +691,16 @@ accept_fuzzy_socket (int fd, short what, void *arg)
/* Assume that the whole command was read */
process_fuzzy_command (&session);
}
+ else if (r == sizeof (legacy_cmd)) {
+ /* Process requests from old rspamd */
+ memcpy (&legacy_cmd, session.pos, sizeof (legacy_cmd));
+ session.cmd.cmd = legacy_cmd.cmd;
+ session.cmd.blocksize = legacy_cmd.blocksize;
+ session.cmd.value = legacy_cmd.value;
+ session.cmd.flag = 0;
+ memcpy (session.cmd.hash, legacy_cmd.hash, sizeof (legacy_cmd.hash));
+ process_fuzzy_command (&session);
+ }
else {
msg_err ("got incomplete data while reading from socket: %d, %s", errno, strerror (errno));
return;