24918713 pkglint username validation should allow usernames that contain digit zero
authorBilly Wan <billy.wan@oracle.com>
Mon, 07 Nov 2016 11:54:15 -0800
changeset 3466 14519baa95d6
parent 3465 f2bd47622f38
child 3467 ce210950a678
24918713 pkglint username validation should allow usernames that contain digit zero
src/modules/lint/pkglint_action.py
src/tests/api/t_pkglint.py
--- a/src/modules/lint/pkglint_action.py	Fri Nov 04 09:22:23 2016 +1100
+++ b/src/modules/lint/pkglint_action.py	Mon Nov 07 11:54:15 2016 -0800
@@ -1496,7 +1496,7 @@
                             msgid="{0}{1}.2".format(self.name, pkglint_id))
 
                 if len(username)> 0 and not \
-                    re.match("^[a-z]([a-zA-Z1-9._-])*$", username):
+                    re.match("^[a-z]([a-zA-Z0-9._-])*$", username):
                         engine.warning(
                             _("Username {name} in {pkg} is discouraged - see "
                             "passwd(4)").format(
--- a/src/tests/api/t_pkglint.py	Fri Nov 04 09:22:23 2016 +1100
+++ b/src/tests/api/t_pkglint.py	Mon Nov 07 11:54:15 2016 -0800
@@ -2124,6 +2124,21 @@
 file nohash elfarch=i386 elfbits=32 elfhash=2d5abc9b99e65c52c1afde443e9c5da7a6fcdb1e group=bin mode=0755 owner=root path=usr/lib/xfs.so pkg.csize=68397 pkg.size=177700 variant.arch=i386
 """
 
+expected_failures["valid_usernames.mf"] = []
+broken_manifests["valid_usernames.mf"] = \
+"""
+#
+# Usernames are allowed to contain digit zero.
+#
+set name=pkg.fmri value=pkg://opensolaris.org/system/[email protected],5.11-0.141:20100603T215050Z
+set name=org.opensolaris.consolidation value=osnet
+set name=pkg.description value="core kernel software for a specific instruction-set architecture"
+set name=info.classification value=org.opensolaris.category.2008:System/Core
+set name=pkg.summary value="Core Solaris Kernel"
+set name=variant.arch value=i386 value=sparc
+user gcos-field="pkg(7) server UID" group=pkg5srv uid=97 username="pkg5s0v"
+"""
+
 class TestLogFormatter(log.LogFormatter):
         """Records log messages to a buffer"""
         def __init__(self):