diff --git a/limit-username-length-to-32.patch b/limit-username-length-to-32.patch new file mode 100644 index 0000000000000000000000000000000000000000..23e9f3a836c29c221464148e006f1b70be02394e --- /dev/null +++ b/limit-username-length-to-32.patch @@ -0,0 +1,41 @@ +From cb569337f22de160d61df0bdb7c06f17517835ab Mon Sep 17 00:00:00 2001 +From: zhangshaoning +Date: Thu, 16 Jan 2025 16:30:09 +0800 +Subject: [PATCH] limit username length to 32 + +--- + lib/chkname.c | 4 ++-- + lib/chkname.h | 4 ++++ + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/lib/chkname.c b/lib/chkname.c +index 2b83361..ae6180f 100644 +--- a/lib/chkname.c ++++ b/lib/chkname.c +@@ -75,9 +75,9 @@ static bool is_valid_name (const char *name) + bool is_valid_user_name (const char *name) + { + /* +- * User names length are limited by the kernel ++ * User names length are limited by USER_NAME_MAX_LENGTH + */ +- if (strlen (name) > sysconf(_SC_LOGIN_NAME_MAX)) { ++ if (strlen (name) > USER_NAME_MAX_LENGTH) { + return false; + } + +diff --git a/lib/chkname.h b/lib/chkname.h +index 0771347..4af8f32 100644 +--- a/lib/chkname.h ++++ b/lib/chkname.h +@@ -25,3 +25,7 @@ extern bool is_valid_user_name (const char *name); + extern bool is_valid_group_name (const char *name); + + #endif ++ ++#ifndef USER_NAME_MAX_LENGTH ++#define USER_NAME_MAX_LENGTH 32 ++#endif +-- +2.18.2 + diff --git a/shadow.spec b/shadow.spec index 3aa0070a6e3d0d2156dcc4dea3d71874e057cb40..78f69ded24da2b853aef5eee2d83e72d03aa678b 100644 --- a/shadow.spec +++ b/shadow.spec @@ -1,6 +1,6 @@ Name: shadow Version: 4.14.3 -Release: 3 +Release: 4 Epoch: 2 License: BSD and GPLv2+ Summary: Tools for managing accounts and shadow password files @@ -27,6 +27,7 @@ Patch6: backport-src-groupmod.c-delete-gr_free_members-grp-to-avoid-d.patch Patch7: backport-lib-idmapping.c--Use-long-constants-in-prctl-2.patch Patch8: backport-libsubid-Dealocate-memory-on-exit.patch Patch9: backport-man-lastlog-remove-wrong-use-of-keyword-term.patch +Patch10: limit-username-length-to-32.patch BuildRequires: gcc, libselinux-devel, audit-libs-devel, libsemanage-devel @@ -197,6 +198,9 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/libsubid.{la,a} %{_mandir}/*/* %changelog +* Fri Jan 17 2025 zhangshaoning - 2:4.14.3-4 +- limit username length to 32 + * Thu Sep 26 2024 zhangxingrong - 2:4.14.3-3 - lib/idmapping.c: Use long constants in prctl(2) - libsubid: Dealocate memory on exit