[CalendarServer-changes] [4459] CalendarServer/branches/users/wsanchez/deployment/lib-patches/ Twisted/twisted.words.protocols.jabber.sasl_mechanisms.patch
source_changes at macosforge.org
source_changes at macosforge.org
Tue Jul 14 18:21:02 PDT 2009
Revision: 4459
http://trac.macosforge.org/projects/calendarserver/changeset/4459
Author: wsanchez at apple.com
Date: 2009-07-14 18:21:01 -0700 (Tue, 14 Jul 2009)
Log Message:
-----------
Fixes Twisted's parsing of jabber auth challenges
Added Paths:
-----------
CalendarServer/branches/users/wsanchez/deployment/lib-patches/Twisted/twisted.words.protocols.jabber.sasl_mechanisms.patch
Added: CalendarServer/branches/users/wsanchez/deployment/lib-patches/Twisted/twisted.words.protocols.jabber.sasl_mechanisms.patch
===================================================================
--- CalendarServer/branches/users/wsanchez/deployment/lib-patches/Twisted/twisted.words.protocols.jabber.sasl_mechanisms.patch (rev 0)
+++ CalendarServer/branches/users/wsanchez/deployment/lib-patches/Twisted/twisted.words.protocols.jabber.sasl_mechanisms.patch 2009-07-15 01:21:01 UTC (rev 4459)
@@ -0,0 +1,55 @@
+Index: twisted/words/protocols/jabber/sasl_mechanisms.py
+===================================================================
+--- twisted/words/protocols/jabber/sasl_mechanisms.py (revision 19773)
++++ twisted/words/protocols/jabber/sasl_mechanisms.py (working copy)
+@@ -108,16 +108,42 @@
+ @return: challenge directives and their values.
+ @rtype: L{dict} of L{str} to L{str}.
+ """
+- directive_list = challenge.split(',')
+- directives = {}
+- for directive in directive_list:
+- name, value = directive.split('=')
+- value = value.replace("'","")
+- value = value.replace('"','')
+- directives[name] = value
+- return directives
++ s = challenge
++ paramDict = {}
++ cur = 0
++ remainingParams = True
++ while remainingParams:
++ # Parse a param. We can't just split on commas, because there can
++ # be some commas inside (quoted) param values, e.g.:
++ # qop="auth,auth-int"
+
++ middle = s.index("=", cur)
++ name = s[cur:middle].lstrip()
++ middle += 1
++ if s[middle] == '"':
++ middle += 1
++ end = s.index('"', middle)
++ value = s[middle:end]
++ cur = s.find(',', end) + 1
++ if cur == 0:
++ remainingParams = False
++ else:
++ end = s.find(',', middle)
++ if end == -1:
++ value = s[middle:].rstrip()
++ remainingParams = False
++ else:
++ value = s[middle:end].rstrip()
++ cur = end + 1
++ paramDict[name] = value
+
++ for param in ('qop', 'cipher'):
++ if param in paramDict:
++ paramDict[param] = paramDict[param].split(',')
++
++ return paramDict
++
++
+ def _unparse(self, directives):
+ """
+ Create message string from directives.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090714/29ca5ad3/attachment-0001.html>
More information about the calendarserver-changes
mailing list