allow 32 char usernames (#RHEL-55983)

Resolves: RHEL-55983
This commit is contained in:
Michal Hlavinka 2025-01-22 12:34:52 +01:00
parent bf98ec79f3
commit ad141a6b4d
2 changed files with 46 additions and 6 deletions

View File

@ -0,0 +1,34 @@
From 2de8a480e271e6c21db8afdb5552d09003cd7ab8 Mon Sep 17 00:00:00 2001
From: Michal Hlavinka <mhlavink@redhat.com>
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++) {

View File

@ -1,14 +1,17 @@
Name: libuser Name: libuser
Version: 0.63 Version: 0.63
Release: 15%{?dist} Release: 16%{?dist}
License: LGPLv2+ License: LGPLv2+
URL: https://pagure.io/libuser URL: https://pagure.io/libuser
Source: http://releases.pagure.org/libuser/libuser-%{version}.tar.xz Source: http://releases.pagure.org/libuser/libuser-%{version}.tar.xz
Patch0001: 0001-man-typo.patch Patch1: 0001-man-typo.patch
Patch0002: 0002-popt-memopy.patch Patch2: 0002-popt-memopy.patch
Patch0003: 0003-translation.patch Patch3: 0003-translation.patch
Patch0004: 0004-resource-leak.patch Patch4: 0004-resource-leak.patch
Patch0005: 0005-translation-update.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: glib2-devel
BuildRequires: linuxdoc-tools BuildRequires: linuxdoc-tools
@ -123,6 +126,9 @@ make
%{_datadir}/gtk-doc/html/* %{_datadir}/gtk-doc/html/*
%changelog %changelog
* Wed Nov 06 2024 Michal Hlavinka <mhlavink@redhat.com> - 0.63-16
- allow 32 char usernames (#RHEL-55983)
* Tue May 7 2024 Tomas Halman <thalman@redhat.com> - 0.63-15 * Tue May 7 2024 Tomas Halman <thalman@redhat.com> - 0.63-15
- Update translations - Update translations
Resolves: RHEL-12110 Resolves: RHEL-12110