[Nym3-commit] r206 - in trunk/nym3: . Client Server

laurent at conuropsis.org laurent at conuropsis.org
Thu Apr 28 22:22:02 CEST 2005


Author: laurent
Date: 2005-04-28 22:21:59 +0200 (Thu, 28 Apr 2005)
New Revision: 206

Modified:
   trunk/nym3/Client/Account.py
   trunk/nym3/Client/Main.py
   trunk/nym3/Mail.py
   trunk/nym3/Server/Main.py
   trunk/nym3/Server/User.py
Log:
Fix some bugs in account creation handshake and Relay command. Help debugging.


Modified: trunk/nym3/Client/Account.py
===================================================================
--- trunk/nym3/Client/Account.py	2005-04-28 19:43:07 UTC (rev 205)
+++ trunk/nym3/Client/Account.py	2005-04-28 20:21:59 UTC (rev 206)
@@ -226,7 +226,9 @@
 	mixcall = "mixminion send -t %s -i %s" % \
 		  (self['servername'], msgpath)
 	os.system(mixcall)
-	os.unlink(msgpath)
+	# TODO : debugging cruft
+	#os.unlink(msgpath)
+	print "Raw control message left in " + msgpath
 
     def mboxfile(self):
 	"""Gets the path of the mailbox"""

Modified: trunk/nym3/Client/Main.py
===================================================================
--- trunk/nym3/Client/Main.py	2005-04-28 19:43:07 UTC (rev 205)
+++ trunk/nym3/Client/Main.py	2005-04-28 20:21:59 UTC (rev 206)
@@ -92,7 +92,9 @@
 	    account = Account.Account(config, nickname)
 	    # No challenge/response scheme decided yet:
 	    account['handshake'] = 'completed'
-	    ui.display("Account " + nickname + " successfully registered.")
+	    account['username'] = com.nym
+	    ui.display("Account " + nickname + " successfully registered"
+		       " with username " + com.nym)
 	elif (com.ct() == SToCCODE['Status']):
             pass
         elif (com.ct() == SToCCODE['Summary']):

Modified: trunk/nym3/Mail.py
===================================================================
--- trunk/nym3/Mail.py	2005-04-28 19:43:07 UTC (rev 205)
+++ trunk/nym3/Mail.py	2005-04-28 20:21:59 UTC (rev 206)
@@ -95,13 +95,19 @@
     (q, r) = divmod(i, 16)
     return hex(q)[2:] + hex(r)[2:]
 
-def relay(nym,rt,ri,body):
+def relay(nym, rt, ri, body):
     """relay the e-mail in body according to the routing type rt
     and the routing info ri for the nymholder of nym"""
-    b = 'From: ' + nym + '@' + Sconfig.serverName + "\n" + body
+    # TODO : we must be *way* more careful with filtering headers and such
+    # I think
+    b = 'From: ' + nym + '@' + Sconfig.serverName + "\n\n" + body
     fname = tmpFileMsg(b) #TODO we can avoid the tempfile with some fd manipultation : exec mixminion, write b in its stdin
-    ec = os.system("mixminion -t 0x" + b2s(rt[1]) + b2s(rt[0]) + ":" + ri + " -i " + fname)
-    os.unlink(fname)
+    mixcmd = "mixminion send -t 0x" + b2s(rt[0]) + b2s(rt[1]) + ":" + ri + " -i " + fname
+    print mixcmd
+    ec = os.system(mixcmd)
+    # TODO : debugging cruft
+    #os.unlink(fname)
+    print "Raw relayed message left in " + fname
     return ec
                    
 def genMid(length = midLen):

Modified: trunk/nym3/Server/Main.py
===================================================================
--- trunk/nym3/Server/Main.py	2005-04-28 19:43:07 UTC (rev 205)
+++ trunk/nym3/Server/Main.py	2005-04-28 20:21:59 UTC (rev 206)
@@ -123,6 +123,7 @@
 		else: # Valid account creation request. Send CREATED
 		    created = Message.Created()
 		    created.fromData(nymUser.username, "")
+		    nymUser.setUp()
 		    nymUser.send(Message.buildMessage([created]))
             except MyException:
                    #if you come here something went wrong during the account
@@ -136,7 +137,7 @@
                 print "No such user %s" % h.nym
                 sys.exit(73) #TODO is it the smart error code
             if(not nymUser.checkMessageSign(msg[Message.sigLength:],h.sig)):
-               return
+		return
             comList = sr.readCommandCToSList()
             for com in comList:
                 if (com.ct() == Message.CToSCODE['Create']):
@@ -157,7 +158,7 @@
                     elif (com.ct() == Message.CToSCODE['Newpk']):
                         nymUser.setKeys(com.kid,com.kenc)
                     elif (com.ct() == Message.CToSCODE['Relay']):
-                        ec = Mail.relay(com.rt,com.ri,com.body)
+                        ec = Mail.relay(h.nym, com.rt, com.ri, com.body)
                         if (ec != 0):
                             print "mixminion exited abnormally with error code %d" % ec
                             sys.exit(2)

Modified: trunk/nym3/Server/User.py
===================================================================
--- trunk/nym3/Server/User.py	2005-04-28 19:43:07 UTC (rev 205)
+++ trunk/nym3/Server/User.py	2005-04-28 20:21:59 UTC (rev 206)
@@ -233,7 +233,9 @@
         else:
             fname = Mail.tmpFileMsg(msg)
             ec = os.system("mixminion send -R " + self.surbfile() + " -i " + fname)
-            os.unlink(fname)
+	    # TODO : debugging cruft
+            #os.unlink(fname)
+	    print "Message file left in " + fname
             return ec
 
     def clean_surbs(self):



More information about the Nym3-commit mailing list