rspamd_dkim_context_t*
rspamd_create_dkim_context (const gchar *sig, memory_pool_t *pool, guint time_jitter, GError **err)
{
- const gchar *p, *c, *tag, *end;
+ const gchar *p, *c, *tag = NULL, *end;
gsize taglen;
gint param = DKIM_PARAM_UNKNOWN;
time_t now;
sizeof (struct in_addr));
addr_str = g_strdup (inet_ntoa (su.s4.sin_addr));
}
+ else if (su.ss.ss_family == AF_INET6) {
+ addr_str = g_malloc0 (INET6_ADDRSTRLEN + 1);
+ /* XXX: support ipv6 addresses here */
+ addr.s_addr = INADDR_NONE;
+ inet_ntop (AF_INET6, &su.s6.sin6_addr, addr_str, INET6_ADDRSTRLEN);
+ msg_info ("accepted connection from [%s] port %d",
+ addr_str, ntohs (su.s6.sin6_port));
+ }
+ else {
+ addr.s_addr = INADDR_NONE;
+ msg_err ("accepted connection from unsupported address family: %d", su.ss.ss_family);
+ close (nfd);
+ return;
+ }
/* Call finalizer function */
lua_rawgeti (L, LUA_REGISTRYINDEX, ctx->cbref_accept);
}
static gboolean
-process_regexp_expression (struct expression *expr, gchar *symbol, struct worker_task *task, const gchar *additional, struct lua_locked_state *nL)
+process_regexp_expression (struct expression *expr, gchar *symbol, struct worker_task *task,
+ const gchar *additional, struct lua_locked_state *nL)
{
GQueue *stack;
gsize cur, op1, op2;
}
else if (it->type == EXPR_STR) {
/* This may be lua function, try to call it */
- if (regexp_module_ctx->workers != NULL) {
- if (nL) {
- rspamd_mutex_lock (nL->m);
- cur = maybe_call_lua_function ((const gchar*)it->content.operand, task, nL->L);
- rspamd_mutex_unlock (nL->m);
- }
- else {
- cur = maybe_call_lua_function ((const gchar*)it->content.operand, task, task->cfg->lua_state);
- }
+ if (nL) {
+ rspamd_mutex_lock (nL->m);
+ cur = maybe_call_lua_function ((const gchar*)it->content.operand, task, nL->L);
+ rspamd_mutex_unlock (nL->m);
+ }
+ else {
+ cur = maybe_call_lua_function ((const gchar*)it->content.operand, task, task->cfg->lua_state);
}
debug_task ("function %s returned %s", (const gchar *)it->content.operand, cur ? "true" : "false");
if (try_optimize) {
gint r = 0;
gchar *local_act;
- if (task->pre_result.action == METRIC_ACTION_NOACTION) {
- local_act = "False";
- }
- else if (task->pre_result.action <= METRIC_ACTION_SOFT_REJECT) {
+ if (task->pre_result.action <= METRIC_ACTION_SOFT_REJECT) {
local_act = "True";
}
+ else {
+ local_act = "False";
+ }
if (metric_res == NULL) {
/* This is case when we got reject result from pre filters */
r = rspamd_snprintf (outbuf, size,
if (session->state != SMTP_PROXY_STATE_PROXY && session->state != SMTP_PROXY_STATE_REJECT &&
session->state != SMTP_PROXY_STATE_REJECT_EMULATE) {
/* Send 521 fatal error */
- write (session->sock, fatal_smtp_error, sizeof (fatal_smtp_error));
+ if (write (session->sock, fatal_smtp_error, sizeof (fatal_smtp_error)) == -1) {
+ msg_err ("write error to client failed: %s", strerror (errno));
+ }
}
else if ((session->state == SMTP_PROXY_STATE_REJECT || session->state == SMTP_PROXY_STATE_REJECT_EMULATE) &&
session->from && session->rcpt && session->dnsbl_applied) {