[PATCH 13/18] gpo: Fixing the bug where only some Linux Boxes capitalize MACHINE
David Mulder
dmulder at suse.com
Thu Feb 23 20:22:05 UTC 2017
From: Luke Morrison <luc785 at hotmail.com>
Split from "Added BackLog for default to make it maintain hierarchy" by David Mulder
Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Signed-off-by: Luke Morrison <luke at hubtrek.com>
Signed-off-by: David Mulder <dmulder at suse.com>
---
python/samba/gpclass.py | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/python/samba/gpclass.py b/python/samba/gpclass.py
index 0b2159b..dfb6e96 100755
--- a/python/samba/gpclass.py
+++ b/python/samba/gpclass.py
@@ -123,10 +123,7 @@ class gp_sec_ext(gp_ext):
ret = False
inftable = self.populate_inf()
- try:
- policy = conn.loadfile(path).decode('utf-16')
- except:
- return None
+ policy = conn.loadfile(path).decode('utf-16')
current_sect[2]) + '\n')
@@ -159,8 +156,23 @@ class gp_sec_ext(gp_ext):
def parse(self, afile, ldb, conn, attr_log):
self.ldb = ldb
self.dn = ldb.get_default_basedn()
+
+ # Fixing the bug where only some Linux Boxes capitalize MACHINE
if afile.endswith('inf'):
- self.read_inf(afile, conn, attr_log)
+ try:
+ blist = afile.split('/')
+ idx = afile.lower().split('/').index('machine')
+ for case in [blist[idx].upper(), blist[idx].capitalize(), blist[idx].lower()]:
+ bfile = '/'.join(blist[:idx]) + '/' + case + '/' + '/'.join(blist[idx+1:])
+ try:
+ return self.read_inf(bfile, conn, attr_log)
+ except:
+ continue
+ except ValueError:
+ try:
+ return self.read_inf(afile, conn, attr_log)
+ except:
+ return None
def scan_log(sysvol_path):
--
2.10.2
More information about the samba-technical
mailing list