From f3b9da3179e87f3c7ddbc01b83cf1fceb1f2fa1c Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Fri, 14 Mar 2025 17:45:18 +1300 Subject: [PATCH] samba-tool gpo: better entities check copes with new lines Per https://www.w3.org/TR/xml/#sec-entity-decl (and MS references) there is always some whitespace between ' We used to create such files, so we should allow them. There is a kind of entity that has '%' before the name, and there are non-ascii names, which we continue not to support. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15829 Signed-off-by: Douglas Bagnall Reviewed-by: Jennifer Sutton (cherry picked from commit 6107656ebc8d092b2c1907940b2486ab0265aad9) --- python/samba/netcmd/gpo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/samba/netcmd/gpo.py b/python/samba/netcmd/gpo.py index 3d548840673..5e5484a06ca 100644 --- a/python/samba/netcmd/gpo.py +++ b/python/samba/netcmd/gpo.py @@ -1653,8 +1653,8 @@ class cmd_restore(cmd_create): entities_content = entities_file.read() # Do a basic regex test of the entities file format - if re.match(r'(\s*)+\s*\Z', - entities_content, flags=re.MULTILINE) is None: + if re.match(r'(\s*)+\s*\Z', + entities_content, flags=re.MULTILINE|re.DOTALL) is None: raise CommandError("Entities file does not appear to " "conform to format\n" 'e.g. ') -- 2.47.2