git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v5 6/8] mingw: wrap SSL_set_(w|r)fd to call _get_osfhandle

From
Erik Faye-Lund <kusmabite@googlemail.com>
Date
Oct 21, 2009, 17:04 UTC
Message-ID
<1256144691-2908-7-git-send-email-kusmabite@gmail.com>
In-Reply-To
<1256144691-2908-6-git-send-email-kusmabite@gmail.com>

SSL_set_fd (and friends) expects a OS file handle on Windows, not a file descriptor as on UNIX(-ish).

This patch makes the Windows version of SSL_set_fd behave like the UNIX versions, by calling _get_osfhandle on it's input.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
---
 compat/mingw.h |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/compat/mingw.h b/compat/mingw.h
index 5b5258b..6907345 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -124,6 +124,27 @@ static inline int waitpid(pid_t pid, int *status, unsigned options)
 	return -1;
 }
 
+#ifndef NO_OPENSSL
+#include <openssl/ssl.h>
+static inline int mingw_SSL_set_fd(SSL *ssl, int fd)
+{
+	return SSL_set_fd(ssl, _get_osfhandle(fd));
+}
+#define SSL_set_fd mingw_SSL_set_fd
+
+static inline int mingw_SSL_set_rfd(SSL *ssl, int fd)
+{
+	return SSL_set_rfd(ssl, _get_osfhandle(fd));
+}
+#define SSL_set_rfd mingw_SSL_set_rfd
+
+static inline int mingw_SSL_set_wfd(SSL *ssl, int fd)
+{
+	return SSL_set_wfd(ssl, _get_osfhandle(fd));
+}
+#define SSL_set_wfd mingw_SSL_set_wfd
+#endif
+
 /*
  * implementations of missing functions
  */
-- 
1.6.4.msysgit.0
Previous: Erik Faye-LundNext: Erik Faye-Lund
Message 7 of 16 in “imap-send: Windows support”
  1. 0/8 imap-send: Windows supportErik Faye-Lund, Oct 21, 2009
  2. 1/8 imap-send: remove useless uid codeErik Faye-Lund, Oct 21, 2009
  3. 2/8 imap-send: use separate read and write fdsErik Faye-Lund, Oct 21, 2009
  4. 3/8 imap-send: use run-command API for tunnelingErik Faye-Lund, Oct 21, 2009
  5. 4/8 imap-send: fix compilation-error on WindowsErik Faye-Lund, Oct 21, 2009
  6. 5/8 imap-send: build imap-send on WindowsErik Faye-Lund, Oct 21, 2009
  7. 6/8 mingw: wrap SSL_set_(w|r)fd to call _get_osfhandleErik Faye-Lund, Oct 21, 2009
  8. 7/8 mingw: enable OpenSSLErik Faye-Lund, Oct 21, 2009
  9. 8/8 MSVC: Enable OpenSSL, and translate -lcryptoErik Faye-Lund, Oct 21, 2009
  10. Johannes SixtOct 22, 2009
  11. Johannes SchindelinOct 22, 2009
  12. Johannes SixtOct 22, 2009
  13. mingw: use BLK_SHA1 againJohannes Sixt, Oct 22, 2009
  14. Johannes SchindelinOct 26, 2009
  15. Johannes SixtOct 27, 2009
  16. Junio C HamanoOct 22, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.