[Nym3-commit] r313 - in trunk/nymbaron: . Client

jr at conuropsis.org jr at conuropsis.org
Mon Sep 26 23:56:06 CEST 2005


Author: jr
Date: 2005-09-26 23:56:05 +0200 (Mon, 26 Sep 2005)
New Revision: 313

Modified:
   trunk/nymbaron/Client/Main.py
   trunk/nymbaron/TODO
Log:
- add a command to change the pasphrase of the keyring
- add a missing import


Modified: trunk/nymbaron/Client/Main.py
===================================================================
--- trunk/nymbaron/Client/Main.py	2005-09-26 21:28:50 UTC (rev 312)
+++ trunk/nymbaron/Client/Main.py	2005-09-26 21:56:05 UTC (rev 313)
@@ -33,6 +33,7 @@
 import string
 import binascii
 import termios
+import pickle
 from optparse import OptionParser, make_option
 from nymbaron.Message import SToCCODE
 import nymbaron.Client.Account as Account
@@ -66,7 +67,8 @@
     \t\t\tyet
     \tldelete\t\tDelete messages from the local mbox
     \tldelete-syn\tDelete synopses from the local synbox
-    \tlist-accounts\tList the accounts of the user"""
+    \tlist-accounts\tList the accounts of the user
+    \tpasswd\t\tChange the passphrase that protects the user keyring"""
 
 class CLI:
     def __init__(self):
@@ -604,6 +606,21 @@
 	#TODO be more verbose?
 	ui.display("%s@%s" % (nickname, a['servername']))
 
+def passwd(ui, config):
+    """changes the passphrase protecting the user Keyring"""
+    secring = Keyring.Keyring(config.secring_path)
+    while True:
+	passphrase1 = ui.prompthidden("Type your old passphrase")
+	if secring.decrypt(passphrase1): break
+	ui.display("wrong passphrase")
+    while True:
+	passphrase1 = ui.prompthidden("Type your new passphrase")
+	passphrase2 = ui.prompthidden("Again")
+	if passphrase1 == passphrase2: break
+	# TODO : warn for an empty passphrase.
+	ui.display("Passphrases do not match.")
+    secring.save(passphrase1);
+
 def export(ui, config, nickname, output = None, args = []):
     account = get_account_from_nickname(ui, config, nickname,
 	    "No nickname given, abort\nUse -n <nickname>")
@@ -911,6 +928,12 @@
 	list_accounts(ui, config)
 	sys.exit(0)
 
+    if args[1] == "passwd":
+	ui = CLI()
+	config = Config.Config()
+	passwd(ui, config)
+	sys.exit(0)
+
 def minion_decode(input, output, passphrase):
     (outr, outw) = os.pipe()
     (passr, passw) = os.pipe()

Modified: trunk/nymbaron/TODO
===================================================================
--- trunk/nymbaron/TODO	2005-09-26 21:28:50 UTC (rev 312)
+++ trunk/nymbaron/TODO	2005-09-26 21:56:05 UTC (rev 313)
@@ -8,11 +8,12 @@
         D Deferred
         X Abandoned
 
- - add command to change keyring passphrase [client]
+ - reorder the items of the usage string [client]
  - use clean_surbs once in a while [server]
  - periodically scan for emails that need to be relayed [server]
  - periodically scan for synopses that have stayed that need to be encrypted
  [server]
+ o add command to change keyring passphrase [client]
  o add command to list accounts [client]
  o use `email' lib to fiddle with an email to relay [server]
  o provide a `list-journal' command and a way to resend commands [client]



More information about the Nym3-commit mailing list