aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-06-21 20:14:00 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-06-21 20:14:00 +0400
commitd81433607b87acf08bab4ccb5a01f1c992dfb8bb (patch)
tree9a31487b3d148bd9fa2bab43cf9a7028f9e9a5a9 /src
parent9759175c6dcb897101db3528dc4f36e8c20639c1 (diff)
downloadrspamd-d81433607b87acf08bab4ccb5a01f1c992dfb8bb.tar.gz
rspamd-d81433607b87acf08bab4ccb5a01f1c992dfb8bb.zip
* Try to fix memmove issues in io dispatcher
* Remove debug from SURBL module
Diffstat (limited to 'src')
-rw-r--r--src/buffer.c16
-rw-r--r--src/plugins/surbl.c6
2 files changed, 11 insertions, 11 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 899b42fee..4351344fc 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -337,8 +337,6 @@ read_buffers (int fd, rspamd_io_dispatcher_t * d, gboolean skip_read)
/* Include EOL in reply */
res.len ++;
}
- /* Set new begin of line */
- b = c + 1;
/* Call callback for a line */
if (d->read_callback) {
if (!d->read_callback (&res, d->user_data)) {
@@ -348,14 +346,22 @@ read_buffers (int fd, rspamd_io_dispatcher_t * d, gboolean skip_read)
/* Drain buffer as policy is changed */
len = &d->in_buf->data->len;
pos = &d->in_buf->pos;
- memmove (d->in_buf->data->begin, b, c - b + 1);
- *len = c - b + 1;
- *pos = d->in_buf->data->begin + *len;
+ if (c != *pos) {
+ memmove (d->in_buf->data->begin, c + 1, *len - r - 1);
+ *len = *len -r - 1;
+ *pos = d->in_buf->data->begin + *len;
+ }
+ else {
+ *len = 0;
+ *pos = d->in_buf->data->begin;
+ }
debug_ip (d->peer_addr, "policy changed during callback, restart buffer's processing");
read_buffers (fd, d, TRUE);
return;
}
}
+ /* Set new begin of line */
+ b = c + 1;
}
r++;
c++;
diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c
index 4219bdd3d..bee37e209 100644
--- a/src/plugins/surbl.c
+++ b/src/plugins/surbl.c
@@ -382,12 +382,6 @@ format_surbl_request (memory_pool_t * pool, f_str_t * hostname, struct suffix_it
r = snprintf (result, len, "%*s",
(int)(hostname->len - (dots[dots_num - 2] - hostname->begin + 1)),
dots[dots_num - 2] + 1);
- for (i = 0; i < dots_num; i ++) {
- msg_info ("dot: %d, data: %*s", i,
- (int)(hostname->len - (dots[i] - hostname->begin + 1)),
- dots[i] + 1);
-
- }
}
else {
r = snprintf (result, len, "%*s", (int)hostname->len, hostname->begin);