struct rspamd_async_event *new;
if (session == NULL) {
- msg_info_session ("session is NULL");
+ msg_err ("session is NULL");
return;
}
struct rspamd_async_event search_ev, *found_ev;
if (session == NULL) {
- msg_info_session ("session is NULL");
+ msg_err ("session is NULL");
return;
}
rspamd_session_destroy (struct rspamd_async_session *session)
{
if (session == NULL) {
- msg_info_session ("session is NULL");
+ msg_err ("session is NULL");
return FALSE;
}
rspamd_session_cleanup (struct rspamd_async_session *session)
{
if (session == NULL) {
- msg_info_session ("session is NULL");
+ msg_err ("session is NULL");
return;
}
tag->id = found->id;
tag->flags = found->flags;
}
+ state = spaces_after_name;
}
-
- state = spaces_after_name;
}
break;
/* Empty domain, technically an error */
state = parse_slash;
}
- c = p;
- state = parse_domain;
+ else {
+ c = p;
+ state = parse_domain;
+ }
break;
case parse_domain:
if (t == '/') {
/* Check whether this item is skipped */
skipped = !ghost;
+ g_assert (cache->cfg != NULL);
+
if ((item->type &
(SYMBOL_TYPE_NORMAL|SYMBOL_TYPE_VIRTUAL|SYMBOL_TYPE_COMPOSITE|SYMBOL_TYPE_CLASSIFIER))
- && cache->cfg
&& g_hash_table_lookup (cache->cfg->metrics_symbols, item->symbol) == NULL) {
cur = g_list_first (cache->cfg->metrics_list);
while (cur) {
gboolean ignore_symbol = FALSE, ret = TRUE;
if (cache == NULL) {
- msg_err_cache ("empty cache is invalid");
+ msg_err ("empty cache is invalid");
return FALSE;
}
if (*pos != '.' || textpos != (gint)cbdata->len) {
/* Something weird has been found */
- if (textpos == (gint)cbdata->len - 1) {
- pos = cbdata->begin + textpos;
- }
- else {
+ if (textpos != (gint)cbdata->len - 1) {
/* Search more */
return 0;
}
}
f = (struct stat_file *)file->map;
- c = f->header.magic;
+ c = &f->header.magic[0];
/* Check magic and version */
if (*c++ != 'r' || *c++ != 's' || *c++ != 'd') {
msg_info_pool ("file %s is invalid stat file", file->filename);
return -1;
}
+
+ c = &f->header.version[0];
/* Now check version and convert old version to new one (that can be used for sync */
if (*c == 1 && *(c + 1) == 0) {
return -1;
lock_fd = open (lock, O_RDONLY, 00600);
if (lock_fd != -1) {
if (!rspamd_file_lock (lock_fd, FALSE)) {
+ close (lock_fd);
g_free (lock);
return rspamd_mmaped_file_open (pool, filename, size, stcf);
/* Try to lock pages in RAM */
/* Acquire lock for this operation */
- rspamd_file_lock (new_file->fd, FALSE);
+ if (!rspamd_file_lock (new_file->fd, FALSE)) {
+ close (new_file->fd);
+ munmap (new_file->map, st.st_size);
+ msg_info_pool ("cannot lock file %s, error %d, %s",
+ filename,
+ errno,
+ strerror (errno));
+ g_slice_free1 (sizeof (*new_file), new_file);
+ return NULL;
+ }
+
if (rspamd_mmaped_file_check (pool, new_file) == -1) {
+ close (new_file->fd);
rspamd_file_unlock (new_file->fd, FALSE);
munmap (new_file->map, st.st_size);
g_slice_free1 (sizeof (*new_file), new_file);
mod_char
} state = just_char;
struct rspamd_statfile_config *stcf;
- lua_State *L;
+ lua_State *L = NULL;
struct rspamd_task **ptask;
GString *tb;
const gchar *rcpt = NULL;
gint err_idx;
-
g_assert (ctx != NULL);
stcf = ctx->stcf;
- L = task->cfg->lua_state;
+
+ if (task) {
+ L = task->cfg->lua_state;
+ }
if (ctx->enable_users) {
if (ctx->cbref_user == -1) {
rcpt = rspamd_task_get_principal_recipient (task);
}
- else {
+ else if (L) {
/* Execute lua function to get userdata */
lua_pushcfunction (L, &rspamd_lua_traceback);
err_idx = lua_gettop (L);
"%s\r\n"
"$%d\r\n"
"%s\r\n",
- learn ? (tokens->len * 2 + 2) : (tokens->len + 2),
+ (tokens->len + 2),
larg0, arg0,
larg1, arg1);
}