diff options
author | Mike Gilbert <floppym@gentoo.org> | 2022-10-17 16:27:06 -0400 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2022-10-19 15:30:10 +0200 |
commit | bde2856fc6bcc73d55dbf481a156805f06510a12 (patch) | |
tree | bda753db383bd94d1e6607842528815c45411ce0 /eclass/acct-user.eclass | |
parent | acct-user.eclass: inline useradd and usermod (diff) | |
download | gentoo-bde2856fc6bcc73d55dbf481a156805f06510a12.tar.gz gentoo-bde2856fc6bcc73d55dbf481a156805f06510a12.tar.bz2 gentoo-bde2856fc6bcc73d55dbf481a156805f06510a12.zip |
acct-user.eclass: drop elockuser and eunlockuser
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/acct-user.eclass')
-rw-r--r-- | eclass/acct-user.eclass | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass index a49279b542a1..12f472afaa5f 100644 --- a/eclass/acct-user.eclass +++ b/eclass/acct-user.eclass @@ -215,112 +215,6 @@ eislocked() { esac } -# @FUNCTION: elockuser -# @USAGE: <user> -# @INTERNAL -# @DESCRIPTION: -# Lock the specified user account, using the available platform-specific -# functions. This should prevent any login to the account. -# -# Established lock can be reverted using eunlockuser. -# -# This function returns 0 if locking succeeded, 2 if it is not supported -# by the platform code or dies if it fails. -elockuser() { - [[ $# -eq 1 ]] || die "usage: ${FUNCNAME} <user>" - - if [[ ${EUID} -ne 0 ]]; then - einfo "Insufficient privileges to execute ${FUNCNAME[0]}" - return 0 - fi - - eislocked "$1" - [[ $? -eq 0 ]] && return 0 - - local opts - [[ -n ${ROOT} ]] && opts=( --prefix "${ROOT}" ) - - case ${CHOST} in - *-freebsd*|*-dragonfly*) - pw lock "${opts[@]}" "$1" || die "Locking account $1 failed" - pw user mod "${opts[@]}" "$1" -e 1 || die "Expiring account $1 failed" - ;; - - *-netbsd*) - if [[ -n "${ROOT}" ]]; then - ewarn "NetBSD's usermod does not support --prefix <dir> option." - ewarn "Please use: usermod ${opts[@]} -e 1 -C yes \"$1\" in a chroot" - else - usermod "${opts[@]}" -e 1 -C yes "$1" || die "Locking account $1 failed" - fi - ;; - - *-openbsd*) - return 2 - ;; - - *) - usermod "${opts[@]}" -e 1 -L "$1" || die "Locking account $1 failed" - ;; - esac - - elog "User account $1 locked" - return 0 -} - -# @FUNCTION: eunlockuser -# @USAGE: <user> -# @INTERNAL -# @DESCRIPTION: -# Unlock the specified user account, using the available platform- -# specific functions. -# -# This function returns 0 if unlocking succeeded, 1 if it is not -# supported by the platform code or dies if it fails. -eunlockuser() { - [[ $# -eq 1 ]] || die "usage: ${FUNCNAME} <user>" - - if [[ ${EUID} -ne 0 ]]; then - einfo "Insufficient privileges to execute ${FUNCNAME[0]}" - return 0 - fi - - eislocked "$1" - [[ $? -eq 1 ]] && return 0 - - local opts - [[ -n ${ROOT} ]] && opts=( --prefix "${ROOT}" ) - - case ${CHOST} in - *-freebsd*|*-dragonfly*) - pw user mod "${opts[@]}" "$1" -e 0 || die "Unexpiring account $1 failed" - pw unlock "${opts[@]}" "$1" || die "Unlocking account $1 failed" - ;; - - *-netbsd*) - if [[ -n "${ROOT}" ]]; then - ewarn "NetBSD's usermod does not support --prefix <dir> option." - ewarn "Please use: \"usermod ${opts[@]} -e 0 -C no $1\" in a chroot" - else - usermod "${opts[@]}" -e 0 -C no "$1" || die "Unlocking account $1 failed" - fi - ;; - - *-openbsd*) - return 1 - ;; - - *) - # silence warning if account does not have a password - usermod "${opts[@]}" -e "" -U "$1" 2>/dev/null || die "Unlocking account $1 failed" - ;; - esac - - ewarn "User account $1 unlocked after reinstating." - return 0 -} - - # << Phase functions >> EXPORT_FUNCTIONS pkg_pretend src_install pkg_preinst pkg_postinst \ pkg_prerm |