[gnutls-devel] GnuTLS | set_read_funcs() breaks I/O on Windows (#757)

Development of GNU's TLS library gnutls-devel at lists.gnutls.org
Wed Apr 24 07:55:24 CEST 2019

New Issue was created.

Issue 757: https://gitlab.com/gnutls/gnutls/issues/757
Author:    LRN

## Description of problem:
GnuTLS code calls `set_read_funcs()` at some points. On non-Windows platforms that function is a no-op. On Windows it replaces session push and pull functions with `system_write()` and `system_read()`.
This means that even if the client code (such as GnuTLS's own `socket_open2()`) calls `gnutls_transport_set_push_function()` to set some custom push function, GnuTLS will later set it back to the defaults. Because `socket_open2()` also sets the transport ptr as a pointer to a custom struct that holds, among other things, the socket descriptor, using `system_*()` functions with that ptr leads to EBADF errors.

## Version of gnutls used:

## Distributor of gnutls (e.g., Ubuntu, Fedora, RHEL)

## How reproducible:

Steps to Reproduce:

 * Build GnuTLS with MinGW
 * run `gnutls-cli google.com`

## Actual results:
*** Fatal error: Error in the push function.
Could not connect to Bad file descriptor

## Expected results:
Something else.

## Also

It should be noted that `gnutls_init()` will also set session push and pull functions to `system_write()` and `system_read()`. At first glance it doesn't make sense for GnuTLS to do that *again* later on.

Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/issues/757
You're receiving this email because of your account on gitlab.com.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20190424/3a8ef2ba/attachment.html>

More information about the Gnutls-devel mailing list