]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
gpo: Add rsop output for vgp_openssh_ext
authorDavid Mulder <dmulder@suse.com>
Fri, 26 Feb 2021 16:46:15 +0000 (09:46 -0700)
committerJeremy Allison <jra@samba.org>
Mon, 8 Mar 2021 17:58:37 +0000 (17:58 +0000)
Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
python/samba/vgp_openssh_ext.py

index 0252e9208bbfe0550574eec6d74d7fec39575ff1..7a49395151cdc311f6a3f734d8decd0cb6defcb1 100644 (file)
@@ -82,3 +82,24 @@ class vgp_openssh_ext(gp_xml_ext):
                     self.gp_db.store(str(self), attribute, f.name)
                     self.gp_db.commit()
                     f.close()
+
+    def rsop(self, gpo):
+        output = {}
+        if gpo.file_sys_path:
+            xml = 'MACHINE/VGP/VTLA/SshCfg/SshD/manifest.xml'
+            path = os.path.join(gpo.file_sys_path, xml)
+            xml_conf = self.parse(path)
+            if not xml_conf:
+                return output
+            policy = xml_conf.find('policysetting')
+            data = policy.find('data')
+            configfile = data.find('configfile')
+            for configsection in configfile.findall('configsection'):
+                if configsection.find('sectionname').text:
+                    continue
+                for kv in configsection.findall('keyvaluepair'):
+                    if str(self) not in output.keys():
+                        output[str(self)] = {}
+                    output[str(self)][kv.find('key').text] = \
+                        kv.find('value').text
+        return output