From: David Mulder Date: Fri, 26 Feb 2021 16:46:49 +0000 (-0700) Subject: gpo: vgp_sudoers_ext handle missing and dispersed principal names X-Git-Tag: tevent-0.11.0~1659 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2ce101bfdee664ea447fe1938dd0a1181ea8a98;p=thirdparty%2Fsamba.git gpo: vgp_sudoers_ext handle missing and dispersed principal names If we don't anticipate a missing principal name, the extension crashes. Also, principal names could be in dispersed listelements. Signed-off-by: David Mulder Reviewed-by: Jeremy Allison --- diff --git a/python/samba/vgp_sudoers_ext.py b/python/samba/vgp_sudoers_ext.py index 573ec9fb4d1..bae6cb1c382 100644 --- a/python/samba/vgp_sudoers_ext.py +++ b/python/samba/vgp_sudoers_ext.py @@ -49,7 +49,10 @@ class vgp_sudoers_ext(gp_xml_ext): for entry in data.findall('sudoers_entry'): command = entry.find('command').text user = entry.find('user').text - principals = entry.find('listelement').findall('principal') + listelements = entry.findall('listelement') + principals = [] + for listelement in listelements: + principals.extend(listelement.findall('principal')) if len(principals) > 0: uname = ','.join([u.text if u.attrib['type'] == 'user' \ else '%s%%' % u.text for u in principals]) @@ -96,7 +99,10 @@ class vgp_sudoers_ext(gp_xml_ext): for entry in data.findall('sudoers_entry'): command = entry.find('command').text user = entry.find('user').text - principals = entry.find('listelement').findall('principal') + listelements = entry.findall('listelement') + principals = [] + for listelement in listelements: + principals.extend(listelement.findall('principal')) if len(principals) > 0: uname = ','.join([u.text if u.attrib['type'] == 'user' \ else '%s%%' % u.text for u in principals]) diff --git a/selftest/knownfail.d/gpo b/selftest/knownfail.d/gpo deleted file mode 100644 index 4be23fb2004..00000000000 --- a/selftest/knownfail.d/gpo +++ /dev/null @@ -1 +0,0 @@ -^samba.tests.gpo.samba.tests.gpo.GPOTests.test_vgp_sudoers