summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org>2019-05-22 19:46:55 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2019-05-22 19:52:38 (GMT)
commit491151b751c965cbb1158588a09aa28cc19921f6 (patch) (side-by-side diff)
treecf324ac5030c1b29405cf032b1b00e81a36e2466
parent0d271c3709f7f3da81285925b670cdb85b90ccbd (diff)
downloadmailutils-491151b751c965cbb1158588a09aa28cc19921f6.tar.gz
mailutils-491151b751c965cbb1158588a09aa28cc19921f6.tar.bz2
Fix a bug in TLS read
This complements afda9ba4. Thanks to Rafael Fontenelle for helping locate the bug. * libmu_auth/tlsiostr.c (_tls_io_read): Handle GNUTLS_E_AGAIN and GNUTLS_E_INTERRUPTED. * libmailutils/stream/stream.c (mu_stream_seterr): EINTR is a transient error condition. * THANKS: Update.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--THANKS1
-rw-r--r--libmailutils/stream/stream.c1
-rw-r--r--libmu_auth/tlsiostr.c8
3 files changed, 7 insertions, 3 deletions
diff --git a/THANKS b/THANKS
index 8d1fff4..1a6884e 100644
--- a/THANKS
+++ b/THANKS
@@ -26,6 +26,7 @@ maks <maksqwe1@ukr.net>
Neil R. Ormos <ormos@ormos.org>
Olivier Bornet <Olivier.Bornet@smartdata.ch>
Pierre-Jean <lists@utroff.org>
+Rafael Fontenelle <rafaelff@gnome.org>
Robby Villegas <robby.villegas@gmail.com>
Ronan KERYELL <Ronan.Keryell@enstb.org>
Sam Roberts <sroberts@uniserve.com>
diff --git a/libmailutils/stream/stream.c b/libmailutils/stream/stream.c
index ca66d82..b45f2b1 100644
--- a/libmailutils/stream/stream.c
+++ b/libmailutils/stream/stream.c
@@ -97,6 +97,7 @@ mu_stream_seterr (struct _mu_stream *stream, int code, int perm)
{
case 0:
case EAGAIN:
+ case EINTR:
case ENOSYS:
case EINPROGRESS:
break;
diff --git a/libmu_auth/tlsiostr.c b/libmu_auth/tlsiostr.c
index 5bf4e96..bf05ca7 100644
--- a/libmu_auth/tlsiostr.c
+++ b/libmu_auth/tlsiostr.c
@@ -37,11 +37,13 @@ _tls_io_read (struct _mu_stream *stream, char *buf, size_t bufsize,
size_t *pnread)
{
struct _mu_tls_io_stream *sp = (struct _mu_tls_io_stream *) stream;
- int rc;
+ ssize_t rc;
if (sp->up->state != state_open)
return EINVAL;
- rc = gnutls_record_recv (sp->up->session, buf, bufsize);
+ do
+ rc = gnutls_record_recv (sp->up->session, buf, bufsize);
+ while (rc == GNUTLS_E_AGAIN || rc == GNUTLS_E_INTERRUPTED);
if (rc >= 0)
{
*pnread = rc;
@@ -56,7 +58,7 @@ _tls_io_write (struct _mu_stream *stream, const char *buf, size_t bufsize,
size_t *pnwrite)
{
struct _mu_tls_io_stream *sp = (struct _mu_tls_io_stream *) stream;
- int rc;
+ ssize_t rc;
if (sp->up->state != state_open)
return EINVAL;

Return to:

Send suggestions and report system problems to the System administrator.