]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
buildtools: sanitise strange characters in vendor strings
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 20 Jun 2024 22:38:40 +0000 (10:38 +1200)
committerJule Anger <janger@samba.org>
Tue, 9 Jul 2024 07:49:17 +0000 (07:49 +0000)
There is no reason to think '-' and '+' are the only characters that
might sneak into a vendor string; Debian habitually use '~'.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15673

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
(cherry picked from commit 0bc5b6f29307ce758774c1b2f48ce62315fdc7f9)

buildtools/wafsamba/samba_abi.py

index 682f4e897b523f9259efa202a532426c66bcdeec..22c25b8da35bd7e80a5d05574b22edffcbe4476b 100644 (file)
@@ -286,7 +286,7 @@ def abi_build_vscript(task):
         f.close()
 
 def VSCRIPT_MAP_PRIVATE(bld, libname, orig_vscript, version, private_vscript):
-    version = version.replace("-", "_").replace("+","_").upper()
+    version = re.sub(r'\W', '_', version).upper()
     t = bld.SAMBA_GENERATOR(private_vscript,
                             rule=abi_build_vscript,
                             source=orig_vscript,
@@ -314,8 +314,8 @@ def ABI_VSCRIPT(bld, libname, abi_directory, version, vscript, abi_match=None, p
 
     libname = os.path.basename(libname)
     version = os.path.basename(version)
-    libname = libname.replace("-", "_").replace("+","_").upper()
-    version = version.replace("-", "_").replace("+","_").upper()
+    libname = re.sub(r'\W', '_', libname).upper()
+    version = re.sub(r'\W', '_', version).upper()
 
     t = bld.SAMBA_GENERATOR(vscript,
                             rule=abi_build_vscript,