commit c1bd3f8: [Fix] Fix lua_parse_symbol_type function logic

Vsevolod Stakhov vsevolod at highsecure.ru
Fri May 1 19:21:16 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-05-01 20:13:43 +0100
URL: https://github.com/rspamd/rspamd/commit/c1bd3f81f3fba86a22bb5ed95563b8370e07d111 (HEAD -> master)

[Fix] Fix lua_parse_symbol_type function logic

---
 src/lua/lua_config.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c
index 4d728cf14..fdf87d332 100644
--- a/src/lua/lua_config.c
+++ b/src/lua/lua_config.c
@@ -1814,17 +1814,23 @@ lua_parse_symbol_type (const gchar *str)
 				str = vec[i];
 
 				if (g_ascii_strcasecmp (str, "virtual") == 0) {
-					ret = SYMBOL_TYPE_VIRTUAL;
+					ret |= SYMBOL_TYPE_VIRTUAL;
+					ret &= ~SYMBOL_TYPE_NORMAL;
+					ret &= ~SYMBOL_TYPE_CALLBACK;
 				} else if (g_ascii_strcasecmp (str, "callback") == 0) {
-					ret = SYMBOL_TYPE_CALLBACK;
+					ret |= SYMBOL_TYPE_CALLBACK;
+					ret &= ~SYMBOL_TYPE_NORMAL;
+					ret &= ~SYMBOL_TYPE_VIRTUAL;
 				} else if (g_ascii_strcasecmp (str, "normal") == 0) {
-					ret = SYMBOL_TYPE_NORMAL;
+					ret |= SYMBOL_TYPE_NORMAL;
+					ret &= ~SYMBOL_TYPE_CALLBACK;
+					ret &= ~SYMBOL_TYPE_VIRTUAL;
 				} else if (g_ascii_strcasecmp (str, "prefilter") == 0) {
-					ret = SYMBOL_TYPE_PREFILTER | SYMBOL_TYPE_GHOST;
+					ret |= SYMBOL_TYPE_PREFILTER | SYMBOL_TYPE_GHOST;
 				} else if (g_ascii_strcasecmp (str, "postfilter") == 0) {
-					ret = SYMBOL_TYPE_POSTFILTER | SYMBOL_TYPE_GHOST;
+					ret |= SYMBOL_TYPE_POSTFILTER | SYMBOL_TYPE_GHOST;
 				} else if (g_ascii_strcasecmp (str, "idempotent") == 0) {
-					ret = SYMBOL_TYPE_POSTFILTER | SYMBOL_TYPE_GHOST |
+					ret |= SYMBOL_TYPE_POSTFILTER | SYMBOL_TYPE_GHOST |
 							SYMBOL_TYPE_IDEMPOTENT;
 				} else {
 					gint fl = 0;


More information about the Commits mailing list