diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2018-12-04 10:42:52 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2018-12-04 10:42:52 +0000 |
commit | 537489195ab43eb5db9c885679aee581bcee8c9a (patch) | |
tree | 8164ea54e3ca90ae62a09444aebb433292d3e550 /main | |
parent | ce9007b87415ef5859f2b19e5d252bcdad021e57 (diff) | |
download | aports-537489195ab43eb5db9c885679aee581bcee8c9a.tar.bz2 aports-537489195ab43eb5db9c885679aee581bcee8c9a.tar.xz |
main/perl-net-ssleay: add patches from fedora
those fixes perl-io-socket-ssl test suite
Diffstat (limited to 'main')
3 files changed, 301 insertions, 2 deletions
diff --git a/main/perl-net-ssleay/APKBUILD b/main/perl-net-ssleay/APKBUILD index fbd5090bd8..5d65f81b3a 100644 --- a/main/perl-net-ssleay/APKBUILD +++ b/main/perl-net-ssleay/APKBUILD @@ -3,7 +3,7 @@ pkgname=perl-net-ssleay _realname=Net-SSLeay pkgver=1.85 -pkgrel=2 +pkgrel=3 pkgdesc="Perl extension for using OpenSSL" url="http://search.cpan.org/dist/Net-SSLeay" arch="all" @@ -14,6 +14,8 @@ checkdepends="perl-test-exception perl-test-warn perl-test-nowarnings" subpackages="$pkgname-doc" source="http://search.cpan.org/CPAN/authors/id/M/MI/MIKEM/Net-SSLeay-$pkgver.tar.gz Net-SSLeay-1.85-Adapt-to-OpenSSL-1.1.1.patch + Net-SSLeay-1.85-Move-SSL_ERROR_WANT_READ-SSL_ERROR_WANT_WRITE-retry-.patch + Net-SSLeay-1.85-Move-SSL_ERROR_WANT_READ-SSL_ERROR_WANT_WRITE-retry-from_write_partial.patch " builddir="$srcdir/$_realname-$pkgver" @@ -37,4 +39,6 @@ package() { } sha512sums="74e0f2f56b707f1ff845c78c1fa7ce26a71b8f943bb99e994d4e065d1f42259fe4cd1a6a17d333459727534158f9541f116dbc8515122380807d9450b0faa26b Net-SSLeay-1.85.tar.gz -7abce82d34378c404bdfc1143a58b7f9eb9be197e4a8b5149ef5c0d28da8a8844e5fd9b0f287f1f01b31bbaa7658c1cb0fc22a1674283e1cbcb1a761b35c90bb Net-SSLeay-1.85-Adapt-to-OpenSSL-1.1.1.patch" +7abce82d34378c404bdfc1143a58b7f9eb9be197e4a8b5149ef5c0d28da8a8844e5fd9b0f287f1f01b31bbaa7658c1cb0fc22a1674283e1cbcb1a761b35c90bb Net-SSLeay-1.85-Adapt-to-OpenSSL-1.1.1.patch +776c925cb85df004b95f42b6cf83f8ebc5ab6b9a3048f4b1239bfddc255ad581d6698d43bae5ba0fd86bcbd77bfe36662698443bde8f8fac16e88e94dbc738a2 Net-SSLeay-1.85-Move-SSL_ERROR_WANT_READ-SSL_ERROR_WANT_WRITE-retry-.patch +d227dd780caee32e2e4c48d7536b399bf26514b1e081c514f6a2a80194fd9ec13ed264d652c840dcfcd723021b5370deebeabdc86f77e79395329bb80b710c53 Net-SSLeay-1.85-Move-SSL_ERROR_WANT_READ-SSL_ERROR_WANT_WRITE-retry-from_write_partial.patch" diff --git a/main/perl-net-ssleay/Net-SSLeay-1.85-Move-SSL_ERROR_WANT_READ-SSL_ERROR_WANT_WRITE-retry-.patch b/main/perl-net-ssleay/Net-SSLeay-1.85-Move-SSL_ERROR_WANT_READ-SSL_ERROR_WANT_WRITE-retry-.patch new file mode 100644 index 0000000000..aa4b33864b --- /dev/null +++ b/main/perl-net-ssleay/Net-SSLeay-1.85-Move-SSL_ERROR_WANT_READ-SSL_ERROR_WANT_WRITE-retry-.patch @@ -0,0 +1,225 @@ +From e0b42b0120b941b5675e4071445424dc8a1230e1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> +Date: Wed, 15 Aug 2018 14:46:52 +0200 +Subject: [PATCH] Move SSL_ERROR_WANT_READ/SSL_ERROR_WANT_WRITE retry from + read()/write() up +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Original OpenSSL 1.1.1 fix broke IO-Socket-SSL-2.058's t/core.t test +because it tests non-blocking socket operations and expects to see +SSL_ERROR_WANT_READ/SSL_ERROR_WANT_WRITE errors and to handle them +byt itself. + +This patch purifies Net::SSLeay::{read,write}() to behave exactly as +underlying OpenSSL functions. The retry is moved to +Net::SSLeay::ssl_read_all. All relevant Net::SSLeay::{read,write}() calls in +tests are changed into Net::SSLea::ssl_{read,write}_all(). + +All applications should implement the retry themsleves or use +ssl_*_all() instead. + +Signed-off-by: Petr Písař <ppisar@redhat.com> +--- + SSLeay.xs | 28 +++++++--------------------- + lib/Net/SSLeay.pm | 22 +++++++++++++++------- + t/local/07_sslecho.t | 12 ++++++------ + t/local/36_verify.t | 9 +++++---- + 4 files changed, 33 insertions(+), 38 deletions(-) + +diff --git a/SSLeay.xs b/SSLeay.xs +index 5aed4d7..7cb6eab 100644 +--- a/SSLeay.xs ++++ b/SSLeay.xs +@@ -1997,19 +1997,13 @@ SSL_read(s,max=32768) + PREINIT: + char *buf; + int got; ++ int succeeded = 1; + PPCODE: + New(0, buf, max, char); + +- do { +- int err; +- +- got = SSL_read(s, buf, max); +- if (got > 0) +- break; +- err = SSL_get_error(s, got); +- if (err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) +- break; +- } while (1); ++ got = SSL_read(s, buf, max); ++ if (got <= 0 && SSL_ERROR_ZERO_RETURN != SSL_get_error(s, got)) ++ succeeded = 0; + + /* If in list context, return 2-item list: + * first return value: data gotten, or undef on error (got<0) +@@ -2017,13 +2011,13 @@ SSL_read(s,max=32768) + */ + if (GIMME_V==G_ARRAY) { + EXTEND(SP, 2); +- PUSHs(sv_2mortal(got>=0 ? newSVpvn(buf, got) : newSV(0))); ++ PUSHs(sv_2mortal(succeeded ? newSVpvn(buf, got) : newSV(0))); + PUSHs(sv_2mortal(newSViv(got))); + + /* If in scalar or void context, return data gotten, or undef on error. */ + } else { + EXTEND(SP, 1); +- PUSHs(sv_2mortal(got>=0 ? newSVpvn(buf, got) : newSV(0))); ++ PUSHs(sv_2mortal(succeeded ? newSVpvn(buf, got) : newSV(0))); + } + + Safefree(buf); +@@ -2066,15 +2060,7 @@ SSL_write(s,buf) + INPUT: + char * buf = SvPV( ST(1), len); + CODE: +- do { +- ret = SSL_write (s, buf, (int)len); +- if (ret > 0) +- break; +- err = SSL_get_error(s, ret); +- if (err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) +- break; +- } while (1); +- RETVAL = ret; ++ RETVAL = SSL_write (s, buf, (int)len); + OUTPUT: + RETVAL + +diff --git a/lib/Net/SSLeay.pm b/lib/Net/SSLeay.pm +index 3adf12c..afc6c8f 100644 +--- a/lib/Net/SSLeay.pm ++++ b/lib/Net/SSLeay.pm +@@ -579,14 +579,22 @@ sub debug_read { + sub ssl_read_all { + my ($ssl,$how_much) = @_; + $how_much = 2000000000 unless $how_much; +- my ($got, $errs); ++ my ($got, $rv, $errs); + my $reply = ''; + + while ($how_much > 0) { +- $got = Net::SSLeay::read($ssl, ++ ($got, $rv) = Net::SSLeay::read($ssl, + ($how_much > 32768) ? 32768 : $how_much + ); +- last if $errs = print_errs('SSL_read'); ++ if (! defined $got) { ++ my $err = Net::SSLeay::get_error($ssl, $rv); ++ if ($err != Net::SSLeay::ERROR_WANT_READ() and ++ $err != Net::SSLeay::ERROR_WANT_WRITE()) { ++ $errs = print_errs('SSL_read'); ++ last; ++ } ++ next; ++ } + $how_much -= blength($got); + debug_read(\$reply, \$got) if $trace>1; + last if $got eq ''; # EOF +@@ -839,14 +847,14 @@ sub ssl_read_until ($;$$) { + $found = index($match, $delim); + + if ($found > -1) { +- #$got = Net::SSLeay::read($ssl, $found+$len_delim); ++ #$got = Net::SSLeay::ssl_read_all($ssl, $found+$len_delim); + #read up to the end of the delimiter +- $got = Net::SSLeay::read($ssl, ++ $got = Net::SSLeay::ssl_read_all($ssl, + $found + $len_delim + - ((blength($match)) - (blength($got)))); + $done = 1; + } else { +- $got = Net::SSLeay::read($ssl, $peek_length); ++ $got = Net::SSLeay::ssl_read_all($ssl, $peek_length); + $done = 1 if ($peek_length == $max_length - blength($reply)); + } + +@@ -857,7 +865,7 @@ sub ssl_read_until ($;$$) { + } + } else { + while (!defined $max_length || length $reply < $max_length) { +- $got = Net::SSLeay::read($ssl,1); # one by one ++ $got = Net::SSLeay::ssl_read_all($ssl,1); # one by one + last if print_errs('SSL_read'); + debug_read(\$reply, \$got) if $trace>1; + last if $got eq ''; +diff --git a/t/local/07_sslecho.t b/t/local/07_sslecho.t +index 74e317a..7f19027 100644 +--- a/t/local/07_sslecho.t ++++ b/t/local/07_sslecho.t +@@ -134,10 +134,10 @@ my @results; + + push @results, [ Net::SSLeay::get_cipher($ssl), 'get_cipher' ]; + +- push @results, [ Net::SSLeay::write($ssl, $msg), 'write' ]; ++ push @results, [ Net::SSLeay::ssl_write_all($ssl, $msg), 'write' ]; + shutdown($s, 1); + +- my ($got) = Net::SSLeay::read($ssl); ++ my $got = Net::SSLeay::ssl_read_all($ssl); + push @results, [ $got eq uc($msg), 'read' ]; + + Net::SSLeay::free($ssl); +@@ -177,7 +177,7 @@ my @results; + Net::SSLeay::set_fd($ssl, fileno($s)); + Net::SSLeay::connect($ssl); + +- Net::SSLeay::write($ssl, $msg); ++ Net::SSLeay::ssl_write_all($ssl, $msg); + + shutdown $s, 2; + close $s; +@@ -231,15 +231,15 @@ my @results; + Net::SSLeay::set_fd($ssl3, $s3); + + Net::SSLeay::connect($ssl1); +- Net::SSLeay::write($ssl1, $msg); ++ Net::SSLeay::ssl_write_all($ssl1, $msg); + shutdown $s1, 2; + + Net::SSLeay::connect($ssl2); +- Net::SSLeay::write($ssl2, $msg); ++ Net::SSLeay::ssl_write_all($ssl2, $msg); + shutdown $s2, 2; + + Net::SSLeay::connect($ssl3); +- Net::SSLeay::write($ssl3, $msg); ++ Net::SSLeay::ssl_write_all($ssl3, $msg); + shutdown $s3, 2; + + close $s1; +diff --git a/t/local/36_verify.t b/t/local/36_verify.t +index 2837288..b04be13 100644 +--- a/t/local/36_verify.t ++++ b/t/local/36_verify.t +@@ -252,8 +252,9 @@ sub client { + Net::SSLeay::set_fd($ssl, $cl); + Net::SSLeay::connect($ssl); + my $end = "end"; +- Net::SSLeay::write($ssl, $end); +- ok($end eq Net::SSLeay::read($ssl), 'Successful termination'); ++ Net::SSLeay::ssl_write_all($ssl, $end); ++ Net::SSLeay::shutdown($ssl); ++ ok($end eq Net::SSLeay::ssl_read_all($ssl), 'Successful termination'); + return; + } + +@@ -291,10 +292,10 @@ sub run_server + next unless $ret == 1; + + # Termination request or other message from client +- my $msg = Net::SSLeay::read($ssl); ++ my $msg = Net::SSLeay::ssl_read_all($ssl); + if (defined $msg and $msg eq 'end') + { +- Net::SSLeay::write($ssl, 'end'); ++ Net::SSLeay::ssl_write_all($ssl, 'end'); + exit (0); + } + } +-- +2.14.4 + diff --git a/main/perl-net-ssleay/Net-SSLeay-1.85-Move-SSL_ERROR_WANT_READ-SSL_ERROR_WANT_WRITE-retry-from_write_partial.patch b/main/perl-net-ssleay/Net-SSLeay-1.85-Move-SSL_ERROR_WANT_READ-SSL_ERROR_WANT_WRITE-retry-from_write_partial.patch new file mode 100644 index 0000000000..2f8a1d2511 --- /dev/null +++ b/main/perl-net-ssleay/Net-SSLeay-1.85-Move-SSL_ERROR_WANT_READ-SSL_ERROR_WANT_WRITE-retry-from_write_partial.patch @@ -0,0 +1,70 @@ +From 122c80853a9bd66f21699fc79a689b3028d00d3b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> +Date: Fri, 17 Aug 2018 13:08:44 +0200 +Subject: [PATCH] Move SSL_ERROR_WANT_READ/SSL_ERROR_WANT_WRITE retry from + write_partial() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Original OpenSSL 1.1.1 fix broke IO-Socket-SSL-2.058's t/nonblock.t test +because it tests non-blocking socket operations and expects to see +SSL_ERROR_WANT_WRITE errors and to handle them byt itself. + +This patch purifies Net::SSLeay::write_partial() to behave exactly as +underlying OpenSSL SSL_write() function. The retry is already +presented in Net::SSLeay::ssl_write_all(). + +All applications should implement the retry themsleves or use +ssl_*_all() instead. + +Signed-off-by: Petr Písař <ppisar@redhat.com> +--- + SSLeay.xs | 16 ++-------------- + lib/Net/SSLeay.pod | 3 ++- + 2 files changed, 4 insertions(+), 15 deletions(-) + +diff --git a/SSLeay.xs b/SSLeay.xs +index 7cb6eab..fc7677f 100644 +--- a/SSLeay.xs ++++ b/SSLeay.xs +@@ -2089,20 +2089,8 @@ SSL_write_partial(s,from,count,buf) + if (len < 0) { + croak("from beyound end of buffer"); + RETVAL = -1; +- } else { +- int ret; +- int err; +- +- do { +- ret = SSL_write (s, &(buf[from]), (count<=len)?count:len); +- if (ret > 0) +- break; +- err = SSL_get_error(s, ret); +- if (err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) +- break; +- } while (1); +- RETVAL = ret; +- } ++ } else ++ RETVAL = SSL_write (s, &(buf[from]), (count<=len)?count:len); + OUTPUT: + RETVAL + +diff --git a/lib/Net/SSLeay.pod b/lib/Net/SSLeay.pod +index bca7be4..8b5f738 100644 +--- a/lib/Net/SSLeay.pod ++++ b/lib/Net/SSLeay.pod +@@ -4819,7 +4819,8 @@ Check openssl doc L<http://www.openssl.org/docs/ssl/SSL_write.html|http://www.op + + B<NOTE:> Does not exactly correspond to any low level API function + +-Writes a fragment of data in $data from the buffer $data into the specified $ssl connection. ++Writes a fragment of data in $data from the buffer $data into the specified ++$ssl connection. This is a non-blocking function like L<Net::SSLeay::write()>. + + my $rv = Net::SSLeay::write_partial($ssl, $from, $count, $data); + # $ssl - value corresponding to openssl's SSL structure +-- +2.14.4 + |