From 243c29db87acbbb655ebdf06d301052a709ec992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulrich=20M=C3=BCller?= Date: Sat, 26 Mar 2022 10:48:25 +0100 Subject: [PATCH] acct-user.eclass: Refuse to lock out the superuser MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ulrich Müller --- eclass/acct-user.eclass | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass index 2e2e1152f9ad4..f2aaefc2ee39a 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}"