[Pkg-privacy-commits] [obfsproxy] 300/353: Don't do networking on connections that should be closed.

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 13:02:14 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository obfsproxy.

commit 2ff160c0ad9258109d8c47eca162e7cd24e0f161
Author: George Kadianakis <desnacked at riseup.net>
Date:   Thu May 8 17:22:44 2014 +0100

    Don't do networking on connections that should be closed.
---
 ChangeLog                            |  2 ++
 obfsproxy/network/extended_orport.py |  3 +++
 obfsproxy/network/network.py         | 15 +++++++++++++++
 3 files changed, 20 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 469988e..6e62a75 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,6 @@
 Changes in version 0.2.10 - UNRELEASED:
+ - Make sure that we don't try to do networking operations on a
+   connection that should be closed. Fixes #11769.
  - Only print ScrambleSuit disclaimer on startup (instead of
    printing it for every connection). Fixes #11768.
 
diff --git a/obfsproxy/network/extended_orport.py b/obfsproxy/network/extended_orport.py
index cb8ea4f..27220d4 100644
--- a/obfsproxy/network/extended_orport.py
+++ b/obfsproxy/network/extended_orport.py
@@ -121,6 +121,9 @@ class ExtORPortProtocol(network.GenericProtocol):
         """
         We got some data, process it according to our current state.
         """
+        if self.closed:
+            log.debug("%s: ExtORPort dataReceived called while closed. Ignoring.", self.name)
+            return
 
         self.buffer.write(data_rcvd)
 
diff --git a/obfsproxy/network/network.py b/obfsproxy/network/network.py
index fa4d1e6..aadbba5 100644
--- a/obfsproxy/network/network.py
+++ b/obfsproxy/network/network.py
@@ -120,6 +120,9 @@ class Circuit(Protocol):
         Circuit was just completed; that is, its endpoints are now
         connected. Do all the things we have to do now.
         """
+        if self.closed:
+            log.debug("%s: Completed circuit while closed. Ignoring.", self.name)
+            return
 
         log.debug("%s: Circuit completed." % self.name)
 
@@ -145,6 +148,10 @@ class Circuit(Protocol):
 
         Requires both downstream and upstream connections to be set.
         """
+        if self.closed:
+            log.debug("%s: Calling circuit's dataReceived while closed. Ignoring.", self.name)
+            return
+
         assert(self.downstream and self.upstream)
         assert((conn is self.downstream) or (conn is self.upstream))
 
@@ -208,6 +215,10 @@ class GenericProtocol(Protocol, object):
         """
         Write 'buf' to the underlying transport.
         """
+        if self.closed:
+            log.debug("%s: Calling write() while connection is closed. Ignoring.", self.name)
+            return
+
         log.debug("%s: Writing %d bytes." % (self.name, len(buf)))
 
         self.transport.write(buf)
@@ -291,6 +302,10 @@ class StaticDestinationProtocol(GenericProtocol):
         XXX: Can also be called with empty 'data' because of
         Circuit.setDownstreamConnection(). Document or split function.
         """
+        if self.closed:
+            log.debug("%s: dataReceived called while closed. Ignoring.", self.name)
+            return
+
         if (not self.buffer) and (not data):
             log.debug("%s: dataReceived called without a reason.", self.name)
             return

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/obfsproxy.git



More information about the Pkg-privacy-commits mailing list