[CalendarServer-changes] [15391] twext/trunk/twext/who

source_changes at macosforge.org source_changes at macosforge.org
Mon Dec 14 13:50:45 PST 2015


Revision: 15391
          http://trac.calendarserver.org//changeset/15391
Author:   cdaboo at apple.com
Date:     2015-12-14 13:50:45 -0800 (Mon, 14 Dec 2015)
Log Message:
-----------
Handle non-ascii passwords.

Modified Paths:
--------------
    twext/trunk/twext/who/directory.py
    twext/trunk/twext/who/test/test_directory.py

Modified: twext/trunk/twext/who/directory.py
===================================================================
--- twext/trunk/twext/who/directory.py	2015-12-14 21:48:55 UTC (rev 15390)
+++ twext/trunk/twext/who/directory.py	2015-12-14 21:50:45 UTC (rev 15391)
@@ -580,6 +580,8 @@
     #
 
     def verifyPlaintextPassword(self, password):
+        if isinstance(password, str):
+            password = password.decode("utf-8")
         if self.password == password:
             return succeed(True)
         else:

Modified: twext/trunk/twext/who/test/test_directory.py
===================================================================
--- twext/trunk/twext/who/test/test_directory.py	2015-12-14 21:48:55 UTC (rev 15390)
+++ twext/trunk/twext/who/test/test_directory.py	2015-12-14 21:50:45 UTC (rev 15391)
@@ -1008,6 +1008,7 @@
 
         self.assertTrue((yield wsanchez.verifyPlaintextPassword(password)))
         self.assertFalse((yield wsanchez.verifyPlaintextPassword(u"bleargh")))
+        self.assertFalse((yield wsanchez.verifyPlaintextPassword("bleargh\xc3\xa5")))
 
 
     @inlineCallbacks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20151214/8ce382f1/attachment.html>


More information about the calendarserver-changes mailing list