From: Douglas Bagnall Date: Fri, 19 Aug 2022 04:53:40 +0000 (+1200) Subject: py/getopt: allow --option arguments to contain '=' X-Git-Tag: talloc-2.4.0~1181 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1137647460cc143509eae598708bb9f1529463f6;p=thirdparty%2Fsamba.git py/getopt: allow --option arguments to contain '=' smb.conf lines can have = on the right hand side. For example, in st/ad_dc/etc/smb.conf we have 3 examples, including: gpo update command = python3 source4/scripting/bin/samba-gpupdate [...] --target=Computer If we tried to provide the same line via --option, it would split on both '=', and the set value would end at '--target'. Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/getopt.py b/python/samba/getopt.py index 76c48de87b6..9e35273381f 100644 --- a/python/samba/getopt.py +++ b/python/samba/getopt.py @@ -84,7 +84,7 @@ class SambaOptions(optparse.OptionGroup): if arg.find('=') == -1: raise optparse.OptionValueError( "--option option takes a 'a=b' argument") - a = arg.split('=') + a = arg.split('=', 1) try: self._lp.set(a[0], a[1]) except Exception as e: