Net-IMAP-Simple
view release on metacpan or search on metacpan
1.1899_05: Sun Jun 14 07:14:54 EDT 2009
- fixed t/test_server.pm (use IO::Socket::INET, not Net::TCP)
1.1899_04: Sat Jun 13 18:33:46 EDT 2009
- added deleted() from JIK <jik@kamens.brookline.ma.us>'s
patch.
1.1899_03: Sat Jun 13 17:05:55 EDT 2009
- added a connection class so we might reject connections
after the 4th, or whatever, and possibly solve ticket 30229
- banged my head on the IO::Socket::SSL wall for a while
- buu (#perl freenode) set me straight on something enabling
me to close 30229.
1.1899_02: Sat Jun 13 07:39:29 EDT 2009
- moved some tests around and fixed the manifests
- added support, docs and test for EXAMINE
1.1899_01: Fri Jun 12 22:06:36 EDT 2009
- man Coro is disaggreable in the shutdown epoch, it took a
fork, a setsid and another fork to disssociate the test from
after an otherwise successful select.
1.1810: Sat Jun 6 22:13:34 EDT 2009
- Started working on the tests. Net::IMAP::Simple doesn't
seem to be able to handle the results of a select command as
returned by Net::IMAP::Server. This may indicate other
problems with protocol compliance. I can't say definitley
for sure that it's ::Simple, but that's the most likely
suspect.
- Made the module pull in IO::Socket::SSL without needing to
involve another module that probably shouldn't be a whole
separate distribution anyway. Considering deprecating the
Net::IMAP::Simple::SSL for that reason, and because that
whole distribution is only 2 useful lines anyway.
1.1800: Thu Jun 4 21:44:59 EDT 2009
- jettero started pulling in his changes.
1.17 2006-10-11
- Beta/Developer release -> production
contrib/connectalot.pl view on Meta::CPAN
#!/usr/bin/perl
use strict;
use warnings;
use IO::Socket::INET;
use IO::Socket::SSL;
my $ppid = $$;
END { print "[$$] ", $$==$ppid ? "ppid ":"", "exit\n" };
print "[$$] ppid started\n";
$SIG{__WARN__} = sub { print "[$$] $_[0]" };
$SIG{__DIE__} = sub { print "[$$] $_[0]"; exit 0 };
my $class = $ENV{ca_use_ssl} ? "IO::Socket::SSL" : "IO::Socket::INET";
my $port = $ENV{ca_use_ssl} ? 19794 : 19795;
my @pids;
for( 1 .. 5 ) {
if( my $pid = fork ) {
push @pids, $pid;
} else {
print "[$$] start\n";
my $sock = $class->new(PeerAddr=>"localhost:$port", Timeout=>2) or die "couldn't bind: $@";
lib/Net/IMAP/Simple.pm view on Meta::CPAN
if( $opts{ssl_version} ) {
$self->{ssl_version} = $opts{ssl_version};
$opts{use_ssl} = 1;
}
$opts{use_ssl} = 1 if $opts{find_ssl_defaults};
if( $opts{use_ssl} ) {
eval {
require IO::Socket::SSL;
import IO::Socket::SSL;
"true";
} or croak "IO::Socket::SSL must be installed in order to use_ssl";
$self->{ssl_options} = [ eval {@{ $opts{ssl_options} }} ];
carp "ignoring ssl_options: $@" if $opts{ssl_options} and not @{ $self->{ssl_options} };
unless( @{ $self->{ssl_options} } ) {
if( $opts{find_ssl_defaults} ) {
my $nothing = 1;
for(qw(
/etc/ssl/certs/ca-certificates.crt
/etc/pki/tls/certs/ca-bundle.crt
/etc/ssl/ca-bundle.pem
/etc/ssl/certs/
)) {
if( -f $_ ) {
@{ $self->{ssl_options} } = (SSL_ca_file=>$_, SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_PEER());
$nothing = 0;
last;
} elsif( -d $_ ) {
@{ $self->{ssl_options} } = (SSL_ca_path=>$_, SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_PEER());
$nothing = 0;
last;
}
}
if( $nothing ) {
carp "couldn't find rational defaults for ssl verify. Choosing to not verify.";
@{ $self->{ssl_options} } = (SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE());
}
} else {
@{ $self->{ssl_options} } = (SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE());
}
}
}
if ( $opts{use_v6} ) {
eval {
require IO::Socket::INET6;
import IO::Socket::INET6;
"true";
lib/Net/IMAP/Simple.pm view on Meta::CPAN
return $sock;
}
sub _port { return $_[0]->{use_ssl} ? 993 : 143 }
sub _sock { return $_[0]->{sock} }
sub _count { return $_[0]->{count} }
sub _last { $_[0]->select unless exists $_[0]->{last}; return $_[0]->{last}||0 }
sub _timeout { return 90 }
sub _retry { return 1 }
sub _retry_delay { return 5 }
sub _sock_from { return $_[0]->{use_v6} ? 'IO::Socket::INET6' : $_[0]->{use_ssl} ? 'IO::Socket::SSL' : 'IO::Socket::INET' }
sub starttls {
my ($self) = @_;
require IO::Socket::SSL; import IO::Socket::SSL;
require Net::SSLeay; import Net::SSLeay;
# $self->{debug} = 1;
# warn "Processing STARTTLS command";
return $self->_process_cmd(
cmd => ['STARTTLS'],
final => sub {
Net::SSLeay::load_error_strings();
Net::SSLeay::SSLeay_add_ssl_algorithms();
Net::SSLeay::randomize();
my $startres = IO::Socket::SSL->start_SSL(
$self->{sock},
SSL_version => $self->{ssl_version} || "SSLv3 TLSv1",
SSL_startHandshake => 0,
);
unless ( $startres ) {
croak "Couldn't start TLS: " . IO::Socket::SSL::errstr() . "\n";
}
$self->_debug( caller, __LINE__, 'starttls', "TLS initialization done" ) if $self->{debug};
1;
},
# process => sub { push @lines, $_[0] if $_[0] =~ /^(?: \s+\S+ | [^:]+: )/x },
);
}
lib/Net/IMAP/Simple.pod view on Meta::CPAN
Wait (x) seconds before retrying a connection attempt
=item use_v6 => BOOL
If set to true, attempt to use IPv6 sockets rather than IPv4 sockets.
This option requires the L<IO::Socket::INET6> module
=item use_ssl => BOOL
If set to true, attempt to use L<IO::Socket::SSL> sockets rather than vanilla sockets.
Note that no attempt is made to check the certificate validity by default. This
is terrible personal security but matches the previous behavior of this module.
Please consider using C<find_ssl_defaults> below.
This option requires the L<IO::Socket::SSL> module
=item ssl_version => version
This should be one or more of the following (space separated): SSLv3 SSLv2
TLSv1. If you specify, for example, "SSLv3 SSLv2" then L<IO::Socket::SSL> will
attempt auto negotiation. At the time of this writing, the default string was
v3/v2 auto negotiation -- it may have changed by the time you read this.
Warning: setting this will also set C<use_ssl>.
=item find_ssl_defaults => []
Looks in some standard places for CA certificate libraries and if found sets
reasonable defaults along the lines of the following.
ssl_options => [ SSL_ca_path => "/etc/ssl/certs/",
SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_PEER() ]
Warning: setting this will also set C<use_ssl>.
=item ssl_options => []
You may provide your own L<IO::Socket::SSL> options if you desire to do so.
It is completely overridden by C<find_ssl_defaults> above.
=item bindaddr => str
Assign a local address to bind
=item use_select_cache => BOOL
Enable C<select()> caching internally
lib/Net/IMAP/Simple.pod view on Meta::CPAN
=head1 METHODS
=over 4
=item starttls
$imap->starttls;
If you start an IMAP session and wish to upgrade to SSL later, you can use this
function to start TLS. This function will try to C<require> L<IO::Socket::SSL>
and L<Net::SSLeay> at runtime.
=item login
my $inbox_msgs = $imap->login($user, $passwd);
This method takes two required parameters, a username and password. This pair is
authenticated against the server. If authentication is successful TRUE (1) will
be returned
lib/Net/IMAP/Simple.pod view on Meta::CPAN
=head1 BUGS
There are probably bugs. But don't worry, the current maintainer takes them
very seriously and will usually triage (at least) within a single day.
L<https://rt.cpan.org/Dist/Display.html?Queue=Net-IMAP-Simple>
=head1 SEE ALSO
L<perl>, L<Net::IMAP::Server>, L<IO::Socket::SSL>, L<IO::Socket::INET6>
( run in 0.263 second using v1.01-cache-2.11-cpan-05444aca049 )