[projects/pld-ftp-admin] ftpiod: keep running when one connection fails

arekm arekm at pld-linux.org
Sat Oct 24 11:45:33 CEST 2026


commit a2e03e78417590072dbf9fc5c0e4bea49f02910e
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Tue Oct 20 19:04:57 2026 +0200

    ftpiod: keep running when one connection fails
    
    Log the error and drop that connection. A single non-UTF-8 byte
    on the public socket was enough to stop the daemon.

 modules/cons.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/modules/cons.py b/modules/cons.py
index 979adf5..61f8680 100644
--- a/modules/cons.py
+++ b/modules/cons.py
@@ -3,6 +3,7 @@
 import socket
 import os
 import select
+import traceback
 from common import fileexists
 import ftpio
 import cmds
@@ -31,12 +32,16 @@ class Connection:
         if not newdata:
             self.destroy()
             return
-        self.data = self.data + newdata.decode("utf-8")
 
         try:
+            self.data = self.data + newdata.decode("utf-8")
             cmds.parse(self)
         except cmds.BailOut:
             self.destroy()
+        except Exception:
+            # every tool locks through this daemon; a bad client or a failed command must not stop it
+            cmds.cmd_log(self, 'command failed: ' + traceback.format_exc())
+            self.destroy()
 
 def add(con):
     cons.append(con)
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/pld-ftp-admin.git/commitdiff/e14cb7d4d74f8bdd9368d9645ecaf49593cf6335



More information about the pld-cvs-commit mailing list