summaryrefslogtreecommitdiff
path: root/Userland/Utilities/hostname.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-01-21 09:58:31 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-21 11:08:20 +0100
commit77e0598c6d5ab732cf43297f629867f01da08833 (patch)
tree25c2f625fbbd36e80e8f7aaefc8242410941a8c0 /Userland/Utilities/hostname.cpp
parentc9a7f81dc33692da3a079a202862c502cd1de1d0 (diff)
downloadserenity-77e0598c6d5ab732cf43297f629867f01da08833.zip
passwd+LibCore: Make passwd replace /etc files atomically
Before this patch, we had a nasty race condition when changing a user's password: there was a time window between truncating /etc/shadow and writing out its new contents, where you could simply "su" to root without using a password. Instead of writing directly to /etc/passwd and /etc/shadow, we now create temporary files in /etc and fill them with the new contents. Those files are then atomically renamed to /etc/passwd and /etc/shadow. Sadly, fixing this race requires giving the passwd program a lot more privileges. This is something we can and should improve upon. :^)
Diffstat (limited to 'Userland/Utilities/hostname.cpp')
0 files changed, 0 insertions, 0 deletions