From: Iker Pedrosa Date: Tue, 9 Sep 2025 07:20:17 +0000 (+0200) Subject: tests/system/framework/misc/__init__.py: password pattern X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=acea06b4a05de16babd756a6c20b5ec6ad80af66;p=thirdparty%2Fshadow.git tests/system/framework/misc/__init__.py: password pattern Expose shadow's password regex pattern in a function. Signed-off-by: Iker Pedrosa --- diff --git a/tests/system/framework/misc/__init__.py b/tests/system/framework/misc/__init__.py index 0ee8a080a..1896b9cc7 100644 --- a/tests/system/framework/misc/__init__.py +++ b/tests/system/framework/misc/__init__.py @@ -52,3 +52,14 @@ def days_since_epoch(): now_utc = datetime.datetime.now(datetime.timezone.utc) delta = now_utc - epoch return delta.days + + +def shadow_password_pattern() -> str: + """ + Returns the shadow password regex pattern. + + This pattern matches encrypted password hashes stored in /etc/shadow files, + including common formats like MD5, SHA-256, SHA-512, and yescrypt. The pattern + expects the standard Unix crypt format: $algorithm$salt$hash with optional parameters. + """ + return r"^\$(?:\w)\$[^$]*\$[\w./]+(?:\$[\w./]+)?$"