diff --git a/client/csocket.py b/client/csocket.py index 7f795c65..b64b8753 100644 --- a/client/csocket.py +++ b/client/csocket.py @@ -24,7 +24,7 @@ __date__ = "$Date$" __copyright__ = "Copyright (c) 2004 Cyril Jaquier" __license__ = "GPL" -import socket, pickle +import socket, cPickle class CSocket: @@ -40,7 +40,7 @@ class CSocket: def send(self, msg): # Convert every list member to string - obj = pickle.dumps(map(str, msg)) + obj = cPickle.dumps(map(str, msg)) self.__csock.send(obj + CSocket.END_STRING) ret = self.receive(self.__csock) self.__csock.close() @@ -53,4 +53,4 @@ class CSocket: if chunk == '': raise RuntimeError, "socket connection broken" msg = msg + chunk - return pickle.loads(msg) + return cPickle.loads(msg) diff --git a/server/ssocket.py b/server/ssocket.py index 59ff8670..01ca99c0 100644 --- a/server/ssocket.py +++ b/server/ssocket.py @@ -25,7 +25,7 @@ __copyright__ = "Copyright (c) 2004 Cyril Jaquier" __license__ = "GPL" from threading import Thread -import socket, time, logging, pickle, os, os.path +import socket, time, logging, cPickle, os, os.path # Gets the instance of the logger. logSys = logging.getLogger("fail2ban.comm") @@ -109,7 +109,7 @@ class SocketWorker(Thread): logSys.debug("Connection closed") def __send(self, socket, msg): - obj = pickle.dumps(msg) + obj = cPickle.dumps(msg) socket.send(obj + SSocket.END_STRING) def __receive(self, socket): @@ -119,7 +119,7 @@ class SocketWorker(Thread): if chunk == '': raise RuntimeError, "socket connection broken" msg = msg + chunk - return pickle.loads(msg) + return cPickle.loads(msg) class SSocketErrorException(Exception):