[Nym3-commit] r412 - in trunk: . nymbaron/Server

laurent at conuropsis.org laurent at conuropsis.org
Wed Nov 16 22:12:25 CET 2005


Author: laurent
Date: 2005-11-16 22:12:24 +0100 (Wed, 16 Nov 2005)
New Revision: 412

Modified:
   trunk/TODO
   trunk/nymbaron/Server/Main.py
Log:
Fix the base64 encoding issue (yet untested).


Modified: trunk/TODO
===================================================================
--- trunk/TODO	2005-11-16 20:22:21 UTC (rev 411)
+++ trunk/TODO	2005-11-16 21:12:24 UTC (rev 412)
@@ -8,8 +8,8 @@
         D Deferred
         X Abandoned
 
- * be able to cope with base64 encoded as well as raw binary input
-   flawlessly for nymbaron -m [server]
+ . be able to cope with base64 encoded as well as raw binary input
+   flawlessly for nymbaron -m [server] UNTESTED.
  * let the user set the domainname of the account when known.
  . do not return silently without giving explanation of what went wrong or what
    was done

Modified: trunk/nymbaron/Server/Main.py
===================================================================
--- trunk/nymbaron/Server/Main.py	2005-11-16 20:22:21 UTC (rev 411)
+++ trunk/nymbaron/Server/Main.py	2005-11-16 21:12:24 UTC (rev 412)
@@ -273,7 +273,16 @@
 	    processIncoming(a, sys.stdin.read())
 	    sys.exit(0)
 	if o == "-m":
-	    processMessage(sys.stdin.read())
+	    try:
+		processMessage(sys.stdin.read())
+	    except Message.ParseError:
+		# see if we got a base64 encoded message.
+		import base64
+		import re
+		m = re.search("binary\\n\\n(.*)\\n---", sys.stdin.read(), re.S)
+		if m:
+		    processMessage(base64.decodestring(m.group(1)))
+		else: sys.stderr.write("Unable to find valid control message")
 	    sys.exit(0)
 
 if __name__ == '__main__':



More information about the Nym3-commit mailing list