mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:57:45 +00:00
LibCore+passwd+su+Base: Add /etc/shadow to hide hashes from users :^)
This patch moves the user account password hashes from /etc/passwd, where they were world-readable, to /etc/shadow, where only root can access them. The Core::Account class is extended to support both authentication against, and modification of /etc/shadow. The default password for "anon" as of this commit is "foo" :^)
This commit is contained in:
parent
c17056cf09
commit
9a688af4b1
6 changed files with 189 additions and 41 deletions
|
@ -50,7 +50,9 @@ int main(int argc, char** argv)
|
|||
if (geteuid() != 0)
|
||||
fprintf(stderr, "Not running as root :(\n");
|
||||
|
||||
auto account_or_error = (user) ? Core::Account::from_name(user) : Core::Account::from_uid(0);
|
||||
auto account_or_error = (user)
|
||||
? Core::Account::from_name(user, Core::Account::OpenPasswdFile::No, Core::Account::OpenShadowFile::ReadOnly)
|
||||
: Core::Account::from_uid(0, Core::Account::OpenPasswdFile::No, Core::Account::OpenShadowFile::ReadOnly);
|
||||
if (account_or_error.is_error()) {
|
||||
fprintf(stderr, "Core::Account::from_name: %s\n", account_or_error.error().characters());
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue