~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/ssh.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-10-05 21:15:13 UTC
  • mfrom: (5448.3.5 374700-Add-gnu-lsh-support)
  • Revision ID: pqm@pqm.ubuntu.com-20101005211513-whouyj5t7oo92gmq
(gz) Add support for GNU lsh as a secure shell client (Matthew Gordon)

Show diffs side-by-side

added added

removed removed

Lines of Context:
126
126
        elif 'SSH Secure Shell' in version:
127
127
            trace.mutter('ssh implementation is SSH Corp.')
128
128
            vendor = SSHCorpSubprocessVendor()
 
129
        elif 'lsh' in version:
 
130
            trace.mutter('ssh implementation is GNU lsh.')
 
131
            vendor = LSHSubprocessVendor()
129
132
        # As plink user prompts are not handled currently, don't auto-detect
130
133
        # it by inspection below, but keep this vendor detection for if a path
131
134
        # is given in BZR_SSH. See https://bugs.launchpad.net/bugs/414743
439
442
register_ssh_vendor('sshcorp', SSHCorpSubprocessVendor())
440
443
 
441
444
 
 
445
class LSHSubprocessVendor(SubprocessVendor):
 
446
    """SSH vendor that uses the 'lsh' executable from GNU"""
 
447
 
 
448
    executable_path = 'lsh'
 
449
 
 
450
    def _get_vendor_specific_argv(self, username, host, port, subsystem=None,
 
451
                                  command=None):
 
452
        args = [self.executable_path]
 
453
        if port is not None:
 
454
            args.extend(['-p', str(port)])
 
455
        if username is not None:
 
456
            args.extend(['-l', username])
 
457
        if subsystem is not None:
 
458
            args.extend(['--subsystem', subsystem, host])
 
459
        else:
 
460
            args.extend([host] + command)
 
461
        return args
 
462
 
 
463
register_ssh_vendor('lsh', LSHSubprocessVendor())
 
464
 
 
465
 
442
466
class PLinkSubprocessVendor(SubprocessVendor):
443
467
    """SSH vendor that uses the 'plink' executable from Putty."""
444
468