From: robk-tahoe Date: Mon, 24 Mar 2008 22:47:12 +0000 (-0700) Subject: confwiz: set a convergence domain based on root_dir upon config X-Git-Tag: allmydata-tahoe-1.0.0~8 X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri/frontends/%22news.html?a=commitdiff_plain;h=7f14b933411ff43bb9dc8b2cc837777c8cc4b29e;p=tahoe-lafs%2Ftahoe-lafs.git confwiz: set a convergence domain based on root_dir upon config when the confwiz configures a node (i.e. typically once on mac, once per install on windows) in addition to writing the root_dir.cap retrieved from the native_client backend into a config file, it additionally writes a hash thereof into the 'convergence' config file. this causes uploads from this node to use a consistent 'convergence' hashing value matching any other nodes with the same configured root_dir, i.e. for the most part other systems installed and configured on the same account. --- diff --git a/src/allmydata/gui/confwiz.py b/src/allmydata/gui/confwiz.py index b4c21c46..e389b1ac 100644 --- a/src/allmydata/gui/confwiz.py +++ b/src/allmydata/gui/confwiz.py @@ -7,6 +7,8 @@ WELCOME_PAGE = 'welcome_install' TAHOESVC_NAME = 'Tahoe' WINFUSESVC_NAME = 'Allmydata SMB' +CONVERGENCE_DOMAIN_TAG = "allmydata_root_cap_to_convergence_domain_tag_v1" + import os import re import socket @@ -19,6 +21,7 @@ import webbrowser import wx from allmydata.util.assertutil import precondition +from allmydata.util import hashutil, base32 from allmydata import uri import allmydata @@ -113,6 +116,11 @@ def write_config_file(filename, contents): iff.write(contents) iff.close() +def write_root_cap(root_cap): + write_config_file('private/root_dir.cap', root_cap+'\n') + convergence = base32.b2a(hashutil.tagged_hash(CONVERGENCE_DOMAIN_TAG, root_cap)) + write_config_file('private/convergence', convergence+'\n') + def get_nodeid(): CERTFILE = "node.pem" certfile = os.path.join(get_basedir(), "private", CERTFILE) @@ -350,7 +358,7 @@ class LoginPanel(wx.Panel): try: root_cap = get_root_cap(backend, user, passwd) - write_config_file('private/root_dir.cap', root_cap+'\n') + write_root_cap(root_cap) except AuthError: self.warning_label.SetLabel('Your email and/or password is incorrect') self.user_field.SetFocus() @@ -474,7 +482,7 @@ class RegisterPanel(wx.Panel): try: #print 'calling get_root_cap (ae)', time.asctime() root_cap = get_root_cap(backend, user, passwd) - write_config_file('private/root_dir.cap', root_cap+'\n') + write_root_cap(root_cap) except AuthError: self.warning_label.SetLabel('That email address is already registered') self.user_field.SetFocus() @@ -488,7 +496,7 @@ class RegisterPanel(wx.Panel): elif result_code == 'ok': #print 'calling get_root_cap (ok)', time.asctime() root_cap = get_root_cap(backend, user, passwd) - write_config_file('private/root_dir.cap', root_cap+'\n') + write_root_cap(root_cap) else: self.warning_label.SetLabel('an unexpected error occurred ("%s")' % (result_code,)) self.user_field.SetFocus()