[Tkabber-dev] [tclxmpp commit] r105 - * xmpp/sasl.tcl: Do encode username and password into UTF-8 charset

codesite-noreply at google.com codesite-noreply at google.com
Tue Apr 7 10:48:34 MSD 2009


Author: sgolovan
Date: Mon Apr  6 23:47:37 2009
New Revision: 105

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

Log:
	* xmpp/sasl.tcl: Do encode username and password into UTF-8 charset
	  if SASL package version is less than 1.3.2.


Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	(original)
+++ trunk/ChangeLog	Mon Apr  6 23:47:37 2009
@@ -1,3 +1,8 @@
+2009-04-07  Sergei Golovan  <sgolovan at nes.ru>
+
+	* xmpp/sasl.tcl: Do encode username and password into UTF-8 charset
+	  if SASL package version is less than 1.3.2.
+
  2009-04-05  Sergei Golovan  <sgolovan at nes.ru>

  	* xmpp/auth.tcl, xmpp/sasl.tcl: Store user JID as a connection

Modified: trunk/xmpp/sasl.tcl
==============================================================================
--- trunk/xmpp/sasl.tcl	(original)
+++ trunk/xmpp/sasl.tcl	Mon Apr  6 23:47:37 2009
@@ -20,13 +20,20 @@
      namespace export auth abort

      variable saslpack
+    variable encodeToUTF8

      if {![catch {package require sasl 1.0}]} {
          set saslpack tclsasl
-    } elseif {![catch {package require SASL 1.0}]} {
+    } elseif {![catch {package require SASL 1.0} v]} {
          catch {package require SASL::NTLM}
          catch {package require SASL::XGoogleToken}
          set saslpack tcllib
+
+        if {[package vcompare $v 1.3.2] >= 0} {
+            set encodeToUTF8 0
+        } else {
+            set encodeToUTF8 1
+        }
      } else {
          return -code error -errorinfo [::msgcat::mc "No SASL package  
found"]
      }
@@ -592,6 +599,7 @@
  ##########################################################################

  proc ::xmpp::sasl::TcllibCallbackUser {token stoken command args} {
+    variable encodeToUTF8
      variable $token
      upvar 0 $token state
      set xlib $state(xlib)
@@ -606,8 +614,8 @@
                                                 $state(-server)]]
          }
          username {
-            switch -- $state(mech) {
-                DIGEST-MD5 {
+            switch -- $state(mech)/$encodeToUTF8 {
+                DIGEST-MD5/0 {
                      return $state(-username)
                  }
                  default {
@@ -616,8 +624,8 @@
              }
          }
          password {
-            switch -- $state(mech) {
-                DIGEST-MD5 {
+            switch -- $state(mech)/$encodeToUTF8 {
+                DIGEST-MD5/0 {
                      return $state(-password)
                  }
                  default {
@@ -640,6 +648,7 @@
  }

  proc ::xmpp::sasl::TcllibCallbackComponent {token stoken command args} {
+    variable encodeToUTF8
      variable $token
      upvar 0 $token state
      set xlib $state(xlib)
@@ -652,8 +661,8 @@
              return [encoding convertto utf-8 $state(-domain)]
          }
          username {
-            switch -- $state(mech) {
-                DIGEST-MD5 {
+            switch -- $state(mech)/$encodeToUTF8 {
+                DIGEST-MD5/0 {
                      return $state(-domain)
                  }
                  default {
@@ -662,8 +671,8 @@
              }
          }
          password {
-            switch -- $state(mech) {
-                DIGEST-MD5 {
+            switch -- $state(mech)/$encodeToUTF8 {
+                DIGEST-MD5/0 {
                      return $state(-secret)
                  }
                  default {


More information about the Tkabber-dev mailing list