]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
py/getopt: allow --option arguments to contain '='
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Fri, 19 Aug 2022 04:53:40 +0000 (16:53 +1200)
committerDouglas Bagnall <dbagnall@samba.org>
Tue, 6 Sep 2022 21:12:36 +0000 (21:12 +0000)
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 <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/getopt.py

index 76c48de87b6630cf72807f3c0a346bafd6ed9647..9e35273381f9fac7632987d3469e7caedd21e27a 100644 (file)
@@ -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: