From e6f6b2330f375a260a531300f01e4fc6c76f79f2 Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Mon, 10 Aug 2026 14:04:31 +0200 Subject: [PATCH] Parse SMM answers as bytes, not as decoded text lxml refuses a str carrying an encoding declaration, and the SMM declares one when it answers /data/login, so _webconfigcreds has raised ValueError on the first thing it does after logging in ever since the switch to lxml. stdlib ElementTree took the same input, which is why it went unnoticed. fromstring already means to take either shape, so encode there. Confirmed against a DW612S. --- confluent_server/confluent/discovery/handlers/smm.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/confluent_server/confluent/discovery/handlers/smm.py b/confluent_server/confluent/discovery/handlers/smm.py index 86b8ab65..1ee2b3a1 100644 --- a/confluent_server/confluent/discovery/handlers/smm.py +++ b/confluent_server/confluent/discovery/handlers/smm.py @@ -38,6 +38,10 @@ def fromstring(inputdata): # The measures above should filter out the risky facets of xml # We don't need sophisticated feature support parser = etree.XMLParser(resolve_entities=False, no_network=True, huge_tree=False) + if not isinstance(inputdata, bytes): + # lxml refuses a str that declares an encoding, and the SMM declares + # one when answering a login + inputdata = inputdata.encode('utf8') return etree.fromstring(inputdata, parser=parser) def fixuuid(baduuid):