[Tkabber-dev] [tclxmpp commit] r100 - * xmpp/sasl.tcl: Took into account that MD5-DIGEST SASL mechanism in

codesite-noreply at google.com codesite-noreply at google.com
Tue Mar 31 21:18:47 MSD 2009


Author: sgolovan
Date: Tue Mar 31 09:41:59 2009
New Revision: 100

Modified:
    trunk/ChangeLog
    trunk/xmpp/sasl.tcl

Log:
	* xmpp/sasl.tcl: Took into account that MD5-DIGEST SASL mechanism in
	  Tcllib converts username and password to UTF-8 itself.


Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	(original)
+++ trunk/ChangeLog	Tue Mar 31 09:41:59 2009
@@ -1,3 +1,8 @@
+2009-03-31  Sergei Golovan  <sgolovan at nes.ru>
+
+	* xmpp/sasl.tcl: Took into account that MD5-DIGEST SASL mechanism in
+	  Tcllib converts username and password to UTF-8 itself.
+
  2009-03-30  Sergei Golovan  <sgolovan at nes.ru>

  	* xmpp/poll.tcl: Do not send Proxy-Authorization header if username

Modified: trunk/xmpp/sasl.tcl
==============================================================================
--- trunk/xmpp/sasl.tcl	(original)
+++ trunk/xmpp/sasl.tcl	Tue Mar 31 09:41:59 2009
@@ -356,9 +356,9 @@
              set code [catch {ChooseMech $token $mechanisms} result]

              if {!$code} {
-                set mech $result
-                SASL::configure $state(token) -mech $mech
-                switch -- $mech {
+                set state(mech) $result
+                SASL::configure $state(token) -mech $state(mech)
+                switch -- $state(mech) {
                      PLAIN -
                      X-GOOGLE-TOKEN {
                          # Initial responce
@@ -372,7 +372,7 @@
                      }
                  }
                  if {!$code} {
-                    set result [list mechanism $mech output $output]
+                    set result [list mechanism $state(mech) output $output]
                  }
              }
          }
@@ -581,17 +581,39 @@
              }
          }
          username {
-            if {[info exists state(-username)]} {
-                return [encoding convertto utf-8 $state(-username)]
-            } else {
-                return [encoding convertto utf-8 $state(-domain)]
+            switch -- $state(mech) {
+                DIGEST-MD5 {
+                    if {[info exists state(-username)]} {
+                        return $state(-username)
+                    } else {
+                        return $state(-domain)
+                    }
+                }
+                default {
+                    if {[info exists state(-username)]} {
+                        return [encoding convertto utf-8 $state(-username)]
+                    } else {
+                        return [encoding convertto utf-8 $state(-domain)]
+                    }
+                }
              }
          }
          password {
-            if {[info exists state(-username)]} {
-                return [encoding convertto utf-8 $state(-password)]
-            } else {
-                return [encoding convertto utf-8 $state(-secret)]
+            switch -- $state(mech) {
+                DIGEST-MD5 {
+                    if {[info exists state(-username)]} {
+                        return $state(-password)
+                    } else {
+                        return $state(-secret)
+                    }
+                }
+                default {
+                    if {[info exists state(-username)]} {
+                        return [encoding convertto utf-8 $state(-password)]
+                    } else {
+                        return [encoding convertto utf-8 $state(-secret)]
+                    }
+                }
              }
          }
          realm {


More information about the Tkabber-dev mailing list