summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorDavid Mulder <dmulder@samba.org>2022-12-09 09:40:34 -0700
committerJeremy Allison <jra@samba.org>2022-12-21 02:04:37 +0000
commitc435c105c511bd984b6d1bda3964100ad5ec2c31 (patch)
treeff2519ebc13d1f21d908b21399641a1198fc62d6 /python
parent74598eeef72e6b260393df7451c957d7fde1f59a (diff)
downloadsamba-c435c105c511bd984b6d1bda3964100ad5ec2c31.tar.gz
gp: Fix rsop when final value isn't a str
The output must be a string value, or it will crash. Chromium policies output integers, which was causing the parser to crash. Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'python')
-rw-r--r--python/samba/gp/gpclass.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/python/samba/gp/gpclass.py b/python/samba/gp/gpclass.py
index d6ada1dbaad..4737bfe0738 100644
--- a/python/samba/gp/gpclass.py
+++ b/python/samba/gp/gpclass.py
@@ -42,6 +42,8 @@ from samba.ndr import ndr_pack, ndr_unpack
from samba.credentials import SMB_SIGNING_REQUIRED
from samba.gp.util.logging import log
from hashlib import blake2b
+import numbers
+from samba.common import get_string
try:
from enum import Enum
@@ -718,7 +720,10 @@ def __rsop_vals(vals, level=4):
ret = [' '*level + '[ %s ]' % __rsop_vals(v, level+2) for v in vals]
return '\n' + '\n'.join(ret)
else:
- return vals
+ if isinstance(vals, numbers.Number):
+ return ' '*(level+2) + str(vals)
+ else:
+ return ' '*(level+2) + get_string(vals)
def rsop(lp, creds, store, gp_extensions, username, target):
dc_hostname = get_dc_hostname(creds, lp)