commit c4d3eb4: [Minor] Add safe-guards

Vsevolod Stakhov vsevolod at highsecure.ru
Thu Oct 10 15:00:06 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-10-10 15:59:30 +0100
URL: https://github.com/rspamd/rspamd/commit/c4d3eb4af41a17cf28cb4fbb171d9b70d98259b5 (HEAD -> master)

[Minor] Add safe-guards

---
 src/plugins/lua/external_services.lua | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/src/plugins/lua/external_services.lua b/src/plugins/lua/external_services.lua
index 4e0ee29c9..d65a46a2c 100644
--- a/src/plugins/lua/external_services.lua
+++ b/src/plugins/lua/external_services.lua
@@ -227,20 +227,25 @@ if opts and type(opts) == 'table' then
           score = 0.0,
           group = N
         })
-        rspamd_config:register_symbol({
-          type = 'virtual',
-          name = m['symbol_encrypted'],
-          parent = id,
-          score = 0.0,
-          group = N
-        })
-        rspamd_config:register_symbol({
-          type = 'virtual',
-          name = m['symbol_macro'],
-          parent = id,
-          score = 0.0,
-          group = N
-        })
+
+        if m.symbol_encrypted then
+          rspamd_config:register_symbol({
+            type = 'virtual',
+            name = m['symbol_encrypted'],
+            parent = id,
+            score = 0.0,
+            group = N
+          })
+        end
+        if m.symbol_macro then
+          rspamd_config:register_symbol({
+            type = 'virtual',
+            name = m['symbol_macro'],
+            parent = id,
+            score = 0.0,
+            group = N
+          })
+        end
         has_valid = true
         if type(m['patterns']) == 'table' then
           if m['patterns'][1] then


More information about the Commits mailing list