mirror of
https://github.com/xcat2/confluent.git
synced 2026-09-21 16:39:32 +00:00
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.
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user