|
|
@@ -945,98 +945,6 @@ rspamd_config_post_load (struct rspamd_config *cfg, |
|
|
|
return ret; |
|
|
|
} |
|
|
|
|
|
|
|
#if 0 |
|
|
|
void |
|
|
|
parse_err (const gchar *fmt, ...) |
|
|
|
{ |
|
|
|
va_list aq; |
|
|
|
gchar logbuf[BUFSIZ], readbuf[32]; |
|
|
|
gint r; |
|
|
|
|
|
|
|
va_start (aq, fmt); |
|
|
|
rspamd_strlcpy (readbuf, yytext, sizeof (readbuf)); |
|
|
|
|
|
|
|
r = snprintf (logbuf, |
|
|
|
sizeof (logbuf), |
|
|
|
"config file parse error! line: %d, text: %s, reason: ", |
|
|
|
yylineno, |
|
|
|
readbuf); |
|
|
|
r += vsnprintf (logbuf + r, sizeof (logbuf) - r, fmt, aq); |
|
|
|
|
|
|
|
va_end (aq); |
|
|
|
g_critical ("%s", logbuf); |
|
|
|
} |
|
|
|
|
|
|
|
void |
|
|
|
parse_warn (const gchar *fmt, ...) |
|
|
|
{ |
|
|
|
va_list aq; |
|
|
|
gchar logbuf[BUFSIZ], readbuf[32]; |
|
|
|
gint r; |
|
|
|
|
|
|
|
va_start (aq, fmt); |
|
|
|
rspamd_strlcpy (readbuf, yytext, sizeof (readbuf)); |
|
|
|
|
|
|
|
r = snprintf (logbuf, |
|
|
|
sizeof (logbuf), |
|
|
|
"config file parse warning! line: %d, text: %s, reason: ", |
|
|
|
yylineno, |
|
|
|
readbuf); |
|
|
|
r += vsnprintf (logbuf + r, sizeof (logbuf) - r, fmt, aq); |
|
|
|
|
|
|
|
va_end (aq); |
|
|
|
g_warning ("%s", logbuf); |
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
|
void |
|
|
|
rspamd_config_unescape_quotes (gchar *line) |
|
|
|
{ |
|
|
|
gchar *c = line, *t; |
|
|
|
|
|
|
|
while (*c) { |
|
|
|
if (*c == '\\' && *(c + 1) == '"') { |
|
|
|
t = c; |
|
|
|
while (*t) { |
|
|
|
*t = *(t + 1); |
|
|
|
t++; |
|
|
|
} |
|
|
|
} |
|
|
|
c++; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
GList * |
|
|
|
rspamd_config_parse_comma_list (rspamd_mempool_t * pool, const gchar *line) |
|
|
|
{ |
|
|
|
GList *res = NULL; |
|
|
|
const gchar *c, *p; |
|
|
|
gchar *str; |
|
|
|
|
|
|
|
c = line; |
|
|
|
p = c; |
|
|
|
|
|
|
|
while (*p) { |
|
|
|
if (*p == ',' && *c != *p) { |
|
|
|
str = rspamd_mempool_alloc (pool, p - c + 1); |
|
|
|
rspamd_strlcpy (str, c, p - c + 1); |
|
|
|
res = g_list_prepend (res, str); |
|
|
|
/* Skip spaces */ |
|
|
|
while (g_ascii_isspace (*(++p))) ; |
|
|
|
c = p; |
|
|
|
continue; |
|
|
|
} |
|
|
|
p++; |
|
|
|
} |
|
|
|
if (res != NULL) { |
|
|
|
rspamd_mempool_add_destructor (pool, |
|
|
|
(rspamd_mempool_destruct_t) g_list_free, |
|
|
|
res); |
|
|
|
} |
|
|
|
|
|
|
|
return res; |
|
|
|
} |
|
|
|
|
|
|
|
struct rspamd_classifier_config * |
|
|
|
rspamd_config_new_classifier (struct rspamd_config *cfg, |
|
|
|
struct rspamd_classifier_config *c) |