commit: 243c29db87acbbb655ebdf06d301052a709ec992
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 26 09:48:25 2022 +0000
Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Mon Mar 28 19:47:20 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=243c29db
acct-user.eclass: Refuse to lock out the superuser
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>
eclass/acct-user.eclass | 5 +++++
1 file changed, 5 insertions(+)
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}"