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:
parent
f286cf1792
commit
d7a25cdb82
Notes:
sideshowbarker
2024-07-18 12:35:39 +09:00
Author: https://github.com/brapru
Commit: d7a25cdb82
Pull-request: https://github.com/SerenityOS/serenity/pull/7933
1 changed files with 5 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue