[Nym3-commit] r404 - trunk/nymbaron/Client
jr at conuropsis.org
jr at conuropsis.org
Wed Nov 16 09:16:16 CET 2005
Author: jr
Date: 2005-11-16 09:16:15 +0100 (Wed, 16 Nov 2005)
New Revision: 404
Modified:
trunk/nymbaron/Client/Main.py
Log:
- bug fix: missing ')' and mixminion passphrase error
Modified: trunk/nymbaron/Client/Main.py
===================================================================
--- trunk/nymbaron/Client/Main.py 2005-11-15 21:46:06 UTC (rev 403)
+++ trunk/nymbaron/Client/Main.py 2005-11-16 08:16:15 UTC (rev 404)
@@ -74,6 +74,9 @@
\tremove-accounts\Remove a local account
\tpasswd\t\tChange the passphrase that protects the user keyring"""
+class WrongPassword(Exception): pass
+"""Exception thrown when a wrong password was given"""
+
class CLI:
def __init__(self):
pass
@@ -319,7 +322,7 @@
ui.display("Synopses received. Use list-syn to check them")
else:
ui.display("Empty Summary received, this is probably a bug in" +
- "the server implementation"
+ "the server implementation")
elif (com.ct() == SToCCODE['Msg']):
account.add_msg(com.mid, com.msg)
ui.display("Message %s received" % binascii.hexlify(com.mid))
@@ -1059,10 +1062,16 @@
(fd, name) = tempfile.mkstemp()
os.write(fd, msg)
os.close(fd)
- pp = ui.prompthidden("Please enter your mixminion passphrase")
(fdo, nameo) = tempfile.mkstemp()
os.close(fdo)
- id = minion_decode(name, nameo, pp)
+ while True:
+ try:
+ pp = ui.prompthidden("Please enter your mixminion passphrase")
+ id = minion_decode(name, nameo, pp)
+ break
+ except WrongPassword:
+ ui.display("Wrong mixminion passphrase")
+ pass
os.unlink(name)
tm = Account.TagMap(config.path + os.sep + 'tagmap')
nick = tm.nickFromId(id)
@@ -1136,6 +1145,9 @@
out = foo.readlines()
foo.close()
os.wait()
+ #TODO string.join is deprecated
+ if not re.search("[ERROR] Incorrect password", string.join(out)):
+ raise WrongPassword()
id = re.search("identity '(.*)'", string.join(out)).group(1)
return id
More information about the Nym3-commit
mailing list