From: David Mulder Date: Fri, 9 Dec 2022 16:40:34 +0000 (-0700) Subject: gp: Fix rsop when final value isn't a str X-Git-Tag: talloc-2.4.0~176 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c435c105c511bd984b6d1bda3964100ad5ec2c31;p=thirdparty%2Fsamba.git 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 Reviewed-by: Jeremy Allison --- 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)