commit 57e26bc: [Minor] Try to fix another stupid cases of dot commands

Vsevolod Stakhov vsevolod at rspamd.com
Fri Apr 22 20:49:03 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-04-22 21:47:19 +0100
URL: https://github.com/rspamd/rspamd/commit/57e26bc8223b594286d8d2a764b00e2e63448bb4 (HEAD -> master)

[Minor] Try to fix another stupid cases of dot commands
Have anybody used them ever?

---
 src/rspamadm/lua_repl.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/rspamadm/lua_repl.c b/src/rspamadm/lua_repl.c
index f81cf4ad3..de0f7a0ab 100644
--- a/src/rspamadm/lua_repl.c
+++ b/src/rspamadm/lua_repl.c
@@ -630,10 +630,19 @@ rspamadm_lua_run_repl (lua_State *L, bool is_batch)
 
 			if (linelen > 0) {
 				if (input[linelen - 1] == '\n') {
-					linelen--;
+					input[linelen - 1] = '\0';
+					linelen --;
 				}
 
-				rspamadm_exec_input(L, input);
+				if (linelen > 0) {
+					if (input[0] == '.') {
+						if (rspamadm_lua_try_dot_command(L, input)) {
+							continue;
+						}
+					}
+
+					rspamadm_exec_input(L, input);
+				}
 			}
 			else {
 				break;


More information about the Commits mailing list