aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-12-20 20:23:29 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-12-20 20:23:29 +0000
commit4b7520470bfcb417f483384c360fa1b498632336 (patch)
treef9b668a551106613aa0cc182e324c02a1c9066af /src
parente325da73310bc36c61d318f587bbd7655781bd12 (diff)
downloadrspamd-4b7520470bfcb417f483384c360fa1b498632336.tar.gz
rspamd-4b7520470bfcb417f483384c360fa1b498632336.zip
[Minor] Store composite expression in composite structure
Diffstat (limited to 'src')
-rw-r--r--src/libserver/cfg_rcl.c1
-rw-r--r--src/libserver/composites.h1
-rw-r--r--src/lua/lua_cfg_file.c41
-rw-r--r--src/lua/lua_config.c2
4 files changed, 5 insertions, 40 deletions
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c
index 62525c3eb..a41b391a0 100644
--- a/src/libserver/cfg_rcl.c
+++ b/src/libserver/cfg_rcl.c
@@ -1437,6 +1437,7 @@ rspamd_rcl_composite_handler (rspamd_mempool_t *pool,
rspamd_mempool_alloc0 (cfg->cfg_pool, sizeof (struct rspamd_composite));
composite->expr = expr;
composite->id = g_hash_table_size (cfg->composite_symbols);
+ composite->str_expr = composite_expression;
val = ucl_object_lookup (obj, "score");
if (val != NULL && ucl_object_todouble_safe (val, &score)) {
diff --git a/src/libserver/composites.h b/src/libserver/composites.h
index 9ae3fa5a2..6baa13c14 100644
--- a/src/libserver/composites.h
+++ b/src/libserver/composites.h
@@ -37,6 +37,7 @@ enum rspamd_composite_policy {
* Composite structure
*/
struct rspamd_composite {
+ const gchar *str_expr;
struct rspamd_expression *expr;
gint id;
enum rspamd_composite_policy policy;
diff --git a/src/lua/lua_cfg_file.c b/src/lua/lua_cfg_file.c
index daa8223ff..efd8c8820 100644
--- a/src/lua/lua_cfg_file.c
+++ b/src/lua/lua_cfg_file.c
@@ -95,12 +95,9 @@ void
rspamd_lua_post_load_config (struct rspamd_config *cfg)
{
lua_State *L = cfg->lua_state;
- const gchar *name, *val;
- gchar *sym;
- struct rspamd_expression *expr, *old_expr;
+ const gchar *name;
ucl_object_t *obj;
gsize keylen;
- GError *err = NULL;
/* First check all module options that may be overridden in 'config' global */
lua_getglobal (L, "config");
@@ -139,41 +136,5 @@ rspamd_lua_post_load_config (struct rspamd_config *cfg)
}
}
- /* Check composites */
- lua_getglobal (L, "composites");
-
- if (lua_istable (L, -1)) {
- /* Iterate */
- for (lua_pushnil (L); lua_next (L, -2); lua_pop (L, 1)) {
- /* 'key' is at index -2 and 'value' is at index -1 */
- /* Key must be a string and value must be a table */
- name = luaL_checkstring (L, -2);
- if (name != NULL && lua_isstring (L, -1)) {
- val = lua_tostring (L, -1);
- sym = rspamd_mempool_strdup (cfg->cfg_pool, name);
- if (!rspamd_parse_expression (val, 0, &composite_expr_subr, NULL,
- cfg->cfg_pool, &err, &expr)) {
- msg_err_config("cannot parse composite expression '%s': %s", val,
- err->message);
- g_error_free (err);
- err = NULL;
- continue;
- }
- /* Now check hash table for this composite */
- if ((old_expr =
- g_hash_table_lookup (cfg->composite_symbols,
- name)) != NULL) {
- msg_info_config("replacing composite symbol %s", name);
- g_hash_table_replace (cfg->composite_symbols, sym, expr);
- }
- else {
- g_hash_table_insert (cfg->composite_symbols, sym, expr);
- rspamd_symbols_cache_add_symbol (cfg->cache, sym,
- 0, NULL, NULL, SYMBOL_TYPE_COMPOSITE, -1);
- }
- }
- }
- }
-
lua_settop (L, 0);
}
diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c
index c667e1510..4679b4ede 100644
--- a/src/lua/lua_config.c
+++ b/src/lua/lua_config.c
@@ -1966,6 +1966,8 @@ lua_config_add_composite (lua_State * L)
sizeof (struct rspamd_composite));
composite->expr = expr;
composite->id = g_hash_table_size (cfg->composite_symbols);
+ composite->str_expr = rspamd_mempool_strdup (cfg->cfg_pool,
+ expr_str);
g_hash_table_insert (cfg->composite_symbols,
(gpointer)name,
composite);
ort/47832/stable30'>backport/47832/stable30 Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/l10n/en_GB.php
blob: 35a0e8d3ef9e58ad394a783bfdff954604ab7e17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131