#!/usr/bin/perl -w
#
# sendmail-list
# John Simpson <jms1@jms1.net> 2005-06-23
#
# outputs a list of system userid's and their encrypted passwords
# as "vadduser" commands suitable to create mailboxes on a vpopmail system
#
###############################################################################
#
# Copyright (C) 2005 John Simpson.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2, as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
# or visit http://www.gnu.org/licenses/gpl.txt
#
###############################################################################

require 5.003 ;
use strict ;

my $domain = ( shift || die "No domain specified\n" ) ;

while ( my @pw = getpwent() )
{
	next if ( $pw[2] < 500 ) ;
	next if ( $pw[2] > 63999 ) ;
	next if ( $pw[1] =~ /[!\*]/ ) ;

	print "vadduser -e \'$pw[1]\' $pw[0]\@$domain\n" ;
}