summaryrefslogtreecommitdiff
path: root/python/samba/netcmd
diff options
context:
space:
mode:
authorGarming Sam <garming@catalyst.net.nz>2019-02-20 13:43:42 +1300
committerAndrew Bartlett <abartlet@samba.org>2019-03-12 00:42:19 +0000
commit5514b98f1d6611b99923ad98e8d55985c6620b70 (patch)
tree14cc5dd39f39abcf92fa8ce17ddcd1af164f3bb1 /python/samba/netcmd
parentd959bea2a8f2c6ec773c9bbf09037aa7bf85d494 (diff)
downloadsamba-5514b98f1d6611b99923ad98e8d55985c6620b70.tar.gz
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>
Diffstat (limited to 'python/samba/netcmd')
-rw-r--r--python/samba/netcmd/gpo.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/python/samba/netcmd/gpo.py b/python/samba/netcmd/gpo.py
index 95fe5d6d439..ae06594e719 100644
--- a/python/samba/netcmd/gpo.py
+++ b/python/samba/netcmd/gpo.py
@@ -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: