From: Douglas Bagnall Date: Fri, 14 Mar 2025 04:45:18 +0000 (+1300) Subject: samba-tool gpo: better entities check copes with new lines X-Git-Tag: samba-4.21.6~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f3b9da3179e87f3c7ddbc01b83cf1fceb1f2fa1c;p=thirdparty%2Fsamba.git 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) --- 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. ')