diff options
author | Robey Pointer <robey@twitter.com> | 2009-02-17 18:30:48 -0800 |
---|---|---|
committer | Robey Pointer <robey@twitter.com> | 2009-02-17 18:30:48 -0800 |
commit | 74b581c170bdf177eac2a1c5e1f6480b2eee24bf (patch) | |
tree | f56bbf9bfb65a0506a3571387df04edd6a0f671c /tests/test_transport.py | |
parent | 5def1120136336696b9bde81bcfb162b09174948 (diff) |
bug 300536: allow a really long banner before the SSH handshake.
Diffstat (limited to 'tests/test_transport.py')
-rw-r--r-- | tests/test_transport.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/test_transport.py b/tests/test_transport.py index 4b52c4ff..1e380acf 100644 --- a/tests/test_transport.py +++ b/tests/test_transport.py @@ -38,6 +38,19 @@ from paramiko.message import Message from loop import LoopSocket +LONG_BANNER = """\ +Welcome to the super-fun-land BBS, where our MOTD is the primary thing we +provide. All rights reserved. Offer void in Tennessee. Stunt drivers were +used. Do not attempt at home. Some restrictions apply. + +Happy birthday to Commie the cat! + +Note: An SSH banner may eventually appear. + +Maybe. +""" + + class NullServer (ServerInterface): paranoid_did_password = False paranoid_did_public_key = False @@ -182,6 +195,24 @@ class TransportTest (unittest.TestCase): self.assertEquals(True, self.tc.is_authenticated()) self.assertEquals(True, self.ts.is_authenticated()) + def test_3a_long_banner(self): + """ + verify that a long banner doesn't mess up the handshake. + """ + host_key = RSAKey.from_private_key_file('tests/test_rsa.key') + public_host_key = RSAKey(data=str(host_key)) + self.ts.add_server_key(host_key) + event = threading.Event() + server = NullServer() + self.assert_(not event.isSet()) + self.socks.send(LONG_BANNER) + self.ts.start_server(event, server) + self.tc.connect(hostkey=public_host_key, + username='slowdive', password='pygmalion') + event.wait(1.0) + self.assert_(event.isSet()) + self.assert_(self.ts.is_active()) + def test_4_special(self): """ verify that the client can demand odd handshake settings, and can |