def request_exit_status(self, status):
     status, = struct.unpack('>L', status)
     if status == 0:
         unittest.fail('false exit status was 0')
     log.msg('finished false')
     self.conn.addResult()
     return 1
Example #2
0
 def request_exit_status(self, status):
     status, = struct.unpack(">L", status)
     if status == 0:
         unittest.fail("false exit status was 0")
     log.msg("finished false")
     self.conn.addResult()
     return 1
Example #3
0
 def closed(self):
     if self.status != 0:
         unittest.fail('err exit status was not 0: %i' % self.status)
     if self.testBuf != "hello\r\n":
         unittest.fail('err did not return hello: %s' % repr(self.testBuf))
     unittest.assertEquals(self.localWindowLeft, 4)
     unittest.assert_(self.eofCalled)
     log.msg('finished err')
     self.conn.addResult()
     return 1
Example #4
0
 def closed(self):
     if self.status != 0:
         unittest.fail('echo exit status was not 0: %i' % self.status)
     unittest.assertEquals(self.testBuf, 'hello\r\n')
     unittest.assertEquals(self.testExtBuf, 'hello\r\n')
     unittest.assertEquals(self.localWindowLeft, 12)
     unittest.assert_(self.eofCalled)
     log.msg('finished max packet')
     self.conn.addResult()
     return 1
Example #5
0
 def global_tcpip_forward(self, data):
     host, port = forwarding.unpackGlobal_tcpip_forward(data)
     try: listener = reactor.listenTCP(port,
             forwarding.SSHListenForwardingFactory(self.conn,
                 (host, port),
                 forwarding.SSHListenServerForwardingChannel),
             interface = host)
     except:
         log.err()
         unittest.fail("something went wrong with remote->local forwarding")
         return 0
     else:
         self.listeners[(host, port)] = listener
         return 1
Example #6
0
 def execute(self, args, p, preargs = ''):
     if runtime.platformType == 'win32':
         raise unittest.SkipTest, "can't run cmdline client on win32"
     port = self.server.getHost().port
     cmd1 = ('-p %i -l testuser '
             '--known-hosts kh_test '
             '--user-authentications publickey '
             '--host-key-algorithms ssh-rsa '
             '-a '
             '-K direct '
             '-i dsa_test '
             '127.0.0.1') % port
     cmd2 = ('-p %i -l testuser '
             '-K unix '
             '-v ') % port + preargs + \
             ' 127.0.0.1 ' + args
     cmds1 = cmd1.split()
     cmds2 = _makeArgs(cmd2.split())
     o = options.ConchOptions()
     def _(host, *args):
         o['host'] = host
     o.parseArgs = _
     o.parseOptions(cmds1)
     vhk = default.verifyHostKey
     conn = SSHTestConnectionForUnix(p, sys.executable, cmds2)
     uao = default.SSHUserAuthClient(o['user'], o, conn)
     d = connect.connect(o['host'], int(o['port']), o, vhk, uao)
     d.addErrback(lambda f: unittest.fail('Failure connecting to test server: %s' % f))
     d.addCallback(lambda x : p.deferred)
     d.addCallback(lambda x : defer.maybeDeferred(
         conn.transport.transport.loseConnection))
     return d
Example #7
0
 def openFailed(self, reason):
     unittest.fail('false open failed: %s' % reason)
Example #8
0
 def openFailed(self, reason):
     unittest.fail('echo open failed: %s' % reason)
Example #9
0
 def receiveUnimplemented(self, seqID):
     unittest.fail('got unimplemented: seqid %s'  % seqID)
     self.expectedLoseConnection = 1
     self.loseConnection()
Example #10
0
 def channelOpen(self, ignored):
     unittest.fail("opened unknown channel")
Example #11
0
 def _ebPtyReq(self, reason):
     unittest.fail('pty request failed: %s' % reason)
Example #12
0
 def ssh_USERAUTH_SUCCESS(self, packet):
     if not self.canSucceedPassword and self.canSucceedPublicKey:
         unittest.fail(
             'got USERAUTH_SUCESS before password and publickey')
     userauth.SSHUserAuthClient.ssh_USERAUTH_SUCCESS(self, packet)
Example #13
0
 def dataReceived(self, data):
     unittest.fail('err channel got regular data: %s' % repr(data))
Example #14
0
 def openFailed(self, reason):
     unittest.fail('max packet open failed: %s' % reason)
Example #15
0
 def errReceived(self, dataType, data):
     unittest.fail('echo channel got extended data')
Example #16
0
 def _ebRequestFailed(self, reason):
     unittest.fail('err exec failed: %s' % reason)
Example #17
0
 def openFailed(self, reason):
     unittest.fail('echo open failed: %s' % reason)
Example #18
0
 def dataReceived(self, data):
     unittest.fail('got data when using false')
Example #19
0
 def openFailed(self, reason):
     unittest.fail('false open failed: %s' % reason)
Example #20
0
 def receiveUnimplemented(self, seqID):
     unittest.fail('got unimplemented: seqid %s' % seqID)
     self.expectedLoseConnection = 1
     self.loseConnection()
Example #21
0
 def openFailed(self, reason):
     unittest.fail('max packet open failed: %s' % reason)
Example #22
0
 def dataReceived(self, data):
     unittest.fail('err channel got regular data: %s' % repr(data))
Example #23
0
 def _ebRequestFailed(self, reason):
     unittest.fail('max packet exec failed: %s' % reason)
Example #24
0
 def connectionLost(self, reason):
     if self.done:
         return
     if not hasattr(self,'expectedLoseConnection'):
         unittest.fail('unexpectedly lost connection %s\n%s' % (self, reason))
     self.done = 1
Example #25
0
 def openFailed(self, reason):
     unittest.fail('shell open failed: %s' % reason)
Example #26
0
 def _cbRequestWorked(self, ignored):
     unittest.fail('fail exec succeeded')
Example #27
0
 def _ebPtyReq(self, reason):
     unittest.fail('pty request failed: %s' % reason)
Example #28
0
 def connectionLost(self, reason):
     if self.done:
         return
     if not hasattr(self,'expectedLoseConnection'):
         unittest.fail('unexpectedly lost connection %s\n%s' % (self, reason))
     self.done = 1
Example #29
0
 def _ebShellOpen(self, reason):
     unittest.fail('shell request failed: %s' % reason)
Example #30
0
 def ssh_USERAUTH_SUCCESS(self, packet):
     if not self.canSucceedPassword and self.canSucceedPublicKey:
         unittest.fail('got USERAUTH_SUCESS before password and publickey')
     userauth.SSHUserAuthClient.ssh_USERAUTH_SUCCESS(self, packet)
Example #31
0
 def openFailed(self, reason):
     unittest.fail('subsystem open failed: %s' % reason)
Example #32
0
 def _cbRequestWorked(self, ignored):
     unittest.fail('fail exec succeeded')
Example #33
0
 def _cbRequestWorked(self, ignored):
     unittest.fail('opened non-crazy subsystem')
Example #34
0
 def dataReceived(self, data):
     unittest.fail('got data when using false')
Example #35
0
 def _ebRealRequestFailed(self, reason):
     unittest.fail('opening crazy subsystem failed: %s' % reason)
Example #36
0
 def errReceived(self, dataType, data):
     unittest.fail('echo channel got extended data')
Example #37
0
 def _ebFirstGlobal(self, reason):
     unittest.fail('first global request failed: %s' % reason)
Example #38
0
 def _ebRequestFailed(self, reason):
     unittest.fail('err exec failed: %s' % reason)
Example #39
0
 def openFailed(self, reason):
     unittest.fail('subsystem open failed: %s' % reason)
Example #40
0
 def receiveError(self, reasonCode, desc):
     self.expectedLoseConnection = 1
     if not self.allowedToError:
         unittest.fail('got disconnect for %s: reason %s, desc: %s' %
                       (self, reasonCode, desc))
     self.loseConnection()
Example #41
0
 def _ebRealRequestFailed(self, reason):
     unittest.fail('opening crazy subsystem failed: %s' % reason)
Example #42
0
 def _ebRequestFailed(self, reason):
     unittest.fail('max packet exec failed: %s' % reason)
Example #43
0
 def _ebSecondGlobal(self, reason):
     unittest.fail('second global request failed: %s' % reason)
Example #44
0
 def openFailed(self, reason):
     unittest.fail('shell open failed: %s' % reason)
 def _cbThirdGlobal(self, ignored):
     unittest.fail('second global request succeeded')
Example #46
0
 def _ebShellOpen(self, reason):
     unittest.fail('shell request failed: %s' % reason)
Example #47
0
 def channelOpen(self, ignored):
     unittest.fail("opened unknown channel")
Example #48
0
 def _cbRequestWorked(self, ignored):
     unittest.fail('opened non-crazy subsystem')
Example #49
0
 def openFailed(self, reason):
     unittest.fail("err open failed: %s" % reason)
Example #50
0
 def _ebFirstGlobal(self, reason):
     unittest.fail('first global request failed: %s' % reason)
 def receiveError(self, reasonCode, desc):
     self.expectedLoseConnection = 1
     if not self.allowedToError:
         unittest.fail('got disconnect for %s: reason %s, desc: %s' %
                        (self, reasonCode, desc))
     self.loseConnection()
Example #52
0
 def _cbThirdGlobal(self, ignored):
     unittest.fail('second global request succeeded')
 def _ebSecondGlobal(self, reason):
     unittest.fail('second global request failed: %s' % reason)