From ad141a6b4df29d62f42a7d4b0e1a9afbd8dc94c3 Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Wed, 22 Jan 2025 12:34:52 +0100 Subject: [PATCH] allow 32 char usernames (#RHEL-55983) Resolves: RHEL-55983 --- libuser-0.63-32ch_username.patch | 34 ++++++++++++++++++++++++++++++++ libuser.spec | 18 +++++++++++------ 2 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 libuser-0.63-32ch_username.patch diff --git a/libuser-0.63-32ch_username.patch b/libuser-0.63-32ch_username.patch new file mode 100644 index 0000000..ba447fd --- /dev/null +++ b/libuser-0.63-32ch_username.patch @@ -0,0 +1,34 @@ +From 2de8a480e271e6c21db8afdb5552d09003cd7ab8 Mon Sep 17 00:00:00 2001 +From: Michal Hlavinka +Date: Nov 06 2024 10:54:15 +0000 +Subject: do not substract from UT_NAMESIZE for length check + + +Use full 32 characters limit for username verification, +while utmp declares ut_user[UT_NAMESIZE] it also +has __nostring__ attribute so do not expect nul termination +to fit. + +This fixes RHEL-55983 where all system utils work with 32chars, +but passwd -e (through libuser) fails with 32char user name + +--- + +diff --git a/lib/user.c b/lib/user.c +index 42f0c53..6b1cf7a 100644 +--- a/lib/user.c ++++ b/lib/user.c +@@ -223,10 +223,10 @@ lu_name_allowed(struct lu_ent *ent, struct lu_error **error) + lu_error_new(error, lu_error_name_bad, _("name is too short")); + return FALSE; + } +- if (len > UT_NAMESIZE - 1) { ++ if (len > UT_NAMESIZE) { + lu_error_new(error, lu_error_name_bad, + _("name is too long (%zu > %d)"), len, +- UT_NAMESIZE - 1); ++ UT_NAMESIZE); + return FALSE; + } + for (i = 0; sdata[i] != '\0'; i++) { + diff --git a/libuser.spec b/libuser.spec index 8ecd6f9..3676c70 100644 --- a/libuser.spec +++ b/libuser.spec @@ -1,14 +1,17 @@ Name: libuser Version: 0.63 -Release: 15%{?dist} +Release: 16%{?dist} License: LGPLv2+ URL: https://pagure.io/libuser Source: http://releases.pagure.org/libuser/libuser-%{version}.tar.xz -Patch0001: 0001-man-typo.patch -Patch0002: 0002-popt-memopy.patch -Patch0003: 0003-translation.patch -Patch0004: 0004-resource-leak.patch -Patch0005: 0005-translation-update.patch +Patch1: 0001-man-typo.patch +Patch2: 0002-popt-memopy.patch +Patch3: 0003-translation.patch +Patch4: 0004-resource-leak.patch +Patch5: 0005-translation-update.patch + +# allow 32char username as other tools, sent upstream, for <= 0.64, RHEL-55983 +Patch6: libuser-0.63-32ch_username.patch BuildRequires: glib2-devel BuildRequires: linuxdoc-tools @@ -123,6 +126,9 @@ make %{_datadir}/gtk-doc/html/* %changelog +* Wed Nov 06 2024 Michal Hlavinka - 0.63-16 +- allow 32 char usernames (#RHEL-55983) + * Tue May 7 2024 Tomas Halman - 0.63-15 - Update translations Resolves: RHEL-12110