[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r8425: addded diff -u's (bsockets/trunk/contrib/tor/src/common)



Author: chiussi
Date: 2006-09-19 14:53:34 -0400 (Tue, 19 Sep 2006)
New Revision: 8425

Added:
   bsockets/trunk/contrib/tor/src/common/Makefile.am.diff
Modified:
   bsockets/trunk/contrib/tor/src/common/bio_bsock.c
   bsockets/trunk/contrib/tor/src/common/compat.c.diff
   bsockets/trunk/contrib/tor/src/common/compat.h.diff
   bsockets/trunk/contrib/tor/src/common/tortls.c.diff
Log:
addded diff -u's


Added: bsockets/trunk/contrib/tor/src/common/Makefile.am.diff
===================================================================
--- bsockets/trunk/contrib/tor/src/common/Makefile.am.diff	2006-09-19 17:47:16 UTC (rev 8424)
+++ bsockets/trunk/contrib/tor/src/common/Makefile.am.diff	2006-09-19 18:53:34 UTC (rev 8425)
@@ -0,0 +1,10 @@
+--- Makefile.am.old	Tue Sep 19 13:43:11 2006
++++ Makefile.am	Sun Sep 10 10:24:42 2006
+@@ -4,6 +4,6 @@
+ #CFLAGS  = -Wall -Wpointer-arith -O2
+ 
+ libor_a_SOURCES = log.c util.c compat.c container.c
+-libor_crypto_a_SOURCES = crypto.c aes.c tortls.c torgzip.c
++libor_crypto_a_SOURCES = crypto.c aes.c tortls.c torgzip.c bio_bsock.c
+ 
+ noinst_HEADERS = log.h crypto.h test.h util.h compat.h aes.h torint.h tortls.h strlcpy.c strlcat.c torgzip.h container.h ht.h


Property changes on: bsockets/trunk/contrib/tor/src/common/Makefile.am.diff
___________________________________________________________________
Name: svn:executable
   + *

Modified: bsockets/trunk/contrib/tor/src/common/bio_bsock.c
===================================================================
--- bsockets/trunk/contrib/tor/src/common/bio_bsock.c	2006-09-19 17:47:16 UTC (rev 8424)
+++ bsockets/trunk/contrib/tor/src/common/bio_bsock.c	2006-09-19 18:53:34 UTC (rev 8425)
@@ -1,3 +1,59 @@
+/* Copyright (C) 1995-1998 Eric Young (eay@xxxxxxxxxxxxx)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@xxxxxxxxxxxxx).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@xxxxxxxxxxxxx).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@xxxxxxxxxxxxx)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@xxxxxxxxxxxxx)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
 
 #include <stdio.h>
 #include <errno.h>

Modified: bsockets/trunk/contrib/tor/src/common/compat.c.diff
===================================================================
--- bsockets/trunk/contrib/tor/src/common/compat.c.diff	2006-09-19 17:47:16 UTC (rev 8424)
+++ bsockets/trunk/contrib/tor/src/common/compat.c.diff	2006-09-19 18:53:34 UTC (rev 8425)
@@ -1,185 +1,222 @@
-4c4
-< /* $Id: compat.c 8387 2006-09-14 04:53:42Z weasel $ */
----
-> /* $Id: compat.c 8327 2006-09-06 08:42:20Z nickm $ */
-6c6
-<   "$Id: compat.c 8387 2006-09-14 04:53:42Z weasel $";
----
->   "$Id: compat.c 8327 2006-09-06 08:42:20Z nickm $";
-105a106,107
-> #include <bsocket.h>
-> 
-133c135
-<   size += (size%page_size) ? page_size-(size%page_size) : 0;
----
->   size += (page_size + (page_size-(size%page_size)));
-428,433c430,435
-< #ifdef MS_WINDOWS
-<   unsigned long nonblocking = 1;
-<   ioctlsocket(socket, FIONBIO, (unsigned long*) &nonblocking);
-< #else
-<   fcntl(socket, F_SETFL, O_NONBLOCK);
-< #endif
----
-> //#ifdef MS_WINDOWS
-> //  unsigned long nonblocking = 1;
-> //  ioctlsocket(socket, FIONBIO, (unsigned long*) &nonblocking);
-> //#else
->   bfcntl(socket, F_SETFL, O_NONBLOCK);
-> //#endif
-456,554c458
-< //don't use win32 socketpairs (they are always bad)
-< #if defined(HAVE_SOCKETPAIR) && !defined(MS_WINDOWS)
-<   int r;
-<   r = socketpair(family, type, protocol, fd);
-<   return r < 0 ? -errno : r;
-< #else
-<     /* This socketpair does not work when localhost is down. So
-<      * it's really not the same thing at all. But it's close enough
-<      * for now, and really, when localhost is down sometimes, we
-<      * have other problems too.
-<      */
-<     int listener = -1;
-<     int connector = -1;
-<     int acceptor = -1;
-<     struct sockaddr_in listen_addr;
-<     struct sockaddr_in connect_addr;
-<     int size;
-<     int saved_errno = -1;
-< 
-<     if (protocol
-< #ifdef AF_UNIX
-<         || family != AF_UNIX
-< #endif
-<         ) {
-< #ifdef MS_WINDOWS
-<       return -WSAEAFNOSUPPORT;
-< #else
-<       return -EAFNOSUPPORT;
-< #endif
-<     }
-<     if (!fd) {
-<       return -EINVAL;
-<     }
-< 
-<     listener = socket(AF_INET, type, 0);
-<     if (listener < 0)
-<       return -tor_socket_errno(-1);
-<     memset(&listen_addr, 0, sizeof(listen_addr));
-<     listen_addr.sin_family = AF_INET;
-<     listen_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-<     listen_addr.sin_port = 0;   /* kernel chooses port.  */
-<     if (bind(listener, (struct sockaddr *) &listen_addr, sizeof (listen_addr))
-<         == -1)
-<       goto tidy_up_and_fail;
-<     if (listen(listener, 1) == -1)
-<       goto tidy_up_and_fail;
-< 
-<     connector = socket(AF_INET, type, 0);
-<     if (connector < 0)
-<       goto tidy_up_and_fail;
-<     /* We want to find out the port number to connect to.  */
-<     size = sizeof(connect_addr);
-<     if (getsockname(listener, (struct sockaddr *) &connect_addr, &size) == -1)
-<       goto tidy_up_and_fail;
-<     if (size != sizeof (connect_addr))
-<       goto abort_tidy_up_and_fail;
-<     if (connect(connector, (struct sockaddr *) &connect_addr,
-<                 sizeof(connect_addr)) == -1)
-<       goto tidy_up_and_fail;
-< 
-<     size = sizeof(listen_addr);
-<     acceptor = accept(listener, (struct sockaddr *) &listen_addr, &size);
-<     if (acceptor < 0)
-<       goto tidy_up_and_fail;
-<     if (size != sizeof(listen_addr))
-<       goto abort_tidy_up_and_fail;
-<     tor_close_socket(listener);
-<     /* Now check we are talking to ourself by matching port and host on the
-<        two sockets.  */
-<     if (getsockname(connector, (struct sockaddr *) &connect_addr, &size) == -1)
-<       goto tidy_up_and_fail;
-<     if (size != sizeof (connect_addr)
-<         || listen_addr.sin_family != connect_addr.sin_family
-<         || listen_addr.sin_addr.s_addr != connect_addr.sin_addr.s_addr
-<         || listen_addr.sin_port != connect_addr.sin_port) {
-<       goto abort_tidy_up_and_fail;
-<     }
-<     fd[0] = connector;
-<     fd[1] = acceptor;
-< 
-<     return 0;
-< 
-<   abort_tidy_up_and_fail:
-< #ifdef MS_WINDOWS
-<     saved_errno = WSAECONNABORTED;
-< #else
-<     saved_errno = ECONNABORTED; /* I hope this is portable and appropriate.  */
-< #endif
-<   tidy_up_and_fail:
-<     if (saved_errno < 0)
-<       saved_errno = errno;
-<     if (listener != -1)
-<       tor_close_socket(listener);
-<     if (connector != -1)
-<       tor_close_socket(connector);
-<     if (acceptor != -1)
-<       tor_close_socket(acceptor);
-<     return -saved_errno;
-< #endif
----
-> 	return bsocketpair(family,type,protocol,fd);
-1236,1250c1140,1154
-< #ifdef MS_WINDOWS
-< int
-< tor_socket_errno(int sock)
-< {
-<   int optval, optvallen=sizeof(optval);
-<   int err = WSAGetLastError();
-<   if (err == WSAEWOULDBLOCK && sock >= 0) {
-<     if (getsockopt(sock, SOL_SOCKET, SO_ERROR, (void*)&optval, &optvallen))
-<       return err;
-<     if (optval)
-<       return optval;
-<   }
-<   return err;
-< }
-< #endif
----
-> //#ifdef MS_WINDOWS
-> //int
-> //tor_socket_errno(int sock)
-> //{
-> //  int optval, optvallen=sizeof(optval);
-> //  int err = WSAGetLastError();
-> //  if (err == WSAEWOULDBLOCK && sock >= 0) {
-> //    if (bgetsockopt(sock, SOL_SOCKET, SO_ERROR, (void*)&optval, &optvallen))
-> //      return err;
-> //    if (optval)
-> //      return optval;
-> //  }
-> //  return err;
-> //}
-> //a#endif
-1316,1325c1220,1229
-< const char *
-< tor_socket_strerror(int e)
-< {
-<   int i;
-<   for (i=0; windows_socket_errors[i].code >= 0; ++i) {
-<     if (e == windows_socket_errors[i].code)
-<       return windows_socket_errors[i].msg;
-<   }
-<   return strerror(e);
-< }
----
-> //const char *
-> //tor_socket_strerror(int e)
-> //{
-> //  int i;
-> //  for (i=0; windows_socket_errors[i].code >= 0; ++i) {
-> //    if (e == windows_socket_errors[i].code)
-> //      return windows_socket_errors[i].msg;
-> //  }
-> //  return strerror(e);
-> //}
+--- compat.c.old	Tue Sep 19 13:43:11 2006
++++ compat.c	Mon Sep 11 04:54:53 2006
+@@ -1,9 +1,9 @@
+ /* Copyright 2003-2004 Roger Dingledine
+  * Copyright 2004-2006 Roger Dingledine, Nick Mathewson */
+ /* See LICENSE for licensing information */
+-/* $Id: compat.c 8387 2006-09-14 04:53:42Z weasel $ */
++/* $Id: compat.c 8327 2006-09-06 08:42:20Z nickm $ */
+ const char compat_c_id[] =
+-  "$Id: compat.c 8387 2006-09-14 04:53:42Z weasel $";
++  "$Id: compat.c 8327 2006-09-06 08:42:20Z nickm $";
+ 
+ /**
+  * \file compat.c
+@@ -103,6 +103,8 @@
+ #include "strlcat.c"
+ #endif
+ 
++#include <bsocket.h>
++
+ /* used by inet_addr, not defined on solaris anywhere!? */
+ #ifndef INADDR_NONE
+ #define INADDR_NONE ((unsigned long) -1)
+@@ -130,7 +132,7 @@
+   lseek(fd, 0, SEEK_SET);
+   /* ensure page alignment */
+   page_size = getpagesize();
+-  size += (size%page_size) ? page_size-(size%page_size) : 0;
++  size += (page_size + (page_size-(size%page_size)));
+ 
+   string = mmap(0, size, PROT_READ, MAP_PRIVATE, fd, 0);
+   if (string == MAP_FAILED) {
+@@ -425,12 +427,12 @@
+ void
+ set_socket_nonblocking(int socket)
+ {
+-#ifdef MS_WINDOWS
+-  unsigned long nonblocking = 1;
+-  ioctlsocket(socket, FIONBIO, (unsigned long*) &nonblocking);
+-#else
+-  fcntl(socket, F_SETFL, O_NONBLOCK);
+-#endif
++//#ifdef MS_WINDOWS
++//  unsigned long nonblocking = 1;
++//  ioctlsocket(socket, FIONBIO, (unsigned long*) &nonblocking);
++//#else
++  bfcntl(socket, F_SETFL, O_NONBLOCK);
++//#endif
+ }
+ 
+ /**
+@@ -453,105 +455,7 @@
+ int
+ tor_socketpair(int family, int type, int protocol, int fd[2])
+ {
+-//don't use win32 socketpairs (they are always bad)
+-#if defined(HAVE_SOCKETPAIR) && !defined(MS_WINDOWS)
+-  int r;
+-  r = socketpair(family, type, protocol, fd);
+-  return r < 0 ? -errno : r;
+-#else
+-    /* This socketpair does not work when localhost is down. So
+-     * it's really not the same thing at all. But it's close enough
+-     * for now, and really, when localhost is down sometimes, we
+-     * have other problems too.
+-     */
+-    int listener = -1;
+-    int connector = -1;
+-    int acceptor = -1;
+-    struct sockaddr_in listen_addr;
+-    struct sockaddr_in connect_addr;
+-    int size;
+-    int saved_errno = -1;
+-
+-    if (protocol
+-#ifdef AF_UNIX
+-        || family != AF_UNIX
+-#endif
+-        ) {
+-#ifdef MS_WINDOWS
+-      return -WSAEAFNOSUPPORT;
+-#else
+-      return -EAFNOSUPPORT;
+-#endif
+-    }
+-    if (!fd) {
+-      return -EINVAL;
+-    }
+-
+-    listener = socket(AF_INET, type, 0);
+-    if (listener < 0)
+-      return -tor_socket_errno(-1);
+-    memset(&listen_addr, 0, sizeof(listen_addr));
+-    listen_addr.sin_family = AF_INET;
+-    listen_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+-    listen_addr.sin_port = 0;   /* kernel chooses port.  */
+-    if (bind(listener, (struct sockaddr *) &listen_addr, sizeof (listen_addr))
+-        == -1)
+-      goto tidy_up_and_fail;
+-    if (listen(listener, 1) == -1)
+-      goto tidy_up_and_fail;
+-
+-    connector = socket(AF_INET, type, 0);
+-    if (connector < 0)
+-      goto tidy_up_and_fail;
+-    /* We want to find out the port number to connect to.  */
+-    size = sizeof(connect_addr);
+-    if (getsockname(listener, (struct sockaddr *) &connect_addr, &size) == -1)
+-      goto tidy_up_and_fail;
+-    if (size != sizeof (connect_addr))
+-      goto abort_tidy_up_and_fail;
+-    if (connect(connector, (struct sockaddr *) &connect_addr,
+-                sizeof(connect_addr)) == -1)
+-      goto tidy_up_and_fail;
+-
+-    size = sizeof(listen_addr);
+-    acceptor = accept(listener, (struct sockaddr *) &listen_addr, &size);
+-    if (acceptor < 0)
+-      goto tidy_up_and_fail;
+-    if (size != sizeof(listen_addr))
+-      goto abort_tidy_up_and_fail;
+-    tor_close_socket(listener);
+-    /* Now check we are talking to ourself by matching port and host on the
+-       two sockets.  */
+-    if (getsockname(connector, (struct sockaddr *) &connect_addr, &size) == -1)
+-      goto tidy_up_and_fail;
+-    if (size != sizeof (connect_addr)
+-        || listen_addr.sin_family != connect_addr.sin_family
+-        || listen_addr.sin_addr.s_addr != connect_addr.sin_addr.s_addr
+-        || listen_addr.sin_port != connect_addr.sin_port) {
+-      goto abort_tidy_up_and_fail;
+-    }
+-    fd[0] = connector;
+-    fd[1] = acceptor;
+-
+-    return 0;
+-
+-  abort_tidy_up_and_fail:
+-#ifdef MS_WINDOWS
+-    saved_errno = WSAECONNABORTED;
+-#else
+-    saved_errno = ECONNABORTED; /* I hope this is portable and appropriate.  */
+-#endif
+-  tidy_up_and_fail:
+-    if (saved_errno < 0)
+-      saved_errno = errno;
+-    if (listener != -1)
+-      tor_close_socket(listener);
+-    if (connector != -1)
+-      tor_close_socket(connector);
+-    if (acceptor != -1)
+-      tor_close_socket(acceptor);
+-    return -saved_errno;
+-#endif
++	return bsocketpair(family,type,protocol,fd);
+ }
+ 
+ #define ULIMIT_BUFFER 32 /* keep 32 extra fd's beyond _ConnLimit */
+@@ -1233,21 +1137,21 @@
+  * should call tor_socket_errno <em>at most once</em> on the failing
+  * socket to get the error.
+  */
+-#ifdef MS_WINDOWS
+-int
+-tor_socket_errno(int sock)
+-{
+-  int optval, optvallen=sizeof(optval);
+-  int err = WSAGetLastError();
+-  if (err == WSAEWOULDBLOCK && sock >= 0) {
+-    if (getsockopt(sock, SOL_SOCKET, SO_ERROR, (void*)&optval, &optvallen))
+-      return err;
+-    if (optval)
+-      return optval;
+-  }
+-  return err;
+-}
+-#endif
++//#ifdef MS_WINDOWS
++//int
++//tor_socket_errno(int sock)
++//{
++//  int optval, optvallen=sizeof(optval);
++//  int err = WSAGetLastError();
++//  if (err == WSAEWOULDBLOCK && sock >= 0) {
++//    if (bgetsockopt(sock, SOL_SOCKET, SO_ERROR, (void*)&optval, &optvallen))
++//      return err;
++//    if (optval)
++//      return optval;
++//  }
++//  return err;
++//}
++//a#endif
+ 
+ #ifdef MS_WINDOWS
+ #define E(code, s) { code, (s " [" #code " ]") }
+@@ -1313,16 +1217,16 @@
+ /** There does not seem to be a strerror equivalent for winsock errors.
+  * Naturally, we have to roll our own.
+  */
+-const char *
+-tor_socket_strerror(int e)
+-{
+-  int i;
+-  for (i=0; windows_socket_errors[i].code >= 0; ++i) {
+-    if (e == windows_socket_errors[i].code)
+-      return windows_socket_errors[i].msg;
+-  }
+-  return strerror(e);
+-}
++//const char *
++//tor_socket_strerror(int e)
++//{
++//  int i;
++//  for (i=0; windows_socket_errors[i].code >= 0; ++i) {
++//    if (e == windows_socket_errors[i].code)
++//      return windows_socket_errors[i].msg;
++//  }
++//  return strerror(e);
++//}
+ #endif
+ 
+ /** Called before we make any calls to network-related functions.

Modified: bsockets/trunk/contrib/tor/src/common/compat.h.diff
===================================================================
--- bsockets/trunk/contrib/tor/src/common/compat.h.diff	2006-09-19 17:47:16 UTC (rev 8424)
+++ bsockets/trunk/contrib/tor/src/common/compat.h.diff	2006-09-19 18:53:34 UTC (rev 8425)
@@ -1,48 +1,69 @@
-23a24
-> 
-209c210
-< #define tor_close_socket(s) closesocket(s)
----
-> #define tor_close_socket(s) bclose(s)
-230,232c231,233
-< #ifdef MS_WINDOWS
-< /** Return true if e is EAGAIN or the local equivalent. */
-< #define ERRNO_IS_EAGAIN(e)           ((e) == EAGAIN || (e) == WSAEWOULDBLOCK)
----
-> //#ifdef MS_WINDOWS
-> ///** Return true if e is EAGAIN or the local equivalent. */
-> //#define ERRNO_IS_EAGAIN(e)           ((e) == EAGAIN || (e) == WSAEWOULDBLOCK)
-234c235
-< #define ERRNO_IS_EINPROGRESS(e)      ((e) == WSAEINPROGRESS)
----
-> //#define ERRNO_IS_EINPROGRESS(e)      ((e) == WSAEINPROGRESS)
-237,238c238,239
-< #define ERRNO_IS_CONN_EINPROGRESS(e) \
-<   ((e) == WSAEINPROGRESS || (e)== WSAEINVAL || (e) == WSAEWOULDBLOCK)
----
-> //#define ERRNO_IS_CONN_EINPROGRESS(e)
-> //  ((e) == WSAEINPROGRESS || (e)== WSAEINVAL || (e) == WSAEWOULDBLOCK)
-241c242
-< #define ERRNO_IS_ACCEPT_EAGAIN(e)    ERRNO_IS_EAGAIN(e)
----
-> //#define ERRNO_IS_ACCEPT_EAGAIN(e)    ERRNO_IS_EAGAIN(e)
-244,245c245,246
-< #define ERRNO_IS_ACCEPT_RESOURCE_LIMIT(e) \
-<   ((e) == WSAEMFILE || (e) == WSAENOBUFS)
----
-> //#define ERRNO_IS_ACCEPT_RESOURCE_LIMIT(e)
-> //  ((e) == WSAEMFILE || (e) == WSAENOBUFS)
-247,250c248,251
-< #define ERRNO_IS_EADDRINUSE(e)      ((e) == WSAEADDRINUSE)
-< int tor_socket_errno(int sock);
-< const char *tor_socket_strerror(int e);
-< #else
----
-> //#define ERRNO_IS_EADDRINUSE(e)      ((e) == WSAEADDRINUSE)
-> //int tor_socket_errno(int sock);
-> //const char *tor_socket_strerror(int e);
-> //#else
-260c261
-< #endif
----
-> //#endif
+--- compat.h.old	Tue Sep 19 13:43:11 2006
++++ compat.h	Mon Sep 11 04:47:26 2006
+@@ -21,6 +21,7 @@
+ #endif
+ #endif
+ #ifdef HAVE_SYS_TYPES_H
++
+ #include <sys/types.h>
+ #endif
+ #ifdef HAVE_SYS_TIME_H
+@@ -206,7 +207,7 @@
+  * tor_close_socket to close sockets, and always using close() on
+  * files.
+  */
+-#define tor_close_socket(s) closesocket(s)
++#define tor_close_socket(s) bclose(s)
+ #else
+ #define tor_close_socket(s) close(s)
+ #endif
+@@ -227,27 +228,27 @@
+  * errnos against expected values, and use tor_socket_errno to find
+  * the actual errno after a socket operation fails.
+  */
+-#ifdef MS_WINDOWS
+-/** Return true if e is EAGAIN or the local equivalent. */
+-#define ERRNO_IS_EAGAIN(e)           ((e) == EAGAIN || (e) == WSAEWOULDBLOCK)
++//#ifdef MS_WINDOWS
++///** Return true if e is EAGAIN or the local equivalent. */
++//#define ERRNO_IS_EAGAIN(e)           ((e) == EAGAIN || (e) == WSAEWOULDBLOCK)
+ /** Return true if e is EINPROGRESS or the local equivalent. */
+-#define ERRNO_IS_EINPROGRESS(e)      ((e) == WSAEINPROGRESS)
++//#define ERRNO_IS_EINPROGRESS(e)      ((e) == WSAEINPROGRESS)
+ /** Return true if e is EINPROGRESS or the local equivalent as returned by
+  * a call to connect(). */
+-#define ERRNO_IS_CONN_EINPROGRESS(e) \
+-  ((e) == WSAEINPROGRESS || (e)== WSAEINVAL || (e) == WSAEWOULDBLOCK)
++//#define ERRNO_IS_CONN_EINPROGRESS(e)
++//  ((e) == WSAEINPROGRESS || (e)== WSAEINVAL || (e) == WSAEWOULDBLOCK)
+ /** Return true if e is EAGAIN or another error indicating that a call to
+  * accept() has no pending connections to return. */
+-#define ERRNO_IS_ACCEPT_EAGAIN(e)    ERRNO_IS_EAGAIN(e)
++//#define ERRNO_IS_ACCEPT_EAGAIN(e)    ERRNO_IS_EAGAIN(e)
+ /** Return true if e is EMFILE or another error indicating that a call to
+  * accept() has failed because we're out of fds or something. */
+-#define ERRNO_IS_ACCEPT_RESOURCE_LIMIT(e) \
+-  ((e) == WSAEMFILE || (e) == WSAENOBUFS)
++//#define ERRNO_IS_ACCEPT_RESOURCE_LIMIT(e)
++//  ((e) == WSAEMFILE || (e) == WSAENOBUFS)
+ /** Return true if e is EADDRINUSE or the local equivalent. */
+-#define ERRNO_IS_EADDRINUSE(e)      ((e) == WSAEADDRINUSE)
+-int tor_socket_errno(int sock);
+-const char *tor_socket_strerror(int e);
+-#else
++//#define ERRNO_IS_EADDRINUSE(e)      ((e) == WSAEADDRINUSE)
++//int tor_socket_errno(int sock);
++//const char *tor_socket_strerror(int e);
++//#else
+ #define ERRNO_IS_EAGAIN(e)           ((e) == EAGAIN)
+ #define ERRNO_IS_EINPROGRESS(e)      ((e) == EINPROGRESS)
+ #define ERRNO_IS_CONN_EINPROGRESS(e) ((e) == EINPROGRESS)
+@@ -257,7 +258,7 @@
+ #define ERRNO_IS_EADDRINUSE(e)       ((e) == EADDRINUSE)
+ #define tor_socket_errno(sock)       (errno)
+ #define tor_socket_strerror(e)       strerror(e)
+-#endif
++//#endif
+ 
+ /* ===== OS compatibility */
+ const char *get_uname(void);

Modified: bsockets/trunk/contrib/tor/src/common/tortls.c.diff
===================================================================
--- bsockets/trunk/contrib/tor/src/common/tortls.c.diff	2006-09-19 17:47:16 UTC (rev 8424)
+++ bsockets/trunk/contrib/tor/src/common/tortls.c.diff	2006-09-19 18:53:34 UTC (rev 8425)
@@ -1,5 +1,12 @@
-425c425,426
-<   SSL_set_fd(result->ssl, sock);
----
->   SSL_set_bfd(result->ssl, sock);
-> 
+--- tortls.c.old	Tue Sep 19 13:43:11 2006
++++ tortls.c	Sun Sep 10 10:27:25 2006
+@@ -422,7 +422,8 @@
+     return NULL;
+   }
+   result->socket = sock;
+-  SSL_set_fd(result->ssl, sock);
++  SSL_set_bfd(result->ssl, sock);
++
+   result->state = TOR_TLS_ST_HANDSHAKE;
+   result->isServer = isServer;
+   result->wantwrite_n = 0;