35 lines
1.0 KiB
Diff
35 lines
1.0 KiB
Diff
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++) {
|
|
|