<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>
<style>img {
max-width: 100%; height: auto;
}
</style>
</head>
<body>
<div class="content">
<div></div>
<h2 dir="auto">
<a id="user-content-description-of-problem" class="anchor" href="#description-of-problem" aria-hidden="true"></a>Description of problem:</h2>
<p dir="auto">GnuTLS code calls <code>set_read_funcs()</code> at some points. On non-Windows platforms that function is a no-op. On Windows it replaces session push and pull functions with <code>system_write()</code> and <code>system_read()</code>.
This means that even if the client code (such as GnuTLS's own <code>socket_open2()</code>) calls <code>gnutls_transport_set_push_function()</code> to set some custom push function, GnuTLS will later set it back to the defaults. Because <code>socket_open2()</code> also sets the transport ptr as a pointer to a custom struct that holds, among other things, the socket descriptor, using <code>system_*()</code> functions with that ptr leads to EBADF errors.</p>
<h2 dir="auto">
<a id="user-content-version-of-gnutls-used" class="anchor" href="#version-of-gnutls-used" aria-hidden="true"></a>Version of gnutls used:</h2>
<p dir="auto">3.6.6</p>
<h2 dir="auto">
<a id="user-content-distributor-of-gnutls-eg-ubuntu-fedora-rhel" class="anchor" href="#distributor-of-gnutls-eg-ubuntu-fedora-rhel" aria-hidden="true"></a>Distributor of gnutls (e.g., Ubuntu, Fedora, RHEL)</h2>
<p dir="auto">Myself</p>
<h2 dir="auto">
<a id="user-content-how-reproducible" class="anchor" href="#how-reproducible" aria-hidden="true"></a>How reproducible:</h2>
<p dir="auto">Steps to Reproduce:</p>
<ul dir="auto">
<li>Build GnuTLS with MinGW</li>
<li>run <code>gnutls-cli google.com</code>
</li>
</ul>
<h2 dir="auto">
<a id="user-content-actual-results" class="anchor" href="#actual-results" aria-hidden="true"></a>Actual results:</h2>
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span id="LC1" class="line" lang="plaintext">*** Fatal error: Error in the push function.</span>
<span id="LC2" class="line" lang="plaintext">Could not connect to 74.125.131.101:443: Bad file descriptor</span></code></pre>
<h2 dir="auto">
<a id="user-content-expected-results" class="anchor" href="#expected-results" aria-hidden="true"></a>Expected results:</h2>
<p dir="auto">Something else.</p>
<h2 dir="auto">
<a id="user-content-also" class="anchor" href="#also" aria-hidden="true"></a>Also</h2>
<p dir="auto">It should be noted that <code>gnutls_init()</code> will also set session push and pull functions to <code>system_write()</code> and <code>system_read()</code>. At first glance it doesn't make sense for GnuTLS to do that <em>again</em> later on.</p>
</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #777;">
—
<br>
Reply to this email directly or <a href="https://gitlab.com/gnutls/gnutls/issues/757">view it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.com.
If you'd like to receive fewer emails, you can
<a href="https://gitlab.com/sent_notifications/787c920f8254f4a4add87501c63f69ff/unsubscribe">unsubscribe</a>
from this thread or
adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Issue","url":"https://gitlab.com/gnutls/gnutls/issues/757"}}</script>
</p>
</div>
</body>
</html>