summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2022-03-26 10:48:25 +0100
committerUlrich Müller <ulm@gentoo.org>2022-03-28 21:47:20 +0200
commit243c29db87acbbb655ebdf06d301052a709ec992 (patch)
tree6a93188937c0ff08a9c2cd60b7fd68ccc3faa74b /eclass/acct-user.eclass
parentacct-user.eclass: Use arithmetic test for EUID (diff)
downloadgentoo-243c29db87acbbb655ebdf06d301052a709ec992.tar.gz
gentoo-243c29db87acbbb655ebdf06d301052a709ec992.tar.bz2
gentoo-243c29db87acbbb655ebdf06d301052a709ec992.zip
acct-user.eclass: Refuse to lock out the superuser
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
Diffstat (limited to 'eclass/acct-user.eclass')
-rw-r--r--eclass/acct-user.eclass5
1 files changed, 5 insertions, 0 deletions
diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass
index 2e2e1152f9ad..f2aaefc2ee39 100644
--- a/eclass/acct-user.eclass
+++ b/eclass/acct-user.eclass
@@ -473,6 +473,11 @@ acct-user_pkg_prerm() {
return 0
fi
+ if [[ ${ACCT_USER_ID} -eq 0 ]]; then
+ elog "Refusing to lock out the superuser (UID 0)"
+ return 0
+ fi
+
if [[ -z ${REPLACED_BY_VERSION} ]]; then
if [[ -z $(egetent passwd "${ACCT_USER_NAME}") ]]; then
ewarn "User account not found: ${ACCT_USER_NAME}"