summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolker Schatz2015-06-08 23:40:47 +0200
committerVolker Schatz2015-06-08 23:40:47 +0200
commit28e6f19150b0ee58463e12f401a512f71c0e7889 (patch)
tree57b4eeecf9c9fab4de894bf0785bca1664dffa91
downloadaur-28e6f19150b0ee58463e12f401a512f71c0e7889.tar.gz
Initial import
-rw-r--r--.SRCINFO20
-rw-r--r--PKGBUILD50
-rw-r--r--tls-fixes.diff162
3 files changed, 232 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..3ad1d252edb
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,20 @@
+pkgbase = perl-net-smtp-tls
+ pkgdesc = Perl SMTP client supporting TLS and AUTH
+ pkgver = 0.12
+ pkgrel = 1
+ url = https://metacpan.org/release/Net-SMTP-TLS
+ arch = any
+ license = GPL
+ license = PerlArtistic
+ depends = perl
+ depends = perl-digest-hmac
+ depends = perl-io-socket-ssl
+ depends = perl-net-ssleay
+ options = !emptydirs
+ source = http://cpan.metacpan.org/authors/id/A/AW/AWESTHOLM/Net-SMTP-TLS-0.12.tar.gz
+ source = tls-fixes.diff
+ md5sums = a845eba3670e56a197ecd37f571d153a
+ md5sums = 6bd41774da31f07c7b60a28db6247922
+
+pkgname = perl-net-smtp-tls
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..d7e92b59793
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,50 @@
+# Maintainer: Volker Schatz <arch@my-name-without-hyphen.com>
+pkgname='perl-net-smtp-tls'
+_cpanname='Net-SMTP-TLS'
+pkgver='0.12'
+pkgrel='1'
+pkgdesc='Perl SMTP client supporting TLS and AUTH'
+arch=('any')
+url="https://metacpan.org/release/$_cpanname"
+license=('GPL' 'PerlArtistic')
+depends=('perl' 'perl-digest-hmac' 'perl-io-socket-ssl' 'perl-net-ssleay')
+options=('!emptydirs')
+source=("http://cpan.metacpan.org/authors/id/A/AW/AWESTHOLM/Net-SMTP-TLS-0.12.tar.gz"
+ "tls-fixes.diff")
+md5sums=('a845eba3670e56a197ecd37f571d153a'
+ '6bd41774da31f07c7b60a28db6247922')
+
+# Function to change to the working directory and set
+# environment variables to override undesired options.
+prepareEnvironment() {
+ cd "$srcdir/$_cpanname-$pkgver"
+ export \
+ PERL_MM_USE_DEFAULT=1 \
+ PERL_AUTOINSTALL=--skipdeps \
+ PERL_MM_OPT="INSTALLDIRS=vendor DESTDIR='$pkgdir'" \
+ PERL_MB_OPT="--installdirs vendor --destdir '$pkgdir'" \
+ MODULEBUILDRC=/dev/null
+}
+
+build() {
+ prepareEnvironment
+ /usr/bin/perl Makefile.PL
+ make
+
+ cd lib/Net/SMTP
+ patch < "$srcdir/tls-fixes.diff"
+}
+
+check() {
+ prepareEnvironment
+ make test
+}
+
+package() {
+ prepareEnvironment
+ make install
+
+ # Remove "perllocal.pod" and ".packlist".
+ find "$pkgdir" -name .packlist -o -name perllocal.pod -delete
+}
+
diff --git a/tls-fixes.diff b/tls-fixes.diff
new file mode 100644
index 00000000000..8820a8c501e
--- /dev/null
+++ b/tls-fixes.diff
@@ -0,0 +1,162 @@
+--- TLS.pm.orig 2006-01-17 15:36:34.000000000 +0100
++++ TLS.pm 2012-08-12 22:45:36.000000000 +0200
+@@ -52,6 +52,8 @@
+
+ Password - password for SMTP AUTH
+
++Debug - if true, print log of SMTP session to stdout
++
+ =back
+
+ =back
+@@ -114,6 +116,7 @@
+ or croak "Connect failed :$@\n";
+
+ my $me = bless \%args, $pkg;
++ print STDERR "Welcome to Net::SMTP::TLS - Debug is ON\n" if $me->{Debug};
+ # read the line immediately after connecting
+ my ($rsp,$txt) = $me->_response();
+ if(not $rsp == 220){
+@@ -129,6 +132,7 @@
+ sub _command {
+ my $me = shift;
+ my $command = shift;
++ print STDERR "> $command\n" if $me->{Debug};
+ $me->{sock}->printf($command."\015\012");
+ }
+
+@@ -137,6 +141,7 @@
+ sub _response {
+ my $me = shift;
+ my $line = $me->{sock}->getline();
++ print STDERR "< $line" if $me->{Debug};
+ my @rsp = ($line =~ /(\d+)(.)([^\r]*)/);
+ # reverse things so the seperator is at the end...
+ # that way we don't have to get fancy with the return
+@@ -173,13 +178,14 @@
+ # plain old socket into an SSL socket
+ sub starttls {
+ my $me = shift;
++ print STDERR "Starting TLS...\n" if $me->{Debug};
+ $me->_command("STARTTLS");
+ my ($num,$txt) = $me->_response();
+ if(not $num == 220){
+ croak "Invalid response for STARTTLS: $num $txt\n";
+ }
+ if(not IO::Socket::SSL::socket_to_SSL($me->{sock},
+- SSL_version => "SSLv3 TLSv1")){
++ SSL_version => "TLSv1")){
+ croak "Couldn't start TLS: ".IO::Socket::SSL::errstr."\n";
+ }
+ $me->hello();
+@@ -193,11 +199,15 @@
+ if(not $type){
+ croak "Server did not return AUTH in capabilities\n";
+ }
++ print STDERR "Supported AUTH methods: $type\n" if $me->{Debug};
+ if($type =~ /CRAM\-MD5/){
++ print STDERR "Using CRAM-MD5\n" if $me->{Debug};
+ $me->auth_MD5();
+ }elsif($type =~ /LOGIN/){
++ print STDERR "Using LOGIN\n" if $me->{Debug};
+ $me->auth_LOGIN();
+ }elsif($type =~ /PLAIN/){
++ print STDERR "Using PLAIN\n" if $me->{Debug};
+ $me->auth_PLAIN();
+ }else{
+ croak "Unsupported Authentication mechanism\n";
+@@ -223,6 +233,8 @@
+ if(not $num == 235){
+ croak "Auth failed: $num $txt\n";
+ }
++ print STDERR "Authentication of ", $me->{User}, " succeeded\n"
++ if $me->{Debug};
+ }
+
+ # use MD5 to login... gets the ticket from the text
+@@ -251,7 +263,7 @@
+ my $me = shift;
+ my $user= $me->{User};
+ my $pass= $me->{Password};
+- $me->_command(sprintf("AUTH PLAIN %S",
++ $me->_command(sprintf("AUTH PLAIN %s",
+ encode_base64("$user\0$user\0$pass","")));
+ my ($num,$txt) = $me->_response();
+ if(not $num == 235){
+@@ -278,6 +290,7 @@
+ if(not $num == 250){
+ croak "Could't set FROM: $num $txt\n";
+ }
++ return 1;
+ }
+
+ # send the RCPT TO: <addr> command
+@@ -295,6 +308,7 @@
+ croak "Couldn't send TO <$addr>: $num $txt\n";
+ }
+ }
++ return 1;
+ }
+
+ BEGIN {
+@@ -315,6 +329,13 @@
+ if(not $num == 354){
+ croak "Data failed: $num $txt\n";
+ }
++ # We try to send data as well, if we have additional parameters,
++ # since Net::SMTP does this.
++ if (scalar(@_)) {
++ $me->datasend(@_);
++ $me->dataend();
++ }
++ return 1;
+ }
+
+ # send stuff over raw (for use as message body)
+@@ -325,6 +346,8 @@
+
+ return 0 unless defined(fileno($cmd->{sock}));
+
++ print STDERR "Transmitting data...\n" if $cmd->{Debug};
++
+ my $last_ch = $cmd->{last_ch};
+ $last_ch = $cmd->{last_ch} = "\012" unless defined $last_ch;
+
+@@ -367,6 +390,7 @@
+ return undef;
+ }
+ $len -= $w;
++ $offset += $w;
+ }
+ else
+ {
+@@ -374,6 +398,7 @@
+ return undef;
+ }
+ }
++ return 1;
+
+ }
+
+@@ -381,11 +406,13 @@
+ # but a period on it.
+ sub dataend {
+ my $me = shift;
++ print STDERR "Concluding data...\n" if $me->{Debug};
+ $me->_command("\015\012.");
+ my ($num,$txt) = $me->_response();
+ if(not $num == 250){
+ croak "Couldn't send mail: $num $txt\n";
+ }
++ return 1;
+ }
+
+ # politely disconnect from the SMTP server.
+@@ -396,6 +423,7 @@
+ if(not $num == 221){
+ croak "An error occurred disconnecting from the mail server: $num $txt\n";
+ }
++ return 1;
+ }
+
+ 1;