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).
This commit is contained in:
Robey Pointer 2008-01-21 11:08:42 -08:00
parent ba1fd0d61b
commit 38835bc24c
1 changed files with 3 additions and 0 deletions

View File

@ -197,6 +197,9 @@ class AuthHandler (object):
m.add_string(self.auth_method) m.add_string(self.auth_method)
if self.auth_method == 'password': if self.auth_method == 'password':
m.add_boolean(False) m.add_boolean(False)
password = self.password
if isinstance(password, unicode):
password = password.encode('UTF-8')
m.add_string(self.password.encode('UTF-8')) m.add_string(self.password.encode('UTF-8'))
elif self.auth_method == 'publickey': elif self.auth_method == 'publickey':
m.add_boolean(True) m.add_boolean(True)