user.eclass: Die if no free UID/GID is found
authorMichał Górny <mgorny@gentoo.org>
Thu, 30 May 2019 04:08:11 +0000 (06:08 +0200)
committerMichał Górny <mgorny@gentoo.org>
Thu, 20 Jun 2019 08:16:42 +0000 (10:16 +0200)
Signed-off-by: Michał Górny <mgorny@gentoo.org>
eclass/user.eclass

index 92a07bb6b41b974c10a914727b45e53d404061dd..8afbc101fac3fe37bb9405f9ee9e3a280c956a83 100644 (file)
@@ -135,6 +135,7 @@ enewuser() {
                for ((euid = 101; euid <= 999; euid++)); do
                        [[ -z $(egetent passwd ${euid}) ]] && break
                done
+               [[ ${euid} -le 999 ]] || die "${FUNCNAME}: no free UID found"
        fi
        opts+=( -u ${euid} )
        einfo " - Userid: ${euid}"
@@ -307,6 +308,7 @@ enewgroup() {
                        for ((egid = 101; egid <= 999; egid++)) ; do
                                [[ -z $(egetent group ${egid}) ]] && break
                        done
+                       [[ ${egid} -le 999 ]] || die "${FUNCNAME}: no free GID found"
                fi
        }