]> git.mxchange.org Git - quix0rs-apt-p2p.git/commitdiff
Upgrade the security in khashmir by using longer TIDs.
authorCameron Dale <camrdale@gmail.com>
Fri, 11 Jan 2008 18:51:32 +0000 (10:51 -0800)
committerCameron Dale <camrdale@gmail.com>
Fri, 11 Jan 2008 18:51:32 +0000 (10:51 -0800)
TODO
apt_dht_Khashmir/krpc.py

diff --git a/TODO b/TODO
index 9b4f7483cf5030e6bfcb9a2087d3a010a4762024..eca4e1325c26a7fb6cf758e470c4a8fb8ee32b0c 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,10 +1,3 @@
-Upgrade the security in khashmir by using longer TIDs.
-
-The TIDs sent with every request that must be echoed on response are 
-very short (one char). They should be lengthened to 20 using the NewID() 
-function from khash.
-
-
 Hashes of files need to be stored permanently.
 
 A new database of files and their hashes is needed. It should store the 
 Hashes of files need to be stored permanently.
 
 A new database of files and their hashes is needed. It should store the 
@@ -13,6 +6,9 @@ so we can check if a file needs to be rehashed on startup. The DB can
 also be used to store info needed to manage the values stored in the DHT.
 
 
 also be used to store info needed to manage the values stored in the DHT.
 
 
+Change all print statements to log.msg() calls.
+
+
 Add ability to search and hash and DHT-store other directories.
 
 The user should be able to specify a list of directories that will be 
 Add ability to search and hash and DHT-store other directories.
 
 The user should be able to specify a list of directories that will be 
index 40ab8d84145e3e7e5650f67abbb7edd95b785861..441079c7c13c4a8020b98cdaaafeb51469362ca3 100644 (file)
@@ -10,6 +10,8 @@ from twisted.internet.defer import Deferred
 from twisted.internet import protocol, reactor
 from twisted.trial import unittest
 
 from twisted.internet import protocol, reactor
 from twisted.trial import unittest
 
+from khash import newID
+
 KRPC_TIMEOUT = 20
 
 KRPC_ERROR = 1
 KRPC_TIMEOUT = 20
 
 KRPC_ERROR = 1
@@ -71,7 +73,6 @@ class KRPC:
         self.addr = addr
         self.noisy = spew
         self.tids = {}
         self.addr = addr
         self.noisy = spew
         self.tids = {}
-        self.mtid = 0
         self.stopped = False
 
     def datagramReceived(self, str, addr):
         self.stopped = False
 
     def datagramReceived(self, str, addr):
@@ -157,8 +158,7 @@ class KRPC:
             raise ProtocolError, "connection has been stopped"
         # make message
         # send it
             raise ProtocolError, "connection has been stopped"
         # make message
         # send it
-        msg = {TID : chr(self.mtid), TYP : REQ,  REQ : method, ARG : args}
-        self.mtid = (self.mtid + 1) % 256
+        msg = {TID : newID(), TYP : REQ,  REQ : method, ARG : args}
         if self.noisy:
             print self.factory.port, "sending to", self.addr, ":", msg
         str = bencode(msg)
         if self.noisy:
             print self.factory.port, "sending to", self.addr, ":", msg
         str = bencode(msg)