Yes, thanks. There are likely other problems with this script, too.
On Mon, Sep 16, 2013 at 11:05 PM, Shawn Wells <[email protected]> wrote: > On 9/16/13 12:12 PM, Jan Lieskovsky wrote: >> >> By verifying sanity of input this will substitute Python >> lxml.etree.XMLSyntaxError traceback (former state) with (more informative) >> path to problematic XCCDF file information (proposed state), >> in which XML syntax error, during parsing of that particular XML file, >> occurred. This should simplify further XML syntax correctness >> investigation / >> validation for those files. >> >> Signed-off-by: Jan Lieskovsky <[email protected]> >> --- >> OpenStack/utils/verify-input-sanity.py | 5 ++++- >> RHEL6/utils/verify-input-sanity.py | 5 ++++- >> RHEVM3/utils/verify-input-sanity.py | 5 ++++- >> 3 files changed, 12 insertions(+), 3 deletions(-) >> >> diff --git a/OpenStack/utils/verify-input-sanity.py >> b/OpenStack/utils/verify-input-sanity.py >> index 13046b6..1e0ec2c 100755 >> --- a/OpenStack/utils/verify-input-sanity.py >> +++ b/OpenStack/utils/verify-input-sanity.py >> @@ -127,7 +127,10 @@ for xccdf_file in xccdf_xml_files: >> # form valid XML so that we can parse it >> xccdf_xml_contents = xccdf_header + infile.read() + xccdf_footer >> # parse the XML at this point >> - tree = ET.fromstring(xccdf_xml_contents) >> + try: >> + tree = ET.fromstring(xccdf_xml_contents) >> + except ET.XMLSyntaxError: >> + print " XML syntax error in file: %s" % >> xccdf_file.replace("./", "src/input/") >> # extract all of the rules that are defined within the XCCDF >> xccdf_rules = tree.findall(".//Rule") >> for xccdf_rule in xccdf_rules: >> diff --git a/RHEL6/utils/verify-input-sanity.py >> b/RHEL6/utils/verify-input-sanity.py >> index 13046b6..1e0ec2c 100755 >> --- a/RHEL6/utils/verify-input-sanity.py >> +++ b/RHEL6/utils/verify-input-sanity.py >> @@ -127,7 +127,10 @@ for xccdf_file in xccdf_xml_files: >> # form valid XML so that we can parse it >> xccdf_xml_contents = xccdf_header + infile.read() + xccdf_footer >> # parse the XML at this point >> - tree = ET.fromstring(xccdf_xml_contents) >> + try: >> + tree = ET.fromstring(xccdf_xml_contents) >> + except ET.XMLSyntaxError: >> + print " XML syntax error in file: %s" % >> xccdf_file.replace("./", "src/input/") >> # extract all of the rules that are defined within the XCCDF >> xccdf_rules = tree.findall(".//Rule") >> for xccdf_rule in xccdf_rules: >> diff --git a/RHEVM3/utils/verify-input-sanity.py >> b/RHEVM3/utils/verify-input-sanity.py >> index 13046b6..1e0ec2c 100755 >> --- a/RHEVM3/utils/verify-input-sanity.py >> +++ b/RHEVM3/utils/verify-input-sanity.py >> @@ -127,7 +127,10 @@ for xccdf_file in xccdf_xml_files: >> # form valid XML so that we can parse it >> xccdf_xml_contents = xccdf_header + infile.read() + xccdf_footer >> # parse the XML at this point >> - tree = ET.fromstring(xccdf_xml_contents) >> + try: >> + tree = ET.fromstring(xccdf_xml_contents) >> + except ET.XMLSyntaxError: >> + print " XML syntax error in file: %s" % >> xccdf_file.replace("./", "src/input/") >> # extract all of the rules that are defined within the XCCDF >> xccdf_rules = tree.findall(".//Rule") >> for xccdf_rule in xccdf_rules: > > > fantastic. > > ack. > > > _______________________________________________ > scap-security-guide mailing list > [email protected] > https://lists.fedorahosted.org/mailman/listinfo/scap-security-guide _______________________________________________ scap-security-guide mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/scap-security-guide
