[Tkabber-dev] r817 - in trunk/tkabber: . plugins/si

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Sun Dec 3 12:24:16 MSK 2006


Author: sergei
Date: 2006-12-03 12:24:13 +0300 (Sun, 03 Dec 2006)
New Revision: 817

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/plugins/si/socks5.tcl
Log:
	* plugins/si/socks5.tcl: Fixed SHA1 hash computing for SOCKS5
	  bytestreams support.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2006-12-02 12:31:15 UTC (rev 816)
+++ trunk/tkabber/ChangeLog	2006-12-03 09:24:13 UTC (rev 817)
@@ -1,3 +1,8 @@
+2006-12-03  Sergei Golovan  <sgolovan at nes.ru>
+
+	* plugins/si/socks5.tcl: Fixed SHA1 hash computing for SOCKS5
+	  bytestreams support.
+
 2006-12-02  Sergei Golovan  <sgolovan at nes.ru>
 
 	* plugins/richtext/highlight.tcl: Enable highlighting by default.

Modified: trunk/tkabber/plugins/si/socks5.tcl
===================================================================
--- trunk/tkabber/plugins/si/socks5.tcl	2006-12-02 12:31:15 UTC (rev 816)
+++ trunk/tkabber/plugins/si/socks5.tcl	2006-12-03 09:24:13 UTC (rev 817)
@@ -86,9 +86,13 @@
 	return
     }
 
-    set myjid [jlib::connection_jid $state(connid)]
-    set hash [::sha1::sha1 $state(id)$state(jid)$myjid]
+    set myjid [encoding convertto utf-8 \
+		   [string tolower [jlib::connection_jid $state(connid)]]]
+    set hisjid [encoding convertto utf-8 [string tolower $state(jid)]]
+    set hash [::sha1::sha1 $state(id)$hisjid$myjid]
 
+    debugmsg filetransfer "SOCKS5 HASH $hash"
+
     set len [binary format c [string length $hash]]
 
     puts -nonewline $sock "\x05\x01\x00\x03$len$hash\x00\x00"
@@ -158,12 +162,14 @@
     set state(servsock) $servsock
     lassign [fconfigure $servsock -sockname] addr hostname port
     set ip [jlib::socket_ip $state(connid)]
-    set myjid [jlib::connection_jid $state(connid)]
-    set hash [::sha1::sha1 $state(id)$myjid$state(jid)]
+    set myjid [encoding convertto utf-8 \
+		   [string tolower [jlib::connection_jid $state(connid)]]]
+    set hisjid [encoding convertto utf-8 [string tolower $state(jid)]]
+    set hash [::sha1::sha1 $state(id)$myjid$hisjid]
     set hash_sid($hash) $state(id)
 
     set streamhosts [list [jlib::wrapper:createtag streamhost \
-			       -vars [list jid $myjid \
+			       -vars [list jid [jlib::connection_jid $state(connid)] \
 					   host $ip \
 					   port $port]]]
 
@@ -363,8 +369,10 @@
 	return
     }
 
-    set myjid [jlib::connection_jid $state(connid)]
-    set hash [::sha1::sha1 $state(id)$myjid$state(jid)]
+    set myjid [encoding convertto utf-8 \
+		   [string tolower [jlib::connection_jid $state(connid)]]]
+    set hisjid [encoding convertto utf-8 [string tolower $state(jid)]]
+    set hash [::sha1::sha1 $state(id)$myjid$hisjid]
 
     set len [binary format c [string length $hash]]
 



More information about the Tkabber-dev mailing list