aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/surbl.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2008-12-03 19:48:15 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2008-12-03 19:48:15 +0300
commit42b81716ece887b0011b1e40b0101ad37598997e (patch)
tree62d7512875ea0e2adb47d524d23628d86e83b4d4 /src/plugins/surbl.c
parentd62fb36650acfd0863c32a78b0941a4c0d0e58b1 (diff)
downloadrspamd-42b81716ece887b0011b1e40b0101ad37598997e.tar.gz
rspamd-42b81716ece887b0011b1e40b0101ad37598997e.zip
* Remove strlcpy code and replace it with glib alternative
* Polish code and remove bugs found
Diffstat (limited to 'src/plugins/surbl.c')
-rw-r--r--src/plugins/surbl.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c
index c90a8419e..07e2376bf 100644
--- a/src/plugins/surbl.c
+++ b/src/plugins/surbl.c
@@ -337,7 +337,7 @@ memcached_callback (memcached_ctx_t *ctx, memc_error_t error, void *data)
switch (ctx->op) {
case CMD_CONNECT:
if (error != OK) {
- msg_info ("memcached_callback: memcached returned error %s on CONNECT stage");
+ msg_info ("memcached_callback: memcached returned error %s on CONNECT stage", memc_strerror (error));
memc_close_ctx (param->ctx);
param->task->save.saved --;
if (param->task->save.saved == 0) {
@@ -356,7 +356,7 @@ memcached_callback (memcached_ctx_t *ctx, memc_error_t error, void *data)
break;
case CMD_READ:
if (error != OK) {
- msg_info ("memcached_callback: memcached returned error %s on READ stage");
+ msg_info ("memcached_callback: memcached returned error %s on READ stage", memc_strerror (error));
memc_close_ctx (param->ctx);
param->task->save.saved --;
if (param->task->save.saved == 0) {
@@ -382,7 +382,7 @@ memcached_callback (memcached_ctx_t *ctx, memc_error_t error, void *data)
break;
case CMD_WRITE:
if (error != OK) {
- msg_info ("memcached_callback: memcached returned error %s on WRITE stage");
+ msg_info ("memcached_callback: memcached returned error %s on WRITE stage", memc_strerror (error));
}
memc_close_ctx (param->ctx);
param->task->save.saved --;
@@ -428,7 +428,7 @@ register_memcached_call (struct uri *url, struct worker_task *task)
cur_param->bufsize = sizeof (int);
sum_str = g_compute_checksum_for_string (G_CHECKSUM_MD5, struri (url), -1);
- strlcpy (cur_param->key, sum_str, sizeof (cur_param->key));
+ g_strlcpy (cur_param->key, sum_str, sizeof (cur_param->key));
g_free (sum_str);
selected = (struct memcached_server *) get_upstream_by_hash ((void *)task->cfg->memcached_servers,
@@ -471,7 +471,18 @@ redirector_callback (int fd, short what, void *arg)
event_set (&param->ev, param->sock, EV_READ | EV_PERSIST | EV_TIMEOUT, redirector_callback, (void *)param);
event_add (&param->ev, &timeout);
r = snprintf (url_buf, sizeof (url_buf), "GET %s HTTP/1.0\r\n\r\n", struri (param->url));
- write (param->sock, url_buf, r);
+ if (write (param->sock, url_buf, r) == -1) {
+ msg_err ("redirector_callback: write failed %m");
+ event_del (&param->ev);
+ param->task->save.saved --;
+ if (param->task->save.saved == 0) {
+ /* Call other filters */
+ param->task->save.saved = 1;
+ process_filters (param->task);
+ }
+ g_free (param);
+ return;
+ }
param->state = STATE_READ;
}
else {