summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended
diff options
context:
space:
mode:
authorShan Hai <shan.hai@windriver.com>2016-09-13 13:45:46 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-16 15:24:02 +0100
commit55bb15f791b2fce15bcc1f6a0204206ab1cdc170 (patch)
treea2279eb004dfb58217c1f87820de308b7418ca05 /meta/recipes-extended
parent7ba62d65d2dd522559d18a3035a583da2c5ffbff (diff)
downloadpoky-55bb15f791b2fce15bcc1f6a0204206ab1cdc170.tar.gz
shadow: use relaxed usernames
The groupadd from shadow does not allow upper case group names, the same is true for the upstream shadow. But distributions like Debian/Ubuntu/CentOS has their own way to cope with this problem, this patch is picked up from CentOS release 7.0 to relax the usernames restrictions to allow the upper case group names, and the relaxation is POSIX compliant because POSIX indicate that usernames are composed of characters from the portable filename character set [A-Za-z0-9._-]. (From OE-Core rev: 31c6c8150394de067085be5b0058037077860a8a) Signed-off-by: Shan Hai <shan.hai@windriver.com> Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended')
-rw-r--r--meta/recipes-extended/shadow/files/shadow-relaxed-usernames.patch100
-rw-r--r--meta/recipes-extended/shadow/shadow.inc1
2 files changed, 101 insertions, 0 deletions
diff --git a/meta/recipes-extended/shadow/files/shadow-relaxed-usernames.patch b/meta/recipes-extended/shadow/files/shadow-relaxed-usernames.patch
new file mode 100644
index 0000000000..1af04d5fe8
--- /dev/null
+++ b/meta/recipes-extended/shadow/files/shadow-relaxed-usernames.patch
@@ -0,0 +1,100 @@
1
2The groupadd from shadow does not allow upper case group names, the
3same is true for the upstream shadow. But distributions like
4Debian/Ubuntu/CentOS has their own way to cope with this problem,
5this patch is picked up from CentOS release 7.0 to relax the usernames
6restrictions to allow the upper case group names, and the relaxation is
7POSIX compliant because POSIX indicate that usernames are composed of
8characters from the portable filename character set [A-Za-z0-9._-].
9
10Upstream-Status: Pending
11
12Signed-off-by: Shan Hai <shan.hai@windriver.com>
13
14diff -urpN a/libmisc/chkname.c b/libmisc/chkname.c
15index 5089112..f40a0da 100644
16--- a/libmisc/chkname.c
17+++ b/libmisc/chkname.c
18@@ -49,21 +49,28 @@
19 static bool is_valid_name (const char *name)
20 {
21 /*
22- * User/group names must match [a-z_][a-z0-9_-]*[$]
23- */
24- if (('\0' == *name) ||
25- !((('a' <= *name) && ('z' >= *name)) || ('_' == *name))) {
26+ * User/group names must match gnu e-regex:
27+ * [a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,30}[a-zA-Z0-9_.$-]?
28+ *
29+ * as a non-POSIX, extension, allow "$" as the last char for
30+ * sake of Samba 3.x "add machine script"
31+ */
32+ if ( ('\0' == *name) ||
33+ !((*name >= 'a' && *name <= 'z') ||
34+ (*name >= 'A' && *name <= 'Z') ||
35+ (*name >= '0' && *name <= '9') ||
36+ (*name == '_') || (*name == '.')
37+ )) {
38 return false;
39 }
40
41 while ('\0' != *++name) {
42- if (!(( ('a' <= *name) && ('z' >= *name) ) ||
43- ( ('0' <= *name) && ('9' >= *name) ) ||
44- ('_' == *name) ||
45- ('-' == *name) ||
46- ('.' == *name) ||
47- ( ('$' == *name) && ('\0' == *(name + 1)) )
48- )) {
49+ if (!( (*name >= 'a' && *name <= 'z') ||
50+ (*name >= 'A' && *name <= 'Z') ||
51+ (*name >= '0' && *name <= '9') ||
52+ (*name == '_') || (*name == '.') || (*name == '-') ||
53+ (*name == '$' && *(name + 1) == '\0')
54+ )) {
55 return false;
56 }
57 }
58diff -urpN a/man/groupadd.8.xml b/man/groupadd.8.xml
59index 230fd0c..94f7807 100644
60--- a/man/groupadd.8.xml
61+++ b/man/groupadd.8.xml
62@@ -222,12 +222,6 @@
63 <refsect1 id='caveats'>
64 <title>CAVEATS</title>
65 <para>
66- Groupnames must start with a lower case letter or an underscore,
67- followed by lower case letters, digits, underscores, or dashes.
68- They can end with a dollar sign.
69- In regular expression terms: [a-z_][a-z0-9_-]*[$]?
70- </para>
71- <para>
72 Groupnames may only be up to &GROUP_NAME_MAX_LENGTH; characters long.
73 </para>
74 <para>
75diff -urpN a/man/useradd.8.xml b/man/useradd.8.xml
76index 5dec989..fe623b9 100644
77--- a/man/useradd.8.xml
78+++ b/man/useradd.8.xml
79@@ -336,7 +336,7 @@
80 </term>
81 <listitem>
82 <para>
83- Do no create the user's home directory, even if the system
84+ Do not create the user's home directory, even if the system
85 wide setting from <filename>/etc/login.defs</filename>
86 (<option>CREATE_HOME</option>) is set to
87 <replaceable>yes</replaceable>.
88@@ -607,12 +607,6 @@
89 </para>
90
91 <para>
92- Usernames must start with a lower case letter or an underscore,
93- followed by lower case letters, digits, underscores, or dashes.
94- They can end with a dollar sign.
95- In regular expression terms: [a-z_][a-z0-9_-]*[$]?
96- </para>
97- <para>
98 Usernames may only be up to 32 characters long.
99 </para>
100 </refsect1>
diff --git a/meta/recipes-extended/shadow/shadow.inc b/meta/recipes-extended/shadow/shadow.inc
index 5605876988..35a18f8ab0 100644
--- a/meta/recipes-extended/shadow/shadow.inc
+++ b/meta/recipes-extended/shadow/shadow.inc
@@ -22,6 +22,7 @@ SRC_URI = "http://pkg-shadow.alioth.debian.org/releases/${BPN}-${PV}.tar.xz \
22SRC_URI_append_class-target = " \ 22SRC_URI_append_class-target = " \
23 file://login_defs_pam.sed \ 23 file://login_defs_pam.sed \
24 file://shadow-update-pam-conf.patch \ 24 file://shadow-update-pam-conf.patch \
25 file://shadow-relaxed-usernames.patch \
25 " 26 "
26 27
27SRC_URI_append_class-native = " \ 28SRC_URI_append_class-native = " \