1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 02:13:56 +09:00

Utilities: Do not allow creating users with existing usernames

Previously useradd would not check if a username already existed on the
system, and would instead add the user anyway and just increment the
uid. useradd should instead return an error when the user attempts to
create already existing users.
This commit is contained in:
brapru 2021-06-08 21:35:50 -04:00 committed by Andreas Kling
parent f286cf1792
commit d7a25cdb82
Notes: sideshowbarker 2024-07-18 12:35:39 +09:00

View file

@ -64,6 +64,11 @@ int main(int argc, char** argv)
return 1;
}
if (getpwnam(username)) {
warnln("user {} already exists!", username);
return 1;
}
if (uid < 0) {
warnln("invalid uid {}!", uid);
return 3;