From 38835bc24ca147b46470d063bce94670eaf901f8 Mon Sep 17 00:00:00 2001 From: Robey Pointer Date: Mon, 21 Jan 2008 11:08:42 -0800 Subject: [PATCH] [project @ robey@lag.net-20080121190842-mq94nybu8qxhw1jl] for password authentication, only utf-8 encode the password if it's in unicode. this should let clients work around servers that expect non-utf-8 passwords (possibly because they predate the RFCs). --- paramiko/auth_handler.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/paramiko/auth_handler.py b/paramiko/auth_handler.py index 8ecd530..6cf6565 100644 --- a/paramiko/auth_handler.py +++ b/paramiko/auth_handler.py @@ -197,6 +197,9 @@ class AuthHandler (object): m.add_string(self.auth_method) if self.auth_method == 'password': m.add_boolean(False) + password = self.password + if isinstance(password, unicode): + password = password.encode('UTF-8') m.add_string(self.password.encode('UTF-8')) elif self.auth_method == 'publickey': m.add_boolean(True)