summaryrefslogtreecommitdiffstats
path: root/src/basic/user-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-09-06 13:20:11 +0200
committerLennart Poettering <lennart@poettering.net>2024-09-06 13:54:09 +0200
commitf3389fffd6c91ea518b9f2572d9184f4eeb0259f (patch)
tree81ce064679e7effc2880203215df2882bea76888 /src/basic/user-util.c
parentcoredump: set ProtectHome to read-only (diff)
downloadsystemd-f3389fffd6c91ea518b9f2572d9184f4eeb0259f.tar.xz
systemd-f3389fffd6c91ea518b9f2572d9184f4eeb0259f.zip
user-util: switch from utmp to utmpx
We generally use utmpx instead of utmp (both are actually identical on Linux, but utmpx is POSIX, while utmp is not). Let's fix one left-over case. UT_NAMESIZE does not exist in utmpx world, it has no direct counterpart, hence let's just sizeof_field() to determine the size of the actual field. (which comes to the same result of course: 32).
Diffstat (limited to 'src/basic/user-util.c')
-rw-r--r--src/basic/user-util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/basic/user-util.c b/src/basic/user-util.c
index 858d712189..6de5e4705e 100644
--- a/src/basic/user-util.c
+++ b/src/basic/user-util.c
@@ -9,7 +9,7 @@
#include <sys/file.h>
#include <sys/stat.h>
#include <unistd.h>
-#include <utmp.h>
+#include <utmpx.h>
#include "sd-messages.h"
@@ -802,7 +802,7 @@ bool valid_user_group_name(const char *u, ValidUserFlags flags) {
return false;
if (l > NAME_MAX) /* must fit in a filename: 255 */
return false;
- if (l > UT_NAMESIZE - 1) /* must fit in utmp: 31 */
+ if (l > sizeof_field(struct utmpx, ut_user) - 1) /* must fit in utmp: 31 */
return false;
}