Mail-Toaster

 view release on metacpan or  search on metacpan

bin/toaster_migrate.pl  view on Meta::CPAN

	       $0 domain example.com newhost.fqdn.com  (domain = vpopmail domain name)

";

	die "\n" unless ($dom and $host);
}

sub _check_my_cnf
{

    my ($homedir) = (getpwuid ($<))[7];

	unless ( $util->is_readable( "$homedir/.my.cnf" ) )
	{
		print "\nHey bubba, I need to connect to your MySQL server as the root or vpopmail user. To facilitate this, I expect a configured ~/.my.cnf file. This file format is the same as the mysql client uses and properly configured might look like this:

[mysql]
user       = vpopmail
pass       = superSecretReallySecurePasswordBecauseImSmart

Create that file now, make sure it's readable by the user only (chmod 0400 ~/.my.cnf), and then rerun this script.

contrib/swaks  view on Meta::CPAN

		  okey => 'add_header',                       type => 'list', },
		# replace header if exist, else add
		{ opts => ['header'],                         suffix => ':s',
		  okey => 'header',                           type => 'list', },
		# build options and dump
		{ opts => ['dump'],                           suffix => '',
		  okey => 'dump_args',                        type => 'scalar', },
		# attempt PIPELINING
		{ opts => ['pipeline'],                       suffix => '',
		  okey => 'pipeline',                         type => 'scalar', },
		# use getpwuid building -f
		{ opts => ['force-getpwuid'],                 suffix => '',
		  okey => 'force_getpwuid',                   type => 'scalar', },
		# argument is a raw XCLIENT string
		{ opts => ['xclient'],                        suffix => ':s',
		  okey => 'xclient_raw',                      type => 'scalar', },
		# if set, XCLIENT will proceed even if XCLIENT not advertised
		{ opts => ['xclient-optional'],               suffix => '',
		  okey => 'xclient_optional',                 type => 'scalar', },
		# proceed if xclient not offered, but fail if offered and not accepted
		{ opts => ['xclient-optional-strict'],        suffix => '',
		  okey => 'xclient_optional_strict',          type => 'scalar', },
		## xclient send by default after first helo, but can be sent almost anywhere (cf quit-after)

contrib/swaks  view on Meta::CPAN

		if (defined($o->{pipe_cmd}));
	if ($G::link{process}) { $G::link{type} = 'pipe';   }
	else                   { delete($G::link{process}); }

	# socket file, if one is specified
	$G::link{sockfile}   = $o->{socket} || interact("Socket File: ", '^.+$')
		if (defined($o->{socket}));
	if ($G::link{sockfile}) { $G::link{type} = 'socket-unix'; }
	else                    { delete($G::link{sockfile});     }

	my $user     = get_username($o->{force_getpwuid});
	my $hostname = get_hostname();

	# SMTP mail from
	$n{from}   = $o->{mail_from} || interact("From: ", '^.*$')
		if (defined($o->{mail_from}));
	$n{from} ||= ($hostname || ($G::server_only && $G::quit_after ne 'mail')
	              ? "$user\@$hostname"
	              : interact("From: ", '^.*$'));
	$n{from}   = '' if ($n{from} eq '<>');

contrib/swaks  view on Meta::CPAN

		$s .= "  auth_showpt = " . ($G::auth_showpt ? "TRUE" : "FALSE") . "\n";
		$s .= "  auth map    = " . join("\n".' 'x16,
		                           map { "$_ = ". join(', ', @{$G::auth_map_t{$_}}) } (keys %G::auth_map_t)) . "\n";
	}
	else { $s .= "no\n"; }
	
	return $G::running_state = $s;
}

sub get_username {
	my $force_getpwuid = shift;
	if ($^O eq 'MSWin32') {
		require Win32;
		return Win32::LoginName();
	}
	if ($force_getpwuid) {
		return (getpwuid($<))[0];
	}
	return $ENV{LOGNAME} || (getpwuid($<))[0];
}

sub get_date_string {
	return($G::date_string) if (length($G::date_string) > 0);

	my $et = time();
	my @l  = localtime($et);
	my $o  = 0;

	if (!avail("date_manip")) {

contrib/swaks  view on Meta::CPAN

=over 4

=item -t, --to [email-address[,email-address,...]]

Tells swaks to use argument(s) as the envelope-recipient for the email, or prompt for recipient if no argument provided.  If multiple recipients are provided and the recipient domain is needed to determine routing the domain of the last recipient pro...

There is no default value for this option.  If no recipients are provided via any means, user will be prompted to provide one interactively.  The only exception to this is if a --quit-after value is provided which will cause the smtp transaction to b...

=item -f, --from [email-address]

Use argument as envelope-sender for email, or prompt user if no argument specified.  The string <> can be supplied to mean the null sender.  If user does not specify a sender address a default value is used.  The domain-part of the default sender is ...

=item --ehlo, --lhlo, -h, --helo [helo-string]

String to use as argument to HELO/EHLO/LHLO command, or prompt use if no argument is specified.  If this option is not used a best guess at the fully-qualified domain name of the local host is used.  If the Sys::Hostname module, which is part of the ...

=item -q, --quit-after [stop-point]

Point at which the transaction should be stopped.  When the requested stopping point is reached in the transaction, and provided that swaks has not errored out prior to reaching it,  swaks will send "QUIT" and attempt to close the connection cleanly....

=over 4

contrib/swaks  view on Meta::CPAN

=item LMTPSA

LHLO, "-a -tls -p 24"

=back

=item --pipeline

If the remote server supports it, attempt SMTP PIPELINING (RFC 2920).  This is a younger option, if you experience problems with it please notify the author.  Potential problem areas include servers accepting DATA even though there were no valid reci...

=item --force-getpwuid

Tell swaks to use the getpwuid method of finding the default sender local-part instead of trying $LOGNAME first.

=back

=head1 TLS / ENCRYPTION

These are options related to encrypting the transaction.  These have been tested and confirmed to work with all three transport methods.  The Net::SSLeay module is used to perform encryption when it is requested.  If this module is not loadable swaks...

A local certificate is not required for a TLS connection to be negotiated.  However, some servers use client certificate checking to verify that the client is allowed to connect.  swaks can be told to use a specific local certificate through the use ...

=over 4

lib/Mail/Toaster/Mysql.pm  view on Meta::CPAN

    if ( $curs[1] > $mins[1] ) { return 1; }
    if ( $curs[2] > $mins[2] ) { return 1; }

    return 0;
}

sub parse_dot_file {

    my ( $self, $file, $start, $verbose ) = @_;

    my ($homedir) = ( getpwuid($REAL_USER_ID) )[7];
    my $dotfile = "$homedir/$file";

    return if ! -e $dotfile;

    if ( !-r $dotfile ) {
        carp "WARNING: parse_dot_file: can't read $dotfile!\n";
        return 0;
    }

    my %array;

lib/Mail/Toaster/Setup.pm  view on Meta::CPAN


    my $installed;

    # install via ports if selected
    if ( $OSNAME eq "freebsd" && $ver eq "port" ) {
        $self->freebsd->install_port( "clamav", flags => "BATCH=yes WITHOUT_LDAP=1");
        return $self->clamav_post_install;
    }

    # add the clamav user and group
    unless ( getpwuid($clamuser) ) {
        $self->group_add( 'clamav', '90' );
        $self->user_add( $clamuser, 90, 90 );
    }

    unless ( getpwnam($clamuser) ) {
        print "User clamav user installation FAILED, I cannot continue!\n";
        return 0;
    }

    # install via ports if selected

lib/Mail/Toaster/Utility.pm  view on Meta::CPAN


sub is_readable {
    my $self = shift;
    my $file = shift or die "missing file or dir name\n";
    my %p = validate( @_, { $self->get_std_opts } );

    my %args = ( verbose => $p{verbose}, fatal => $p{fatal} );

    -e $file or return $self->error( "$file does not exist.", %args);
    -r $file or return $self->error( "$file is not readable by you ("
            . getpwuid($>)
            . "). You need to fix this, using chown or chmod.", %args);

    return 1;
}

sub is_writable {
    my $self = shift;
    my $file = shift or die "missing file or dir name\n";

    my %p = validate( @_, { $self->get_std_opts } );
    my %args = $self->get_std_args( %p );

    my $nl = "\n";
    $nl = "<br>" if ( $ENV{GATEWAY_INTERFACE} );

    if ( !-e $file ) {

        my ( $base, $path, $suffix ) = fileparse($file);

        return $self->error( "is_writable: $path not writable by "
            . getpwuid($>)
            . "$nl$nl", %args) if (-e $path && !-w $path);
        return 1;
    }

    return $self->error( "  $file not writable by " . getpwuid($>) . "$nl$nl", frames=>2, %args ) if ! -w $file;

    $self->audit( "$file is writable" );
    return 1;
}

sub logfile_append {
    my $self = shift;
    my $file = shift or croak "missing filename!";
    my %p = validate( @_,
        {   'lines' => { type => ARRAYREF, optional => 0, },

t/Utility.t  view on Meta::CPAN


    my $url = "http://www.mail-toaster.org/etc/maildrop-qmail-domain";
    ok( $util->get_url( $url, fatal=>0 ), 'get_url' );
    ok( $util->get_url( $url, dir => $tmp, fatal=>0 ), 'get_url');
}

chdir($cwd);
print "\t\t  wd: " . Cwd::cwd . "\n" if $verbose;

# chown
my $uid = getpwuid($UID);
my $gid = getgrgid($GID);
my $root = 'root';
my $grep = $util->find_bin( 'grep' );
my $wheel = `$grep wheel /etc/group` ? 'wheel' : 'root';

SKIP: {
    skip "the temp file for file_ch* is missing!", 4 if ( !-f $rwtest );

    # this one should work
    ok( $util->chown( $rwtest,



( run in 0.435 second using v1.01-cache-2.11-cpan-8d75d55dd25 )