mirror of
https://github.com/samba-team/samba.git
synced 2025-12-20 16:23:51 +03:00
gpo: Ensure that gplink works when empty
It appears that RSAT can leave a space in the gPLink field, which we need to handle. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13564 Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
committed by
Andrew Bartlett
parent
d959bea2a8
commit
5514b98f1d
@@ -93,6 +93,10 @@ def gplink_options_string(value):
|
||||
def parse_gplink(gplink):
|
||||
'''parse a gPLink into an array of dn and options'''
|
||||
ret = []
|
||||
|
||||
if gplink.strip() == '':
|
||||
return ret
|
||||
|
||||
a = gplink.split(']')
|
||||
for g in a:
|
||||
if not g:
|
||||
@@ -656,7 +660,7 @@ class cmd_getlink(GPOCommand):
|
||||
except Exception:
|
||||
raise CommandError("Container '%s' does not exist" % container_dn)
|
||||
|
||||
if msg['gPLink']:
|
||||
if 'gPLink' in msg and msg['gPLink']:
|
||||
self.outf.write("GPO(s) linked to DN %s\n" % container_dn)
|
||||
gplist = parse_gplink(str(msg['gPLink'][0]))
|
||||
for g in gplist:
|
||||
|
||||
Reference in New Issue
Block a user