Correct the enewuser call not to enforce specified UID unless
ACCT_USER_ENFORCE_ID is set.

Reported-by: Toralf Förster <[email protected]>
Tested-by: Marek Szuba <[email protected]>
Closes: https://bugs.gentoo.org/689102
Signed-off-by: Michał Górny <[email protected]>
---
 eclass/acct-user.eclass | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass
index ec9c859aec27..60009643c144 100644
--- a/eclass/acct-user.eclass
+++ b/eclass/acct-user.eclass
@@ -325,8 +325,9 @@ acct-user_pkg_preinst() {
        debug-print-function ${FUNCNAME} "${@}"
 
        local groups=${ACCT_USER_GROUPS[*]}
-       enewuser -F -M "${ACCT_USER_NAME}" "${ACCT_USER_ID}" \
-               "${ACCT_USER_SHELL}" "${ACCT_USER_HOME}" "${groups// /,}"
+       enewuser ${ACCT_USER_ENFORCE_ID:+-F} -M "${ACCT_USER_NAME}" \
+               "${ACCT_USER_ID}" "${ACCT_USER_SHELL}" "${ACCT_USER_HOME}" \
+               "${groups// /,}"
 
        if [[ ${ACCT_USER_HOME} != /dev/null ]]; then
                # default ownership to user:group
-- 
2.22.0


Reply via email to