#! /bin/sh #---------------------------------------------------------------------------- # inet-check-vusers - check pure-ftpd virtual users # # Copyright (c) 2001-2005 Ansgar Püster # # Creation: 05.10.2003 ap # Last Update: $Id$ # # 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 inet_config=/etc/config.d/inet . $inet_config header() { clrhome mecho -info "Check pure-ftpd virtual users" mecho techo row -info ' ' 'User' 'Home' 'Home exists' 'Unix User' } footer() { mecho mecho anykey } techo begin 2 19 35 15 9 header if [ ! $FTP_ENABLE_VIRTUAL_USERS = 'yes' ]; then mecho -error "pure-ftpd virtual users are not enabled" mecho -error "no users are checked" footer techo end exit fi tty=`tty` row=4 pure-pw list | while read line do set -- $line user="$1" home="$2" [ -d $home ] && hexists='yes' || hexists='no' if grep "^$user:" /etc/passwd >/dev/null 2>/dev/null; then pexists='yes' else pexists='no' fi techo row ' ' "$user" "$home" "$hexists" "$pexists" row=`expr $row + 1` if [ $row = 21 ] then # read answer from stdin footer < $tty # to fool mecho stdin is redirected to the tty header < $tty row=4 fi done techo end footer