From 8036e3de90b049e8f6abdf9733659892c04da67e Mon Sep 17 00:00:00 2001 From: citronneur Date: Wed, 9 Jul 2014 22:05:51 +0200 Subject: [PATCH] bug fixing --- bin/rdpy-rdpproxy | 2 +- rdpy/protocol/rdp/pdu.py | 12 ++++++++++-- rdpy/protocol/rdp/rdp.py | 8 +++----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/bin/rdpy-rdpproxy b/bin/rdpy-rdpproxy index 637f113..c5fb3e2 100755 --- a/bin/rdpy-rdpproxy +++ b/bin/rdpy-rdpproxy @@ -11,7 +11,7 @@ from rdpy.protocol.rdp import rdp class TestServerFactory(rdp.ServerFactory): def __init__(self): - rdp.ServerFactory.__init__(self, "/tmp/private.pem", "/tmp/certificate.pem") + rdp.ServerFactory.__init__(self, "/home/sylvain/dev/certificate/rdpy.key", "/home/sylvain/dev/certificate/rdpy.crt") def startedConnecting(self, connector): pass diff --git a/rdpy/protocol/rdp/pdu.py b/rdpy/protocol/rdp/pdu.py index a93fc67..092b92b 100644 --- a/rdpy/protocol/rdp/pdu.py +++ b/rdpy/protocol/rdp/pdu.py @@ -813,7 +813,13 @@ class PDUClientListener(object): @param rectangles: [pdu.BitmapData] struct """ raise CallPureVirtualFuntion("%s:%s defined by interface %s"%(self.__class__, "onUpdate", "PDUClientListener")) - + +class PDUServerListener(object): + """ + Interface for PDU server automata listener + """ + pass + class PDU(LayerAutomata): """ Global channel for mcs that handle session @@ -828,8 +834,10 @@ class PDU(LayerAutomata): mode = LayerMode.CLIENT #set client listener self._clientListener = listener + elif isinstance(listener, PDUServerListener): + mode = LayerMode.SERVER else: - raise InvalidType("PDU Layer expect PDUClientListener as listener") + raise InvalidType("PDU Layer expect PDU(Client|Server)Listener as listener") LayerAutomata.__init__(self, mode, None) #logon info send from client to server diff --git a/rdpy/protocol/rdp/rdp.py b/rdpy/protocol/rdp/rdp.py index 82910f6..38943e1 100644 --- a/rdpy/protocol/rdp/rdp.py +++ b/rdpy/protocol/rdp/rdp.py @@ -10,9 +10,8 @@ class RDPController(pdu.PDUClientListener): """ use to decode and dispatch to observer PDU messages and orders """ - def __init__(self, mode): + def __init__(self): """ - @param mode: mode of generate layer by listener @param observer: observer """ #list of observer @@ -141,7 +140,7 @@ class ClientFactory(protocol.Factory): Function call from twisted and build rdp protocol stack @param addr: destination address ''' - controller = RDPController(LayerMode.CLIENT) + controller = RDPController() self.buildObserver(controller) mcsLayer = mcs.createClient(controller) @@ -174,8 +173,7 @@ class ServerFactory(protocol.Factory): Function call from twisted and build rdp protocol stack @param addr: destination address """ - pduLayer = pdu.PDU(LayerMode.SERVER) - #pduLayer.getController().addObserver(self.buildObserver()) + pduLayer = pdu.PDU(pdu.PDUServerListener()) return tpkt.TPKT(tpdu.createServer(mcs.createServer(pduLayer), self._privateKeyFileName, self._certificateFileName)); def buildObserver(self):