From 95440920fd487cea921883f71f619fdfa8229669 Mon Sep 17 00:00:00 2001 From: Christopher Dearborn Date: Thu, 14 Feb 2019 16:23:31 -0500 Subject: [PATCH] Filter unprintable ASCII during enumeration When enumerating DCIM_ControllerView, the DriverVersion field may have unprintable ASCII characters in it if the server has a BOSS card. In the past, it was observed that this field could contain unprintable non-ASCII characters, but unprintable ASCII characters have been found in it as well. This fix changes the filtering so that only printable ASCII characters and the tab character pass the filter. Closes-Bug: 1816194 Change-Id: If7274fed19fb763aa7c2e4adc3676a4e3c26aee0 --- dracclient/wsman.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dracclient/wsman.py b/dracclient/wsman.py index e0f4476..55cf548 100644 --- a/dracclient/wsman.py +++ b/dracclient/wsman.py @@ -163,8 +163,11 @@ class Client(object): resp_xml = ElementTree.fromstring(resp.content) except ElementTree.XMLSyntaxError: LOG.warning('Received invalid content from iDRAC. Filtering out ' - 'non-ASCII characters: ' + repr(resp.content)) - resp_xml = ElementTree.fromstring(re.sub(six.b('[^\x00-\x7f]'), + 'unprintable characters: ' + repr(resp.content)) + + # Filter out everything except for printable ASCII characters and + # tab + resp_xml = ElementTree.fromstring(re.sub(six.b('[^\x20-\x7e\t]'), six.b(''), resp.content))