From 929598fd00778a6d5e90acd80f68452cd93be0f7 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Mon, 3 Oct 2011 20:22:51 +0200 Subject: [PATCH] secur32: Properly handle GNUTLS_E_AGAIN in (GnuTLS) schan_imp_recv(). --- dlls/secur32/schannel_gnutls.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dlls/secur32/schannel_gnutls.c b/dlls/secur32/schannel_gnutls.c index e47c0227b7f..96fb471aec1 100644 --- a/dlls/secur32/schannel_gnutls.c +++ b/dlls/secur32/schannel_gnutls.c @@ -371,11 +371,23 @@ SECURITY_STATUS schan_imp_recv(schan_imp_session session, void *buffer, SIZE_T *length) { gnutls_session_t s = (gnutls_session_t)session; - ssize_t ret = pgnutls_record_recv(s, buffer, *length); + ssize_t ret; + +again: + ret = pgnutls_record_recv(s, buffer, *length); + if (ret >= 0) *length = ret; else if (ret == GNUTLS_E_AGAIN) + { + struct schan_transport *t = (struct schan_transport *)pgnutls_transport_get_ptr(s); + SIZE_T count = 0; + + if (schan_get_buffer(t, &t->in, &count)) + goto again; + return SEC_I_CONTINUE_NEEDED; + } else { pgnutls_perror(ret);