mirror of
https://github.com/clearlinux/systemd-stable.git
synced 2026-09-05 13:11:32 +00:00
sysusers: don't allow user names longer than UT_NAMESIZE
As pointed out by Miloslav Trmač it might be a good idea to make sure
that usernames stay with in the utmp-defined limits.
(cherry picked from commit 932ad62b84)
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
10242a06bf
commit
e17ff7ab51
+1
-1
@@ -142,7 +142,7 @@ m authd input</programlisting>
|
||||
<title>Name</title>
|
||||
|
||||
<para>The name field specifies the user or
|
||||
group name. It should be be shorter than 256
|
||||
group name. It should be be shorter than 31
|
||||
characters and avoid any non-ASCII characters,
|
||||
and not begin with a numeric character. It is
|
||||
strongly recommended to pick user and group
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <grp.h>
|
||||
#include <shadow.h>
|
||||
#include <getopt.h>
|
||||
#include <utmp.h>
|
||||
|
||||
#include "util.h"
|
||||
#include "hashmap.h"
|
||||
@@ -1095,6 +1096,9 @@ static bool valid_user_group_name(const char *u) {
|
||||
if ((size_t) (i-u) > (size_t) sz)
|
||||
return false;
|
||||
|
||||
if ((size_t) (i-u) > UT_NAMESIZE - 1)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user