Ticket #2997 defect closed fixed
conch and getPeer
| Reported by: | bernat@… | Owned by: | z3p |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | conch | Keywords: | |
| Cc: | Branch: | branches/conch-session-getPeer-2997 | |
| Author: | z3p | Launchpad Bug: |
Description (last modified by thijs) (diff)
I would like to use getPeer from conch but there is no easy way of this. For example, if I take sshsimpleserver.py and apply the following patch:
-
sshsimpleserver.py
old new 30 30 """this is our example protocol that we will run over SSH 31 31 """ 32 32 def dataReceived(self, data): 33 print self.transport.getPeer() 33 34 if data == '\r': 34 35 data = '\r\n' 35 36 elif data == '\x03': #^C
I get:
exceptions.AttributeError: SSHSessionProcessProtocol instance has no attribute 'getPeer'
The solution seems to be to use self.transport.session.getPeer(). I think that getPeer method should be implemented in SSHSessionProcessProtocol (to be able to use a protocol with SSH or without SSH for example).
In fact, there seems to be a bug in SSHChannel. When using self.transport.session.getPeer(), I get :
File "/usr/lib/python2.4/site-packages/twisted/conch/ssh/channel.py", line 219, in getPeer return('SSH', )+self.conn.transport.getPeer() exceptions.AttributeError: SSHServerTransport instance has no attribute 'getPeer'
The fix should be to use self.conn.transport.transport.getPeer().
Change History
Note: See
TracTickets for help on using
tickets.
