[MERGE] Support for Putty SSH implementation

John Arbash Meinel john at arbash-meinel.com
Wed Jan 10 17:25:07 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Aaron Bentley wrote:
> John Arbash Meinel wrote:
>>> Alexander Belchenko wrote:
>>>>> I wonder why do not provide support of sftp via plink in the paramiko library
>>>>> itself? IIRC, paramiko use OpenSSH when possible. So adding new SSH provider
>>>>> to paramiko may be more consistent?
> 
>>> I don't think paramiko uses Openssh, bzr uses openssh and the passes
>>> that connection off to paramiko.
> 
> On machines with OpenSSH installed, this allows us to take advantage of
> any existing OpenSSH configuration, such as public keys, key agents,
> forwarding, etc.  Does that advantage apply to plink?
> 
> The same advantages apply to other programs that use SFTP, but since
> Paramiko's original purpose was to provide an SSH implementation, Robey
> might not want to use OpenSSH/plink/SSH.
> 
> Aaron

paramiko's ssh implementation supports public keys and key agents. (At
least it supports ssh-agent and pageant).

I don't think it explicitly supports connection re-use.

However, we cache all of the ssh-level connections. So internally, bzr
will re-use a paramiko ssh connection, or a plink, or openssh, etc.
connection.

So I don't know any specific advantage of plink over the paramiko
implementation. The only thing I can think of is that it *might* be more
optimized since it is a compiled program.

Then again, paramiko uses Crypto to handle all the heavy-duty
cryptographic data operations, so it is also using compiled code.

The biggest thing plink support adds is 'bzr+ssh' without having
paramiko installed. Which I think is a pretty minor advantage.

But I think the refactoring and other improvements are good in their own
 right. We just need to figure out why spawing plink is having different
behavior than just running plink directly.

Alexander: Can you try adding a mutter line to see what command it is
actually executing?

I realize this is supposed to be testing it:
+    def test_plink_arguments(self):
+        vendor = PLinkSubprocessVendor()
+        self.assertEqual(
+            vendor._get_vendor_specific_argv(
+                "user", "host", 100, command=["bzr"]),
+            ["plink", "-x", "-a", "-ssh", "-2",
+                "-P", "100",
+                "-l", "user",
+                "host", "bzr"]
+            )

But I was thinking to change this:

- -    # XXX: 20051123 jamesh
- -    # A check for putty's plink or lsh would go here.
- -
- -    mutter('falling back to paramiko implementation')
- -    _ssh_vendor = ParamikoVendor()
- -    return _ssh_vendor
+            p = subprocess.Popen(args,
+                                 stdout=subprocess.PIPE,
+                                 stderr=subprocess.PIPE,
+                                 **os_specific_subprocess_params())
+            stdout, stderr = p.communicate()
+        except OSError:
+            stdout = stderr = ''
+        return stdout + stderr


to add the line:

mutter('spawning ssh command: %s', args)

That will print it to ~/.bzr.log as a list, to make it clear what the
exact arguments are.

My best guess is that it isn't finding plink on the path, but that is
only a guess.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFpSFzJdeBCYSNAAMRAo0qAJ9XzkeAmQ9AqolYbpxurOGFc7GGIACePJ+G
k14GLohBazuMUU0URrJnzA4=
=tK1z
-----END PGP SIGNATURE-----



More information about the bazaar mailing list