Strictly follow c99 standart.
Turn on pedantic c99 checks.
# Process with warn flags
CHECK_C_COMPILER_FLAG(-Wall SUPPORT_WALL)
+CHECK_C_COMPILER_FLAG(-Wall SUPPORT_W)
CHECK_C_COMPILER_FLAG(-Wpointer-arith SUPPORT_WPOINTER)
CHECK_C_COMPILER_FLAG(-Wno-unused-parameter SUPPORT_WPARAM)
CHECK_C_COMPILER_FLAG(-Wno-unused-function SUPPORT_WFUNCTION)
CHECK_C_COMPILER_FLAG(-Wunused-variable SUPPORT_WUNUSED_VAR)
CHECK_C_COMPILER_FLAG(-Wno-declaration-after-statement SUPPORT_WDECL)
CHECK_C_COMPILER_FLAG(-Wno-pointer-sign SUPPORT_WPOINTER_SIGN)
+CHECK_C_COMPILER_FLAG(-pedantic SUPPORT_PEDANTIC_FLAG)
+CHECK_C_COMPILER_FLAG("-std=c99" SUPPORT_STD_FLAG)
-SET(CMAKE_C_WARN_FLAGS "-W")
+SET(CMAKE_C_WARN_FLAGS "")
+IF(SUPPORT_W)
+ SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -W")
+ENDIF(SUPPORT_W)
IF(SUPPORT_WALL)
SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wall")
ENDIF(SUPPORT_WALL)
IF(SUPPORT_WPOINTER_SIGN)
SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wno-pointer-sign")
ENDIF(SUPPORT_WPOINTER_SIGN)
+IF(SUPPORT_PEDANTIC_FLAG)
+ SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -pedantic")
+ENDIF(SUPPORT_PEDANTIC_FLAG)
+IF(SUPPORT_STD_FLAG)
+ SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -std=c99")
+ENDIF(SUPPORT_STD_FLAG)
SET(CMAKE_C_FLAGS "${CMAKE_C_OPT_FLAGS} ${CMAKE_C_FLAGS} ${CMAKE_C_WARN_FLAGS}")
off_t seek;
if (!log || !log->metaindex || !log->cur_idx || !nodes) {
- msg_info ("improperly opened binlog: %s", log->filename);
+ msg_info ("improperly opened binlog: %s", log != NULL ? log->filename : "unknown");
return FALSE;
}
/* Check metaindex free space */
if (log->metaindex->last_index < METAINDEX_LEN) {
/* Create new index block */
- if ((seek = lseek (log->fd, 0, SEEK_END)) == -1) {
+ if ((seek = lseek (log->fd, 0, SEEK_END)) == (off_t)-1) {
msg_info ("cannot seek in file: %s, error: %s", log->filename, strerror (errno));
return FALSE;
}
gboolean idx_mapped = FALSE, res = TRUE, is_first = FALSE;
if (!log || !log->metaindex || !log->cur_idx) {
- msg_info ("improperly opened binlog: %s", log->filename);
+ msg_info ("improperly opened binlog: %s", log != NULL ? log->filename : "unknown");
return FALSE;
}
#include "main.h"
#define G_DISPATCHER_ERROR dispatcher_error_quark()
+#define debug_ip(...) rspamd_conditional_debug(d->peer_addr, __FUNCTION__, __VA_ARGS__)
static void dispatcher_cb (gint fd, short what, void *arg);
}
}
else {
- debug_ip (d->peer_addr, "partially write data, retry");
+ debug_ip("partially write data, retry");
/* Wait for other event */
d->offset += off;
event_del (d->ev);
else {
if (d->write_callback) {
if (!d->write_callback (d->user_data)) {
- debug_ip (d->peer_addr, "callback set wanna_die flag, terminating");
+ debug_ip("callback set wanna_die flag, terminating");
return FALSE;
}
}
}
}
else {
- debug_ip (d->peer_addr, "partially write data, retry");
+ debug_ip("partially write data, retry");
/* Wait for other event */
event_del (d->ev);
event_set (d->ev, d->fd, EV_WRITE, dispatcher_cb, (void *)d);
}
}
else if (r + d->offset < d->file_size) {
- debug_ip (d->peer_addr, "partially write data, retry");
+ debug_ip("partially write data, retry");
/* Wait for other event */
event_del (d->ev);
event_set (d->ev, d->fd, EV_WRITE, dispatcher_cb, (void *)d);
else {
if (d->write_callback) {
if (!d->write_callback (d->user_data)) {
- debug_ip (d->peer_addr, "callback set wanna_die flag, terminating");
+ debug_ip("callback set wanna_die flag, terminating");
return FALSE;
}
}
}
}
else {
- debug_ip (d->peer_addr, "partially write data, retry");
+ debug_ip("partially write data, retry");
/* Wait for other event */
event_del (d->ev);
event_set (d->ev, d->fd, EV_WRITE, dispatcher_cb, (void *)d);
}
else if (r + d->offset < d->file_size) {
d->offset += r;
- debug_ip (d->peer_addr, "partially write data, retry");
+ debug_ip("partially write data, retry");
/* Wait for other event */
event_del (d->ev);
event_set (d->ev, d->fd, EV_WRITE, dispatcher_cb, (void *)d);
else {
if (d->write_callback) {
if (!d->write_callback (d->user_data)) {
- debug_ip (d->peer_addr, "callback set wanna_die flag, terminating");
+ debug_ip("callback set wanna_die flag, terminating");
return FALSE;
}
}
buf->pos += r;
if (BUFREMAIN (buf) != 0) {
/* Continue with this buffer */
- debug_ip (d->peer_addr, "wrote %z bytes of %z", r, buf->data->len);
+ debug_ip("wrote %z bytes of %z", r, buf->data->len);
continue;
}
}
}
}
else if (r == -1 && errno == EAGAIN) {
- debug_ip (d->peer_addr, "partially write data, retry");
+ debug_ip("partially write data, retry");
/* Wait for other event */
event_del (d->ev);
event_set (d->ev, fd, EV_WRITE, dispatcher_cb, (void *)d);
g_list_free (d->out_buffers);
d->out_buffers = NULL;
- debug_ip (d->peer_addr, "all buffers were written successfully");
+ debug_ip("all buffers were written successfully");
if (is_delayed && d->write_callback) {
if (!d->write_callback (d->user_data)) {
- debug_ip (d->peer_addr, "callback set wanna_die flag, terminating");
+ debug_ip("callback set wanna_die flag, terminating");
return FALSE;
}
}
}
}
else if (r == -1 && errno == EAGAIN) {
- debug_ip (d->peer_addr, "partially read data, retry");
+ debug_ip("partially read data, retry");
return;
}
else {
d->in_buf->pos += r;
d->in_buf->data->len += r;
}
- debug_ip (d->peer_addr, "read %z characters, policy is %s, watermark is: %z", r,
+ debug_ip("read %z characters, policy is %s, watermark is: %z", r,
d->policy == BUFFER_LINE ? "LINE" : "CHARACTER", d->nchars);
}
d->in_buf->data->len = len;
d->in_buf->pos = d->in_buf->data->begin + len;
b = d->in_buf->data->begin;
- c = b;
}
else {
d->in_buf->data->len = 0;
d->in_buf->pos = d->in_buf->data->begin;
}
if (d->policy != saved_policy && len != r) {
- debug_ip (d->peer_addr, "policy changed during callback, restart buffer's processing");
+ debug_ip("policy changed during callback, restart buffer's processing");
read_buffers (fd, d, TRUE);
return;
}
return;
}
if (d->policy != saved_policy) {
- debug_ip (d->peer_addr, "policy changed during callback, restart buffer's processing");
+ debug_ip("policy changed during callback, restart buffer's processing");
read_buffers (fd, d, TRUE);
return;
}
rspamd_io_dispatcher_t *d = (rspamd_io_dispatcher_t *) arg;
GError *err;
- debug_ip (d->peer_addr, "in dispatcher callback, what: %d, fd: %d", (gint)what, fd);
+ debug_ip("in dispatcher callback, what: %d, fd: %d", (gint)what, fd);
switch (what) {
case EV_TIMEOUT:
}
}
- debug_ip (d->peer_addr, "new input length watermark is %uz", d->nchars);
+ debug_ip("new input length watermark is %uz", d->nchars);
}
gboolean
d->out_buffers = g_list_prepend (d->out_buffers, newbuf);
if (!delayed) {
- debug_ip (d->peer_addr, "plan write event");
+ debug_ip("plan write event");
return write_buffers (d->fd, d, FALSE);
}
return TRUE;
event_add (d->ev, d->tv);
}
+#undef debug_ip
+
/*
* vi:ts=4
*/
long double max = *(double *)data;
if (score < 0) {
- return score;
+ return score;
}
- else {
#ifdef HAVE_TANHL
- return max * tanhl (score / max);
+ return max * tanhl (score / max);
#else
- /*
- * As some implementations of libm does not support tanhl, try to use
- * tanh
- */
- return max * tanh ((double) (score / max));
+ /*
+ * As some implementations of libm does not support tanhl, try to use
+ * tanh
+ */
+ return max * tanh ((double) (score / max));
#endif
- }
-
- return score;
}
static gboolean
handle_module_opt (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHashTable *attrs, gchar *data, gpointer user_data, gpointer dest_struct, gint offset)
{
gchar *name, *val;
- GList *cur_opt;
struct module_opt *cur;
gboolean is_lua = FALSE;
is_lua = TRUE;
}
}
- cur_opt = ctx->section_pointer;
+
/* Insert option */
cur = memory_pool_alloc0 (cfg->cfg_pool, sizeof (struct module_opt));
cur->param = name;
1, /* error code */
"cannot find statfile for symbol: %s",
symbol);
+ return FALSE;
}
if ((to_learn = statfile_pool_is_open (pool, sel_st->path)) == NULL) {
if ((to_learn = statfile_pool_open (pool, sel_st->path, sel_st->size, FALSE)) == NULL) {
};
char *value;
int nodes, minnodes, iterations = 0;
- struct statfile *st, *sel_st;
+ struct statfile *st, *sel_st = NULL;
stat_file_t *sel = NULL, *to_learn;
- long double res = 0., max = 0., start_value, end_value;
+ long double res = 0., max = 0., start_value = 0., end_value = 0.;
double learn_threshold = 0.0;
GList *cur, *to_demote = NULL;
gboolean force_learn = FALSE;
}
cur = g_list_next (cur);
}
+
+ if (sel_st == NULL) {
+ g_set_error (err,
+ winnow_error_quark(), /* error domain */
+ 1, /* error code */
+ "cannot find statfile for symbol %s",
+ symbol);
+ msg_err ("cannot find statfile for symbol %s", symbol);
+ return FALSE;
+ }
+
to_learn = statfile_pool_is_open (pool, sel_st->path);
if (to_learn == NULL) {
g_set_error (err,
gchar out_buf[BUFSIZ], *arg, *err_str, *symbol;
gint r;
guint64 rev, time;
- struct statfile *st;
+ struct statfile *st = NULL;
struct classifier_config *ccf;
GList *cur;
struct rspamd_binlog *binlog;
return FALSE;
}
}
- session->learn_multiplier = strtod (arg, NULL);
+ else {
+ session->learn_multiplier = strtod (arg, NULL);
+ }
break;
default:
r = rspamd_snprintf (out_buf, sizeof (out_buf), "tokenizer is not defined" CRLF);
};
static gboolean
-try_compress_label (memory_pool_t *pool, guint8 *target, guint8 *start, guint8 len, guint8 *label, GList *table)
+try_compress_label (memory_pool_t *pool, guint8 *target, guint8 *start, guint8 len, guint8 *label, GList **table)
{
GList *cur;
struct dns_name_table *tbl;
guint16 pointer;
- cur = table;
+ cur = *table;
while (cur) {
tbl = cur->data;
if (tbl->len == len) {
tbl->off = target - start;
tbl->label = label;
tbl->len = len;
- table = g_list_prepend (table, tbl);
+ *table = g_list_prepend (*table, tbl);
return FALSE;
}
continue;
}
/* First try to compress name */
- if (! try_compress_label (req->pool, pos, req->packet, end - begin, begin, table)) {
+ if (! try_compress_label (req->pool, pos, req->packet, end - begin, begin, &table)) {
*pos++ = (guint8)label_len;
memcpy (pos, begin, label_len);
pos += label_len;
*pos++ = (guint8)label_len;
memcpy (pos, begin, label_len);
pos += label_len;
- remain -= label_len + 1;
break;
}
if (remain == 0) {
{
struct expression *expr = NULL;
struct expression_stack *stack = NULL;
- struct expression_function *func = NULL, *old;
+ struct expression_function *func = NULL;
struct expression *arg;
GQueue *function_stack;
gchar *p, *c, *str, op, *copy;
if (!in_regexp) {
/* Append argument to list */
if (*p == ',' || (*p == ')' && brackets == 0)) {
- arg = memory_pool_alloc (pool, sizeof (struct expression));
+ arg = NULL;
str = memory_pool_alloc (pool, p - c + 1);
g_strlcpy (str, c, (p - c + 1));
g_strstrip (str);
/* Pop function */
if (*p == ')') {
/* Last function in chain, goto skipping spaces state */
- old = func;
func = g_queue_pop_tail (function_stack);
if (g_queue_get_length (function_stack) == 0) {
state = SKIP_SPACES;
gint regexp_flags = G_REGEX_OPTIMIZE | G_REGEX_NO_AUTO_CAPTURE;
GError *err = NULL;
+ if (line == NULL) {
+ msg_err ("cannot parse NULL line");
+ return NULL;
+ }
+
src = line;
result = memory_pool_alloc0 (pool, sizeof (struct rspamd_regexp));
/* Skip whitespaces */
}
}
else {
- *begin = '\0';
result->header = memory_pool_strdup (pool, line);
result->type = REGEXP_HEADER;
- *begin = '=';
line = begin;
}
/* Find begin of regexp */
#endif
debug_task ("checking %s param", param_name);
-
- if ((param_data = g_mime_content_type_get_parameter ((GMimeContentType *)ct, param_name)) == NULL) {
+ param_data = g_mime_content_type_get_parameter ((GMimeContentType *)ct, param_name);
+ if (param_data == NULL) {
return FALSE;
}
}
switch (session->cmd.cmd) {
case FUZZY_CHECK:
- if ((r = process_check_command (&session->cmd, &flag))) {
+ r = process_check_command (&session->cmd, &flag);
+ if (r != 0) {
r = rspamd_snprintf (buf, sizeof (buf), "OK %d %d" CRLF, r, flag);
if (sendto (session->fd, buf, r, 0, (struct sockaddr *)&session->sa, session->salen) == -1) {
msg_err ("error while writing reply: %s", strerror (errno));
#include "config.h"
#include "cfg_file.h"
#include "radix.h"
+#include "util.h"
/**
* Process type: main or worker
/* Logging in postfix style */
#if (defined(RSPAMD_MAIN) || defined(RSPAMD_LIB) || defined(RSPAMD_TEST))
-#define msg_err(args...) rspamd_common_log_function(G_LOG_LEVEL_CRITICAL, __FUNCTION__, ##args)
-#define msg_warn(args...) rspamd_common_log_function(G_LOG_LEVEL_WARNING, __FUNCTION__, ##args)
-#define msg_info(args...) rspamd_common_log_function(G_LOG_LEVEL_INFO, __FUNCTION__, ##args)
-#define msg_debug(args...) rspamd_conditional_debug(-1, __FUNCTION__, ##args)
-#define debug_task(args...) rspamd_conditional_debug(task->from_addr.s_addr, __FUNCTION__, ##args)
-#define debug_ip(ip, args...) rspamd_conditional_debug((ip), __FUNCTION__, ##args)
+#define msg_err(...) rspamd_common_log_function(G_LOG_LEVEL_CRITICAL, __FUNCTION__, __VA_ARGS__)
+#define msg_warn(...) rspamd_common_log_function(G_LOG_LEVEL_WARNING, __FUNCTION__, __VA_ARGS__)
+#define msg_info(...) rspamd_common_log_function(G_LOG_LEVEL_INFO, __FUNCTION__, __VA_ARGS__)
+#define msg_debug(...) rspamd_conditional_debug(-1, __FUNCTION__, __VA_ARGS__)
+#define debug_task(...) rspamd_conditional_debug(task->from_addr.s_addr, __FUNCTION__, __VA_ARGS__)
+
#else
-#define msg_err(args...) fprintf(stderr, ##args)
-#define msg_warn(args...) fprintf(stderr, ##args)
-#define msg_info(args...) fprintf(stderr, ##args)
-#define msg_debug(args...) fprintf(stderr, ##args)
-#define debug_task(args...) fprintf(stderr, ##args)
+#define msg_err(...) rspamd_fprintf(stderr, __VA_ARGS__)
+#define msg_warn(...) rspamd_fprintf(stderr, __VA_ARGS__)
+#define msg_info(...) rspamd_fprintf(stderr, __VA_ARGS__)
+#define msg_debug(...) rspamd_fprintf(stderr, __VA_ARGS__)
+#define debug_task(...) rspamd_fprintf(stderr, __VA_ARGS__)
#endif
#endif
#include "config.h"
#include "mem_pool.h"
#include "fstring.h"
+#include "logger.h"
/* Sleep time for spin lock in nanoseconds */
#define MUTEX_SLEEP_TIME 10000000L
{
struct _pool_chain *chain;
- g_assert (size > 0);
+ g_return_val_if_fail (size > 0, NULL);
chain = g_slice_alloc (sizeof (struct _pool_chain));
- g_assert (chain != NULL);
+ if (chain == NULL) {
+ msg_err ("cannot allocate %z bytes, aborting", sizeof (struct _pool_chain));
+ abort ();
+ }
chain->begin = g_slice_alloc (size);
-
- g_assert (chain->begin != NULL);
+ if (chain->begin == NULL) {
+ msg_err ("cannot allocate %z bytes, aborting", size);
+ abort ();
+ }
chain->len = size;
chain->pos = chain->begin;
pool_chain_new_shared (gsize size)
{
struct _pool_chain_shared *chain;
+ gpointer map;
#if defined(HAVE_MMAP_ANON)
- chain = (struct _pool_chain_shared *)mmap (NULL, size + sizeof (struct _pool_chain_shared), PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0);
- g_assert (chain != MAP_FAILED);
+ map = mmap (NULL, size + sizeof (struct _pool_chain_shared), PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0);
+ if (map == MAP_FAILED) {
+ msg_err ("cannot allocate %z bytes, aborting", size + sizeof (struct _pool_chain));
+ abort ();
+ }
+ chain = (struct _pool_chain_shared *)map;
chain->begin = ((u_char *) chain) + sizeof (struct _pool_chain_shared);
#elif defined(HAVE_MMAP_ZERO)
gint fd;
if (fd == -1) {
return NULL;
}
- chain = (struct _pool_chain_shared *)mmap (NULL, size + sizeof (struct _pool_chain_shared), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
- g_assert (chain != MAP_FAILED);
+ map = mmap (NULL, size + sizeof (struct _pool_chain_shared), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ if (map == MAP_FAILED) {
+ msg_err ("cannot allocate %z bytes, aborting", size + sizeof (struct _pool_chain));
+ abort ();
+ }
+ chain = (struct _pool_chain_shared *)map;
chain->begin = ((u_char *) chain) + sizeof (struct _pool_chain_shared);
#else
# error No mmap methods are defined
memory_pool_new (gsize size)
{
memory_pool_t *new;
+ gpointer map;
- g_assert (size > 0);
+ g_return_val_if_fail (size > 0, NULL);
/* Allocate statistic structure if it is not allocated before */
if (mem_pool_stat == NULL) {
#if defined(HAVE_MMAP_ANON)
- mem_pool_stat = (memory_pool_stat_t *)mmap (NULL, sizeof (memory_pool_stat_t), PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0);
- g_assert (stat != MAP_FAILED);
+ map = mmap (NULL, sizeof (memory_pool_stat_t), PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0);
+ if (map == MAP_FAILED) {
+ msg_err ("cannot allocate %z bytes, aborting", sizeof (memory_pool_stat_t));
+ abort ();
+ }
+ mem_pool_stat = (memory_pool_stat_t *)map;
#elif defined(HAVE_MMAP_ZERO)
gint fd;
fd = open ("/dev/zero", O_RDWR);
g_assert (fd != -1);
- mem_pool_stat = (memory_pool_stat_t *)mmap (NULL, sizeof (memory_pool_stat_t), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
- g_assert (chain != MAP_FAILED);
+ map = mmap (NULL, sizeof (memory_pool_stat_t), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ if (map == MAP_FAILED) {
+ msg_err ("cannot allocate %z bytes, aborting", sizeof (memory_pool_stat_t));
+ abort ();
+ }
+ mem_pool_stat = (memory_pool_stat_t *)map;
#else
# error No mmap methods are defined
#endif
}
new = g_slice_alloc (sizeof (memory_pool_t));
- g_assert (new != NULL);
+ if (new == NULL) {
+ msg_err ("cannot allocate %z bytes, aborting", sizeof (memory_pool_t));
+ abort ();
+ }
new->cur_pool = pool_chain_new (size);
new->shared_pool = NULL;
struct _pool_chain_shared *new, *cur;
if (pool) {
- g_assert (size > 0);
+ g_return_val_if_fail (size > 0, NULL);
+
cur = pool->shared_pool;
if (!cur) {
cur = pool_chain_new_shared (pool->first_pool->len);
../../../mem_pool.c
)
-ADD_LIBRARY(rspamd_ipmark MODULE ${IPMARKSRC})
+ADD_LIBRARY(rspamd_ipmark SHARED ${IPMARKSRC})
TARGET_LINK_LIBRARIES(rspamd_ipmark ${GLIB2_LIBRARIES})
INSTALL(TARGETS rspamd_ipmark DESTINATION lib)
}
}
}
- else {
+ else if (arg != NULL) {
if (what != NULL) {
if (process_regexp_expression (arg->data, "regexp_check_smtp_data", task, what)) {
return TRUE;
if (append_suffix) {
- r += rspamd_snprintf (result + r, len - r, ".%s", suffix->suffix);
+ rspamd_snprintf (result + r, len - r, ".%s", suffix->suffix);
}
msg_debug ("request: %s, dots: %d, level: %d, orig: %*s", result, dots_num, level, (gint)hostname->len, hostname->begin);
break;
case STATE_READ:
if (what == EV_READ) {
- r = read (param->sock, url_buf, sizeof (url_buf));
+ r = read (param->sock, url_buf, sizeof (url_buf) - 1);
+ if (r <= 0) {
+ msg_err ("read failed: %s from %s", strerror (errno), param->redirector->name);
+ remove_normal_event (param->task->s, free_redirector_session, param);
+ upstream_fail (¶m->redirector->up, param->task->tv.tv_sec);
+ return;
+ }
+
+ url_buf[r - 1] = '\0';
+
if ((p = strstr (url_buf, "Uri: ")) != NULL) {
p += sizeof ("Uri: ") - 1;
c = p;
#define RSPAMD_PROTOCOL_H
#include "config.h"
+#include "filter.h"
#define RSPAMD_FILTER_ERROR 1
#define RSPAMD_NETWORK_ERROR 2
#define SPAMD_ERROR "EX_ERROR"
struct worker_task;
-enum rspamd_metric_action;
struct metric;
enum rspamd_protocol {
case SMTP_STATE_RESOLVE_REVERSE:
/* Parse reverse reply and start resolve of this ip */
if (reply->code != DNS_RC_NOERROR) {
- debug_ip (session->client_addr.s_addr, "DNS error: %s", dns_strerror (reply->code));
+ rspamd_conditional_debug(session->client_addr.s_addr, __FUNCTION__,
+ "DNS error: %s", dns_strerror (reply->code));
if (reply->code == DNS_RC_NXDOMAIN) {
session->hostname = memory_pool_strdup (session->pool, "unknown");
break;
case SMTP_STATE_RESOLVE_NORMAL:
if (reply->code != DNS_RC_NOERROR) {
- debug_ip (session->client_addr.s_addr, "DNS error: %s", dns_strerror (reply->code));
+ rspamd_conditional_debug(session->client_addr.s_addr, __FUNCTION__,
+ "DNS error: %s", dns_strerror (reply->code));
if (reply->code == DNS_RC_NXDOMAIN) {
session->hostname = memory_pool_strdup (session->pool, "unknown");
#include "config.h"
#include "upstream.h"
-#ifdef WITH_DEBUG
-# define msg_debug(args...) syslog(LOG_DEBUG, ##args)
-#else
-# define msg_debug(args...) do {} while(0)
-#endif
#ifdef _THREAD_SAFE
pthread_rwlock_t upstream_mtx = PTHREAD_RWLOCK_INITIALIZER;
#undef U_LOCK
#undef U_UNLOCK
-#undef msg_debug
/*
* vi:ts=4
*/
{
const gchar *p, *c;
gchar open_brace = '\0', close_brace = '\0';
- gint i, brace_stack;
- gboolean passwd;
+ gint i, brace_stack = 0;
+ gboolean passwd = FALSE;
guint port;
p = pos + strlen (match->pattern);