/* We have some unknown salt here */
msg_info_ctx ("incorrect key: %z, while %z expected",
key_len, pbkdf->key_len);
+ g_free (salt_decoded);
+ g_free (key_decoded); /* valid even if key_decoded == NULL */
+
return FALSE;
}
rspamd_controller_send_ucl (conn_ent, res);
ucl_object_unref (res);
g_free (acc);
+ g_free (rrd_result);
return 0;
}
struct rspamd_control_reply rep;
rep.reply.fuzzy_sync.status = 0;
+ rep.type = RSPAMD_CONTROL_FUZZY_SYNC;
if (ctx->backend && worker->index == 0) {
rspamd_fuzzy_process_updates_queue (ctx, local_db_name, FALSE);
worker->cf->options, rspamd_main->cfg,
&err)) == NULL) {
msg_err ("cannot open backend after reload: %e", err);
- g_error_free (err);
rep.reply.reload.status = err->code;
+ g_error_free (err);
}
else {
rep.reply.reload.status = 0;
static int
lua_fuzzy_add_pre_handler (lua_State *L)
{
- struct rspamd_worker *wrk = *(struct rspamd_worker **)
+ struct rspamd_worker *wrk, **pwrk = (struct rspamd_worker **)
rspamd_lua_check_udata (L, 1, "rspamd{worker}");
struct rspamd_fuzzy_storage_ctx *ctx;
+ if (!pwrk) {
+ return luaL_error (L, "invalid arguments, worker + function are expected");
+ }
+
+ wrk = *pwrk;
+
if (wrk && lua_isfunction (L, 2)) {
ctx = (struct rspamd_fuzzy_storage_ctx *)wrk->ctx;
static int
lua_fuzzy_add_post_handler (lua_State *L)
{
- struct rspamd_worker *wrk = *(struct rspamd_worker **)
+ struct rspamd_worker *wrk, **pwrk = (struct rspamd_worker **)
rspamd_lua_check_udata (L, 1, "rspamd{worker}");
struct rspamd_fuzzy_storage_ctx *ctx;
+ if (!pwrk) {
+ return luaL_error (L, "invalid arguments, worker + function are expected");
+ }
+
+ wrk = *pwrk;
+
if (wrk && lua_isfunction (L, 2)) {
ctx = (struct rspamd_fuzzy_storage_ctx *)wrk->ctx;
msg_err_session ("cannot connect to upstream, maximum retries "
"has been reached: %d", session->retries);
/* Terminate session immediately */
- proxy_client_write_error (session, err->code, err->message);
+ if (err) {
+ proxy_client_write_error(session, err->code, err->message);
+ }
+ else {
+ proxy_client_write_error(session, 503, "Unknown error after no retries left");
+ }
}
else {
if (!proxy_send_master_message (session)) {
- proxy_client_write_error (session, err->code, err->message);
+ if (err) {
+ proxy_client_write_error(session, err->code, err->message);
+ }
+ else {
+ proxy_client_write_error(session, 503, "Unknown error on write");
+ }
}
else {
msg_info_session ("retry connection to: %s"