From baefa61edfeaa4b9b5d80f1f021d3054921046f2 Mon Sep 17 00:00:00 2001 From: Jacob Hurwitz Date: Sun, 19 Mar 2017 21:31:45 -0700 Subject: [PATCH] [zephyr_mirror] add support for zcrypt'ed classes with colons The regex used for parsing .crypt-table didn't allow colons in class names. This commit changes the [^:] token with \S, meaning that class names can now contain colons but can no longer contain whitespace. I think this should be fine, since zcrypt is only used for MIT zephyr, where (by convention) class names do not contain whitespace. Additionally, it should not be possible for us to accidentally consume a field-separating colon as part of the class capture group because the regex enforces that all field-separating colons are followed by one or more whitespace characters, whereas the class name cannot contain whitespace. --- bots/zephyr_mirror_backend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bots/zephyr_mirror_backend.py b/bots/zephyr_mirror_backend.py index 29e7e6f..a3f05f4 100755 --- a/bots/zephyr_mirror_backend.py +++ b/bots/zephyr_mirror_backend.py @@ -313,7 +313,7 @@ def parse_crypt_table(zephyr_class, instance): if line.strip() == "": # Ignore blank lines continue - match = re.match("^crypt-(?P[^:]+):\s+((?P(AES|DES)):\s+)?(?P\S+)$", line) + match = re.match("^crypt-(?P\S+):\s+((?P(AES|DES)):\s+)?(?P\S+)$", line) if match is None: # Malformed crypt_table line logger.debug("Invalid crypt_table line!")