Skip to content

Commit 9688071

Browse files
committed
Fix #80880: SSL_read on shutdown, ftp/proc_open
When `SSL_read()` after `SSL_shutdown()` fails with `SSL_ERROR_SYSCALL`, we should not warn about this, because it is likely caused by the peer having closed the connection without having sent a close_notify shutdown alert. Signed-off-by: Christoph M. Becker <cmbecker69@gmx.de> Closes GH-6803.
1 parent 50f4765 commit 9688071

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ PHP NEWS
1414
. Fixed bug #80024 (Duplication of info about inherited socket after pool
1515
removing). (Jakub Zelenka)
1616

17+
- FTP:
18+
. Fixed bug #80880 (SSL_read on shutdown, ftp/proc_open). (cmb, Jakub
19+
Zelenka)
20+
1721
- LibXML:
1822
. Fixed bug #73533 (Invalid memory access in php_libxml_xmlCheckUTF8). (cmb)
1923

ext/ftp/ftp.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1931,6 +1931,12 @@ static void ftp_ssl_shutdown(ftpbuf_t *ftp, php_socket_t fd, SSL *ssl_handle) {
19311931
/* SSL wants a write. Really odd. Let's bail out. */
19321932
done = 1;
19331933
break;
1934+
case SSL_ERROR_SYSCALL:
1935+
/* most likely the peer closed the connection without
1936+
sending a close_notify shutdown alert;
1937+
bail out to avoid raising a spurious warning */
1938+
done = 1;
1939+
break;
19341940
default:
19351941
if ((sslerror = ERR_get_error())) {
19361942
ERR_error_string_n(sslerror, buf, sizeof(buf));

0 commit comments

Comments
 (0)