]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Emit error if connection has been terminated with no stop pattern
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 22 Nov 2018 14:17:33 +0000 (14:17 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 22 Nov 2018 14:17:33 +0000 (14:17 +0000)
src/lua/lua_tcp.c

index b9406111a7f63d93f6f31ebcca37e5189302efc9..047bfe4446f8ea80994d81c7d7d03cdba7186e82 100644 (file)
@@ -895,7 +895,15 @@ lua_tcp_process_read_handler (struct lua_tcp_cbdata *cbd,
                        else {
                                /* Plan new read */
                                msg_debug_tcp ("NOT found TCP stop pattern");
-                               lua_tcp_plan_read (cbd);
+
+                               if (!cbd->eof) {
+                                       lua_tcp_plan_read (cbd);
+                               }
+                               else {
+                                       /* Got session finished but no stop pattern */
+                                       lua_tcp_push_error (cbd, TRUE,
+                                                       "IO read error: connection terminated");
+                               }
                        }
                }
        }
@@ -957,7 +965,7 @@ lua_tcp_process_read (struct lua_tcp_cbdata *cbd,
                        lua_tcp_process_read_handler (cbd, rh, TRUE);
                }
                else {
-                       lua_tcp_push_error (cbd, FALSE, "IO read error: connection terminated");
+                       lua_tcp_push_error (cbd, TRUE, "IO read error: connection terminated");
                }
 
                lua_tcp_plan_handler_event (cbd, FALSE, TRUE);