diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-06-19 07:19:42 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:18:30 -0500 |
commit | 28fd9ea80befe049ee786a9e4c7454181a576e9a (patch) | |
tree | 57baaf91df2167727885a40ebc24538f0bb6c977 /source4/lib/tls | |
parent | 822498b7f536e4c4e552c524b14d6cb691ec5b62 (diff) | |
download | samba-28fd9ea80befe049ee786a9e4c7454181a576e9a.tar.gz samba-28fd9ea80befe049ee786a9e4c7454181a576e9a.tar.bz2 samba-28fd9ea80befe049ee786a9e4c7454181a576e9a.zip |
r7745: better handling of recv errors in tls library
(This used to be commit 42d8a1a222430bd64962da7cc4ac0193b5c003f7)
Diffstat (limited to 'source4/lib/tls')
-rw-r--r-- | source4/lib/tls/tls.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source4/lib/tls/tls.c b/source4/lib/tls/tls.c index 3b166b27a0..8f443c67d7 100644 --- a/source4/lib/tls/tls.c +++ b/source4/lib/tls/tls.c @@ -69,9 +69,19 @@ static ssize_t tls_pull(gnutls_transport_ptr ptr, void *buf, size_t size) } status = socket_recv(tls->socket, buf, size, &nread, 0); + if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) { + return 0; + } + if (NT_STATUS_IS_ERR(status)) { + EVENT_FD_NOT_READABLE(tls->fde); + EVENT_FD_NOT_WRITEABLE(tls->fde); + errno = EBADF; + return -1; + } if (!NT_STATUS_IS_OK(status)) { EVENT_FD_READABLE(tls->fde); EVENT_FD_NOT_WRITEABLE(tls->fde); + errno = EAGAIN; return -1; } if (tls->output_pending) { @@ -185,7 +195,6 @@ NTSTATUS tls_socket_recv(struct tls_context *tls, void *buf, size_t wantlen, return STATUS_MORE_ENTRIES; } if (ret < 0) { - DEBUG(0,("gnutls_record_recv failed - %s\n", gnutls_strerror(ret))); return NT_STATUS_UNEXPECTED_NETWORK_ERROR; } *nread = ret; |