Skip to content

Commit

Permalink
Fix compilation for MingW
Browse files Browse the repository at this point in the history
  • Loading branch information
jjkeijser committed Jun 10, 2020
1 parent 712e9b8 commit 0fcda62
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 5 additions & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# connect-proxy
Make socket connection using SOCKS4/5, telnet HTTP or HTTPS tunnel.
Make socket connection using SOCKS4/5, telnet, HTTP or HTTPS tunnel.

*************************************************************************

Expand All @@ -8,6 +8,10 @@ QUICK START:
Unix:
gcc -o connect connect.c -lssl -lcrypto

Mingw:
x86_64-w64-mingw32-gcc -o connect.c connect.c -I../mingw/openssl-1.1.1g/include
-L../mingw/openssl-1.1.1g -lssl -lcrypto -lws2_32

*************************************************************************

The development version can be found here:
Expand Down
14 changes: 5 additions & 9 deletions connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,6 @@
#endif /* not ( not _WIN32 && not __CYGWIN32__) */
#endif /* !_WIN32 */

#ifdef _WIN32
#define ECONNRESET WSAECONNRESET
#endif /* _WI32 */

#include <openssl/ssl.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
Expand Down Expand Up @@ -307,7 +303,7 @@ static char *usage2 =
/* name of this program */
char *progname = NULL;
static char *progdesc = "connect --- simple relaying command via proxy.";
static char *revstr = "2.01";
static char *revstr = "2.02";

/* set of character for strspn() */
const char *digits = "0123456789";
Expand Down Expand Up @@ -2625,7 +2621,7 @@ sslread(char *buf, size_t size)
return 0; /* no error */
size--;

bzero(buf, size);
memset(buf, 0, size);

debug("sslread: bytes waiting: %d\n", SSL_pending(ssl));
ret = SSL_read(ssl, buf, size);
Expand Down Expand Up @@ -2970,14 +2966,14 @@ begin_https_relay( SOCKET s )
return START_ERROR;

/* get response */
bzero(buf, sizeof(buf));
bzero(sslbuf, sizeof(sslbuf));
memset(buf, 0, sizeof(buf));
memset(sslbuf, 0, sizeof(sslbuf));
if (ssl_line_input(buf, sizeof(buf)) < 0)
{
debug("failed to read https response, retry.\n");

/* retry (needed to work around certificate based auth) */
bzero(sslbuf, sizeof(sslbuf));
memset(sslbuf, 0, sizeof(sslbuf));
if (ssl_line_input(buf, sizeof(buf)) < 0)
debug("failed to read https response.\n");
}
Expand Down

0 comments on commit 0fcda62

Please sign in to comment.