If a package hard codes the UID or GID when adding a user or group to
the system and that UID/GID already exists, we should abort rather than
changing the UID/GID.
---
 eclass/user.eclass | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/eclass/user.eclass b/eclass/user.eclass
index f6a10a6bee2..0d0f9d9eb89 100644
--- a/eclass/user.eclass
+++ b/eclass/user.eclass
@@ -130,7 +130,8 @@ enewuser() {
        if [[ -n ${euid} && ${euid} != -1 ]] ; then
                if [[ ${euid} -gt 0 ]] ; then
                        if [[ -n $(egetent passwd ${euid}) ]] ; then
-                               euid="next"
+                               eerror "UID is already taken"
+                               die "user ${euser} needs a new UID"
                        fi
                else
                        eerror "Userid given but is not greater than 0 !"
@@ -290,7 +291,8 @@ enewgroup() {
        if [[ ! -z ${egid} ]] ; then
                if [[ ${egid} -gt 0 ]] ; then
                        if [[ -n $(egetent group ${egid}) ]] ; then
-                               egid="next available; requested gid taken"
+                               eerror "GID is already taken"
+                               die "group ${egroup} needs a new GID"
                        fi
                else
                        eerror "Groupid given but is not greater than 0 !"
-- 
2.21.0


Reply via email to