]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Try to fix another stupid cases of dot commands
authorVsevolod Stakhov <vsevolod@rspamd.com>
Fri, 22 Apr 2022 20:47:19 +0000 (21:47 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Fri, 22 Apr 2022 20:47:19 +0000 (21:47 +0100)
Have anybody used them ever?

src/rspamadm/lua_repl.c

index f81cf4ad34cee0017747effed96da6a427081468..de0f7a0abd5316e01c6aff7e8c70ebd09159d625 100644 (file)
@@ -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;