#!/usr/bin/sh #---------------------------------------------------------------------------- # pure-ftpd-check-vusers - check pure-ftpd virtual users # # 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 # --------------------------------------------------------------------------- # check if console minium 80x24 # --------------------------------------------------------------------------- check_screensize case ${?} in 0) : # nothing to do ;; *) exit 1 ;; esac gotoyx() { echo -e "\033[$1;$2H\c"; } config_file='/etc/config.d/pure-ftpd-vuser' . ${config_file} # --------------------------------------------------------------------------- # print header line # --------------------------------------------------------------------------- print_header_line() { techo --row ' ' --info 'User' --info 'Home' --info 'Home exists' --info 'Unix User' } # --------------------------------------------------------------------------- # main # --------------------------------------------------------------------------- clrhome mecho --info "Check Pure-FTPd virtual users" mecho techo --begin '2 19 35 14 10' print_header_line if [ "${PURE_FTPD_ENABLE_VIRTUAL_USERS:-no}" != "yes" ] then mecho --error "Pure-FTPd virtual users are not enabled" mecho --error "no users are checked" techo --end echo anykey exit fi row=0 header_row=0 pure-pw list | while read line do set -- $line user="$1" home="$2" [ -d $home ] && hexists='yes' || hexists='no' if getent passwd "${user}" >/dev/null 2>&1 then pexists='yes' else pexists='no' fi techo --row ' ' "$user" "$home" "$hexists" "$pexists" row=$((${row} + 1)) header_row=$((${header_row} + 1)) refresh_screensize if [ ${_EISLIB_SCREENSIZE_Y} -lt $((${header_row} + 6)) ] then print_header_line header_row=0 fi done refresh_screensize echo echo echo echo techo --end gotoyx $((${_EISLIB_SCREENSIZE_Y} - 3)) 1 echo # set info line to screen is $row + 6 -gt $LINES if [ ${_EISLIB_SCREENSIZE_Y} -lt $((${row} + 6)) ] then mecho --info "Use SHIFT + PAGE-UP to scroll up" fi echo anykey # --------------------------------------------------------------------------- # end # ---------------------------------------------------------------------------