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

[or-cvs] Some versions of openssl have an SSL_pending function that ...



Update of /home/or/cvsroot/src/common
In directory moria.mit.edu:/tmp/cvs-serv32193/src/common

Modified Files:
	tortls.c 
Log Message:
Some versions of openssl have an SSL_pending function that erroneously
returns bytes when there is a non-application record pending.

I have no idea when/why this would even happen, but let's catch it and
make sure tor_tls_get_pending_bytes stays correct.


Index: tortls.c
===================================================================
RCS file: /home/or/cvsroot/src/common/tortls.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- tortls.c	26 Apr 2004 23:00:07 -0000	1.50
+++ tortls.c	26 Apr 2004 23:19:21 -0000	1.51
@@ -603,7 +603,14 @@
 tor_tls_get_pending_bytes(tor_tls *tls)
 {
   tor_assert(tls);
+#if OPENSSL_VERSION_NUMBER < 0x0090700fl
+  if (tls->ssl->rstate == SSL_ST_READ_BODY)
+    return 0;
+  if (tls->ssl->s3->rrec.type != SSL3_RT_APPLICATION_DATA)
+    return 0;
+#endif
   return SSL_pending(tls->ssl);
+
 }
 
 /* Return the number of bytes read across the underlying socket. */