Fixes a regression introduced in b8aaf86b2dbb8ecb3f7094cc40a0df89bb2add27
The poll function currently always returns 0 which signals to gnutls that no data is available. However this might not be the case. Using the default gnutls_system_recv_timeout function returns the expect value when data is available.
Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=51440
Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com --- dlls/secur32/schannel_gnutls.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/dlls/secur32/schannel_gnutls.c b/dlls/secur32/schannel_gnutls.c index bcf38e3f23f..ff678c6cee1 100644 --- a/dlls/secur32/schannel_gnutls.c +++ b/dlls/secur32/schannel_gnutls.c @@ -62,6 +62,8 @@ static void (*pgnutls_transport_set_pull_timeout_function)(gnutls_session_t, int (*)(gnutls_transport_ptr_t, unsigned int)); static void (*pgnutls_dtls_set_mtu)(gnutls_session_t, unsigned int);
+static int (*pgnutls_system_recv_timeout)(gnutls_transport_ptr_t, unsigned int); + /* Not present in gnutls version < 3.2.0. */ static int (*pgnutls_alpn_get_selected_protocol)(gnutls_session_t, gnutls_datum_t *); static int (*pgnutls_alpn_set_protocols)(gnutls_session_t, const gnutls_datum_t *, @@ -165,6 +167,12 @@ static void compat_gnutls_transport_set_pull_timeout_function(gnutls_session_t s FIXME("\n"); }
+static int compat_gnutls_system_recv_timeout(gnutls_transport_ptr_t ptr, unsigned int ms) +{ + FIXME("\n"); + return -1; +} + static int compat_gnutls_privkey_export_x509(gnutls_privkey_t privkey, gnutls_x509_privkey_t *key) { FIXME("\n"); @@ -292,7 +300,8 @@ static DWORD CDECL schan_get_enabled_protocols(void)
static int pull_timeout(gnutls_transport_ptr_t transport, unsigned int timeout) { - return 0; + TRACE("\n"); + return pgnutls_system_recv_timeout(transport, timeout); }
static BOOL CDECL schan_create_session(schan_session *session, schan_credentials *cred) @@ -1024,6 +1033,12 @@ static BOOL gnutls_initialize(void) WARN("gnutls_transport_set_pull_timeout_function not found\n"); pgnutls_transport_set_pull_timeout_function = compat_gnutls_transport_set_pull_timeout_function; } + + if (!(pgnutls_system_recv_timeout = dlsym(libgnutls_handle, "gnutls_system_recv_timeout"))) + { + WARN("gnutls_system_recv_timeout not found\n"); + pgnutls_system_recv_timeout = compat_gnutls_system_recv_timeout; + } if (!(pgnutls_alpn_set_protocols = dlsym(libgnutls_handle, "gnutls_alpn_set_protocols"))) { WARN("gnutls_alpn_set_protocols not found\n");
On Thu, 2021-07-15 at 07:45 +1000, Alistair Leslie-Hughes wrote:
The poll function currently always returns 0 which signals to gnutls that no data is available. However this might not be the case. Using the default gnutls_system_recv_timeout function returns the expect value when data is available.
gnutls_system_recv_timeout expects a file descriptor it can call select() on, typically a socket. Our transport is not a file descriptor.