|
Revision 24441, 1.4 kB
(checked in by thijs, 1 year ago)
|
Merge maintainer-email-2438: Get rid of references to maintainer email addresses from code.
Author: thijs
Reviewer: exarkun
Fixes: #2438
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
""" |
|---|
| 5 |
The parent class for all the SSH services. Currently implemented services |
|---|
| 6 |
are ssh-userauth and ssh-connection. |
|---|
| 7 |
|
|---|
| 8 |
Maintainer: Paul Swartz |
|---|
| 9 |
""" |
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
from twisted.python import log |
|---|
| 13 |
|
|---|
| 14 |
class SSHService(log.Logger): |
|---|
| 15 |
name = None |
|---|
| 16 |
protocolMessages = {} |
|---|
| 17 |
transport = None |
|---|
| 18 |
|
|---|
| 19 |
def serviceStarted(self): |
|---|
| 20 |
""" |
|---|
| 21 |
called when the service is active on the transport. |
|---|
| 22 |
""" |
|---|
| 23 |
|
|---|
| 24 |
def serviceStopped(self): |
|---|
| 25 |
""" |
|---|
| 26 |
called when the service is stopped, either by the connection ending |
|---|
| 27 |
or by another service being started |
|---|
| 28 |
""" |
|---|
| 29 |
|
|---|
| 30 |
def logPrefix(self): |
|---|
| 31 |
return "SSHService %s on %s" % (self.name, |
|---|
| 32 |
self.transport.transport.logPrefix()) |
|---|
| 33 |
|
|---|
| 34 |
def packetReceived(self, messageNum, packet): |
|---|
| 35 |
""" |
|---|
| 36 |
called when we receive a packet on the transport |
|---|
| 37 |
""" |
|---|
| 38 |
|
|---|
| 39 |
if messageNum in self.protocolMessages: |
|---|
| 40 |
messageType = self.protocolMessages[messageNum] |
|---|
| 41 |
f = getattr(self,'ssh_%s' % messageType[4:], |
|---|
| 42 |
None) |
|---|
| 43 |
if f is not None: |
|---|
| 44 |
return f(packet) |
|---|
| 45 |
log.msg("couldn't handle %r" % messageNum) |
|---|
| 46 |
log.msg(repr(packet)) |
|---|
| 47 |
self.transport.sendUnimplemented() |
|---|
| 48 |
|
|---|