#!/usr/bin/sh #---------------------------------------------------------------------------- # pure-ftpd-show-vuser - Show pure-ftpd virtual user # # Creation: 2003-10-05 ap # Last Update: $Id$ # # Copyright (c) 2003-2012 Ansgar Puester, ansgar.puester(at)freenet(dot)de # Copyright (c) 2012-2015 Holger Bruenjes, holgerbruenjes(at)gmx(dot)net # Copyright (c) 2016-2021 Ansgar Puester, ansgar.puester(at)freenet(dot)de # Copyright (c) 2024-@@YEAR@@ Holger Bruenjes, holgerbruenjes(at)gmx(dot)net # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- # include eislib . /var/install/include/eislib ASK='/var/install/bin/ask' # --------------------------------------------------------------------------- # check if console minium 80x24 # --------------------------------------------------------------------------- check_screensize case ${?} in 0) : # nothing to do ;; *) exit 1 ;; esac config_file='/etc/config.d/pure-ftpd-vuser' . ${config_file} # --------------------------------------------------------------------------- # print header line # --------------------------------------------------------------------------- print_header_line() { clrhome mecho --info "Show Pure-FTPd virtual user" } # --------------------------------------------------------------------------- # print footer # --------------------------------------------------------------------------- footer() { mecho _ask_tmpfile=$(mktemp -t XXXXXXXXXXXXX) ${ASK} "Continue" 'no' >${_ask_tmpfile} rc=${?} read answer < ${_ask_tmpfile} rm -f ${_ask_tmpfile} if [ ${rc} = 255 ] then answer=no fi case "${answer}" in no) ret=1 ;; yes) ret=0 ;; esac return ${ret} } print_header_line if [ "${PURE_FTPD_ENABLE_VIRTUAL_USERS:-no}" != "yes" ] then mecho --error "Pure-FTPd virtual users are not enabled" mecho --error "no user can be selected" footer exit fi fini=false while [ $fini = 'false' ] do mecho _ask_tmpfile=$(mktemp -t XXXXXXXXXXXXX) ${ASK} "Pure-FTPd virtual user" "" "+" >${_ask_tmpfile} rc=${?} read user < ${_ask_tmpfile} rm -f ${_ask_tmpfile} if [ ${rc} = 255 ] then user='' fi if [ -n "${user}" ] then if pure-pw show "${user}" >/dev/null 2>&1 then pure-pw show "${user}" else mecho -n --error "Pure-FTPd virtual user " mecho -n "'${user}' " mecho --error "does not exist" fi fi if footer then print_header_line else fini=true fi done # --------------------------------------------------------------------------- # end # ---------------------------------------------------------------------------