Change in vdsm[ovirt-3.2]: Explicitly shutdown m2crypto socket

danken at redhat.com danken at redhat.com
Thu Jan 24 18:09:38 UTC 2013


Hello Juan Hernandez,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/11384

to review the following change.

Change subject: Explicitly shutdown  m2crypto socket
......................................................................

Explicitly shutdown  m2crypto socket

Aparently some versions of the m2crypto library don't shutdown correctly
underlying sockets when a SSL connection is closed.

In Python 2.6.6 (the version in RHEL6 and in CentOS6) when the XML RPC
server closes a connection it calls the shutdown method on that
connection with sock.SHUT_WR as the parameter. This works fine for plain
sockets, and works well also for SSL sockets using the builtin ssl
module as it translates the call to shutdown to a complete shutdown of
the SSL connection. But m2crypto does an different translation and the
net result is that the underlying SSL connection is not completely
closed.

In Python 2.7.3 (the version in Fedora 18) when the XML RPC server
closes a connection it calls the shutdown method on that connection with
sock.SHUT_RDWR, so no matter what SSL implementation is used the
underlying SSL connection is completely closed.

This patch changes the SSLSocket class so that it explicitly shuts down
and closes the underlying socket when  when the connection is closed.

Change-Id: Ie1a471aaccb32554b94340ebfb92b9d7ba14407a
Signed-off-by: Juan Hernandez <juan.hernandez at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/10972
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
Tested-by: Dan Kenigsberg <danken at redhat.com>
Signed-off-by: Dan Kenigsberg <danken at redhat.com>
---
M vdsm/SecureXMLRPCServer.py
1 file changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/84/11384/1

diff --git a/vdsm/SecureXMLRPCServer.py b/vdsm/SecureXMLRPCServer.py
index 2de1cf7..bad2067 100644
--- a/vdsm/SecureXMLRPCServer.py
+++ b/vdsm/SecureXMLRPCServer.py
@@ -57,6 +57,10 @@
     def gettimeout(self):
         return self.connection.socket.gettimeout()
 
+    def close(self):
+        self.connection.shutdown(socket.SHUT_RDWR)
+        self.connection.close()
+
     def __getattr__(self, name):
         # This is how we delegate all the rest of the methods to the
         # underlying SSL connection:


--
To view, visit http://gerrit.ovirt.org/11384
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie1a471aaccb32554b94340ebfb92b9d7ba14407a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.2
Gerrit-Owner: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Juan Hernandez <juan.hernandez at redhat.com>


More information about the vdsm-patches mailing list