
2010/11/22 Daniel P. Berrange <berrange@redhat.com>:
On Sat, Nov 20, 2010 at 06:10:21PM +0100, Matthias Bolte wrote:
gnulib wraps Windows' SOCKET handle based send() and recv() functions into file descriptor based ones that are use in libvirt. By default GnuTLS uses the SOCKET handle based send() and recv() on Windows. This makes gnutls_handshake() fail internally with a WSAENOTSOCK error because libvirt passes a file descriptor; GnuTLS needs the SOCKET handle.
This doesn't entirely make any sense to me. GNUTLS also uses GNULIB, including all its socket wrappers for send/recv. If the push/pull function is NULL, gnulib does this
if (session->internals._gnutls_push_func == NULL) { i = send (GNUTLS_POINTER_TO_INT (fd), &ptr[n - left], left, 0);
And this 'send' impl maps to GNULIBs replacement in GNUTLS tree, which is identical to libvirt's 'send' impl
So AFAICT, the syscall behaviour will be identical both with & without your proposed patch.
The only potential difference I can see is that when push/pull are NULL, GNUTLS calls into WSAGetLastError (); to set the errno which is somewhat redundant as GNULIB has already called that and used it to set errno.
Daniel
You're right GNUTLS uses GNULIB. I missed that fact. But why does my patch make a difference then? Without it the TLS transport doesn't work and with the patch it works. I'll have to investigate. Matthias