[packages/shadow] Rel 2; updated user/group names patch from fc
arekm
arekm at pld-linux.org
Thu Jan 13 08:47:48 CET 2022
commit 086b1d2e6b488db16ffa03f1df616f9958345fa4
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Thu Jan 13 08:45:42 2022 +0100
Rel 2; updated user/group names patch from fc
shadow-goodname.patch | 142 ++++++++++++++++++++++----------------------------
shadow.spec | 5 +-
2 files changed, 65 insertions(+), 82 deletions(-)
---
diff --git a/shadow.spec b/shadow.spec
index 523d373..d1cb51c 100644
--- a/shadow.spec
+++ b/shadow.spec
@@ -14,7 +14,7 @@ Summary(pt_BR.UTF-8): Utilitários para o arquivo de senhas Shadow
Summary(tr.UTF-8): Gölge parola dosyası araçları
Name: shadow
Version: 4.8.1
-Release: 1
+Release: 2
Epoch: 1
License: BSD
Group: Applications/System
@@ -137,7 +137,8 @@ tworzyć mapowania uidów i gidów w przestrzeniach użytkowników.
%prep
%setup -q
%patch0 -p1
-#%patch1 -p1 UPSTREAM or drop
+# allows dots in user/group names
+%patch1 -p1
%build
# NOTE:
diff --git a/shadow-goodname.patch b/shadow-goodname.patch
index 1fdd84f..f3c18d5 100644
--- a/shadow-goodname.patch
+++ b/shadow-goodname.patch
@@ -1,49 +1,65 @@
-diff -up shadow-4.1.5.1/libmisc/chkname.c.goodname shadow-4.1.5.1/libmisc/chkname.c
---- shadow-4.1.5.1/libmisc/chkname.c.goodname 2009-07-13 00:24:45.000000000 +0200
-+++ shadow-4.1.5.1/libmisc/chkname.c 2012-09-19 18:43:53.492160653 +0200
-@@ -49,20 +49,28 @@
- static bool is_valid_name (const char *name)
- {
+diff -up shadow-4.8/libmisc/chkname.c.goodname shadow-4.8/libmisc/chkname.c
+--- shadow-4.8/libmisc/chkname.c.goodname 2020-01-13 09:44:41.968507996 +0100
++++ shadow-4.8/libmisc/chkname.c 2020-01-13 09:46:27.863727732 +0100
+@@ -55,26 +55,44 @@ static bool is_valid_name (const char *n
+ }
+
/*
- * User/group names must match [a-z_][a-z0-9_-]*[$]
- */
-- if (('\0' == *name) ||
-- !((('a' <= *name) && ('z' >= *name)) || ('_' == *name))) {
+ * User/group names must match gnu e-regex:
+ * [a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,30}[a-zA-Z0-9_.$-]?
+ *
+ * as a non-POSIX, extension, allow "$" as the last char for
+ * sake of Samba 3.x "add machine script"
++ *
++ * Also do not allow fully numeric names or just "." or "..".
+ */
-+ if ( ('\0' == *name) ||
-+ !((*name >= 'a' && *name <= 'z') ||
-+ (*name >= 'A' && *name <= 'Z') ||
-+ (*name >= '0' && *name <= '9') ||
-+ (*name == '_') || (*name == '.')
-+ )) {
++ int numeric;
+
+- if (('\0' == *name) ||
+- !((('a' <= *name) && ('z' >= *name)) || ('_' == *name))) {
++ if ('\0' == *name ||
++ ('.' == *name && (('.' == name[1] && '\0' == name[2]) ||
++ '\0' == name[1])) ||
++ !((*name >= 'a' && *name <= 'z') ||
++ (*name >= 'A' && *name <= 'Z') ||
++ (*name >= '0' && *name <= '9') ||
++ *name == '_' ||
++ *name == '.')) {
return false;
}
++ numeric = isdigit(*name);
++
while ('\0' != *++name) {
- if (!(( ('a' <= *name) && ('z' >= *name) ) ||
- ( ('0' <= *name) && ('9' >= *name) ) ||
- ('_' == *name) ||
- ('-' == *name) ||
- ( ('$' == *name) && ('\0' == *(name + 1)) )
-- )) {
-+ if (!( (*name >= 'a' && *name <= 'z') ||
-+ (*name >= 'A' && *name <= 'Z') ||
-+ (*name >= '0' && *name <= '9') ||
-+ (*name == '_') || (*name == '.') || (*name == '-') ||
-+ (*name == '$' && *(name + 1) == '\0')
-+ )) {
++ if (!((*name >= 'a' && *name <= 'z') ||
++ (*name >= 'A' && *name <= 'Z') ||
++ (*name >= '0' && *name <= '9') ||
++ *name == '_' ||
++ *name == '.' ||
++ *name == '-' ||
++ (*name == '$' && name[1] == '\0')
+ )) {
return false;
}
++ numeric &= isdigit(*name);
}
-diff -up shadow-4.1.5.1/man/groupadd.8.xml.goodname shadow-4.1.5.1/man/groupadd.8.xml
---- shadow-4.1.5.1/man/groupadd.8.xml.goodname 2012-05-25 13:45:27.000000000 +0200
-+++ shadow-4.1.5.1/man/groupadd.8.xml 2012-09-19 18:43:53.492160653 +0200
-@@ -259,12 +259,6 @@
+
+- return true;
++ return !numeric;
+ }
+
+ bool is_valid_user_name (const char *name)
+diff -up shadow-4.8/man/groupadd.8.xml.goodname shadow-4.8/man/groupadd.8.xml
+--- shadow-4.8/man/groupadd.8.xml.goodname 2019-07-23 17:26:08.000000000 +0200
++++ shadow-4.8/man/groupadd.8.xml 2020-01-13 09:44:41.968507996 +0100
+@@ -273,10 +273,12 @@
<refsect1 id='caveats'>
<title>CAVEATS</title>
<para>
@@ -51,59 +67,19 @@ diff -up shadow-4.1.5.1/man/groupadd.8.xml.goodname shadow-4.1.5.1/man/groupadd.
- followed by lower case letters, digits, underscores, or dashes.
- They can end with a dollar sign.
- In regular expression terms: [a-z_][a-z0-9_-]*[$]?
-- </para>
-- <para>
- Groupnames may only be up to &GROUP_NAME_MAX_LENGTH; characters long.
++ Groupnames may contain only lower and upper case letters, digits,
++ underscores, or dashes. They can end with a dollar sign.
++
++ Dashes are not allowed at the beginning of the groupname.
++ Fully numeric groupnames and groupnames . or .. are
++ also disallowed.
</para>
<para>
-diff -up shadow-4.1.5.1/man/man8/groupadd.8.goodname shadow-4.1.5.1/man/man8/groupadd.8
---- shadow-4.1.5.1/man/man8/groupadd.8.goodname 2012-05-25 13:58:40.000000000 +0200
-+++ shadow-4.1.5.1/man/man8/groupadd.8 2012-09-19 18:44:42.175123079 +0200
-@@ -190,9 +190,7 @@ Shadow password suite configuration\&.
- .RE
- .SH "CAVEATS"
- .PP
--Groupnames must start with a lower case letter or an underscore, followed by lower case letters, digits, underscores, or dashes\&. They can end with a dollar sign\&. In regular expression terms: [a\-z_][a\-z0\-9_\-]*[$]?
--.PP
--Groupnames may only be up to 16 characters long\&.
-+Groupnames may only be up to 32 characters long\&.
- .PP
- You may not add a NIS or LDAP group\&. This must be performed on the corresponding server\&.
- .PP
-diff -up shadow-4.1.5.1/man/man8/useradd.8.goodname shadow-4.1.5.1/man/man8/useradd.8
---- shadow-4.1.5.1/man/man8/useradd.8.goodname 2012-05-25 13:59:28.000000000 +0200
-+++ shadow-4.1.5.1/man/man8/useradd.8 2012-09-19 18:46:09.249033949 +0200
-@@ -224,7 +224,7 @@ is not enabled, no home directories are
- .PP
- \fB\-M\fR
- .RS 4
--Do no create the user\*(Aqs home directory, even if the system wide setting from
-+Do not create the user\*(Aqs home directory, even if the system wide setting from
- /etc/login\&.defs
- (\fBCREATE_HOME\fR) is set to
- \fIyes\fR\&.
-@@ -430,8 +430,6 @@ Similarly, if the username already exist
- \fBuseradd\fR
- will deny the user account creation request\&.
- .PP
--Usernames must start with a lower case letter or an underscore, followed by lower case letters, digits, underscores, or dashes\&. They can end with a dollar sign\&. In regular expression terms: [a\-z_][a\-z0\-9_\-]*[$]?
--.PP
- Usernames may only be up to 32 characters long\&.
- .SH "CONFIGURATION"
- .PP
-diff -up shadow-4.1.5.1/man/useradd.8.xml.goodname shadow-4.1.5.1/man/useradd.8.xml
---- shadow-4.1.5.1/man/useradd.8.xml.goodname 2012-05-25 13:45:29.000000000 +0200
-+++ shadow-4.1.5.1/man/useradd.8.xml 2012-09-19 18:43:53.493160675 +0200
-@@ -366,7 +366,7 @@
- </term>
- <listitem>
- <para>
-- Do no create the user's home directory, even if the system
-+ Do not create the user's home directory, even if the system
- wide setting from <filename>/etc/login.defs</filename>
- (<option>CREATE_HOME</option>) is set to
- <replaceable>yes</replaceable>.
-@@ -654,12 +654,6 @@
+ Groupnames may only be up to &GROUP_NAME_MAX_LENGTH; characters long.
+diff -up shadow-4.8/man/useradd.8.xml.goodname shadow-4.8/man/useradd.8.xml
+--- shadow-4.8/man/useradd.8.xml.goodname 2019-10-05 03:23:58.000000000 +0200
++++ shadow-4.8/man/useradd.8.xml 2020-01-13 09:44:41.968507996 +0100
+@@ -661,10 +661,14 @@
</para>
<para>
@@ -111,8 +87,14 @@ diff -up shadow-4.1.5.1/man/useradd.8.xml.goodname shadow-4.1.5.1/man/useradd.8.
- followed by lower case letters, digits, underscores, or dashes.
- They can end with a dollar sign.
- In regular expression terms: [a-z_][a-z0-9_-]*[$]?
-- </para>
-- <para>
- Usernames may only be up to 32 characters long.
++ Usernames may contain only lower and upper case letters, digits,
++ underscores, or dashes. They can end with a dollar sign.
++
++ Dashes are not allowed at the beginning of the username.
++ Fully numeric usernames and usernames . or .. are
++ also disallowed. It is not recommended to use usernames beginning
++ with . character as their home directories will be hidden in
++ the <command>ls</command> output.
</para>
- </refsect1>
+ <para>
+ Usernames may only be up to 32 characters long.
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/shadow.git/commitdiff/086b1d2e6b488db16ffa03f1df616f9958345fa4
More information about the pld-cvs-commit
mailing list