~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: 2008-06-10 08:15:19 UTC
  • mfrom: (3489.1.2 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20080610081519-95unlj6ayptlh2uv
(mbp) Bump version to 1.6b3

Show diffs side-by-side

added added

removed removed

Lines of Context:
458
458
 
459
459
 
460
460
def _paramiko_auth(username, password, host, port, paramiko_transport):
461
 
    # paramiko requires a username, but it might be none if nothing was
462
 
    # supplied.  If so, use the local username.
 
461
    # paramiko requires a username, but it might be none if nothing was supplied
 
462
    # use the local username, just in case.
 
463
    # We don't override username, because if we aren't using paramiko,
 
464
    # the username might be specified in ~/.ssh/config and we don't want to
 
465
    # force it to something else
 
466
    # Also, it would mess up the self.relpath() functionality
 
467
    auth = config.AuthenticationConfig()
463
468
    if username is None:
464
 
        username = getpass.getuser()
 
469
        username = auth.get_user('ssh', host, port=port)
 
470
        if username is None:
 
471
            # Default to local user
 
472
            username = getpass.getuser()
465
473
 
466
474
    if _use_ssh_agent:
467
475
        agent = paramiko.Agent()
488
496
            pass
489
497
 
490
498
    # give up and ask for a password
491
 
    auth = config.AuthenticationConfig()
492
499
    password = auth.get_password('ssh', host, username, port=port)
493
500
    try:
494
501
        paramiko_transport.auth_password(username, password)