#!/usr/bin/perl -w use warnings; use strict; use Tpop3d::Mailbox qw(create_mailbox); use Tpop3d::Passwd qw(set_password); sub usage { use File::Basename; my $me = basename $0; die "Usage: $me address@hidden [password]\n"; } usage unless @ARGV == 1 or @ARGV == 2; my ($local_part, $domain) = $ARGV[0] =~ /(\S+)\@(\S+)/; usage unless defined $local_part and defined $domain; my ($plaintext_password, $confirm); if (defined $ARGV[1]) { $plaintext_password = $ARGV[1]; } else { system "stty -echo"; for(;;) { print "Password: "; chomp($plaintext_password = ); print "\nConfirm: "; chomp($confirm = ); print "\n"; if ($plaintext_password ne $confirm) { print "Passwords don't match. Try again.\n"; } else { last; } } system "stty echo"; } create_mailbox($local_part, $domain); set_password($local_part, $domain, $plaintext_password); print "Added address@hidden"; __END__ =head1 NAME tpop3d_passwd =head1 SYNOPSIS tpop3d_passwd address@hidden [password] =head1 DESCRIPTION C performs various duties to ensure an email address is ready to accept mail and be retrieved using tpop3d. It is designed to work with auth-flatfile and a particular schema where mail is delivered to C and whose POP password is stored in a passwd-format in C. When presented with an email address tpop3d_passwd will, =over 4 =item * Ensure the directory C exists and is owned by C =item * Create, if necessary, a zero-length mailbox file C. =item * Ensure C exists =item * Add or update an entry in C =back 4 These paths can be adjusted by modifying C. =head1 BUGS Doesn't check for existence of temporary new password file. Unlikely to have any real impact but mentioned here for purity's sake. =head1 SEE ALSO L, L, L =head1 AUTHOR Copyright (C) 2002 Paul Makepeace This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut