mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-13 22:03:04 +00:00
mutable/servermap.py: stop reaching into private MutableFileNode attributes
This commit is contained in:
parent
eb18686284
commit
aa3caf812d
@ -149,7 +149,8 @@ class MutableFileNode:
|
||||
self._privkey = privkey
|
||||
def _populate_encprivkey(self, encprivkey):
|
||||
self._encprivkey = encprivkey
|
||||
|
||||
def _add_to_cache(self, verinfo, shnum, offset, data, timestamp):
|
||||
self._cache.add(verinfo, shnum, offset, data, timestamp)
|
||||
|
||||
def get_write_enabler(self, peerid):
|
||||
assert len(peerid) == 20
|
||||
@ -171,6 +172,8 @@ class MutableFileNode:
|
||||
return self._readkey
|
||||
def get_storage_index(self):
|
||||
return self._storage_index
|
||||
def get_fingerprint(self):
|
||||
return self._fingerprint
|
||||
def get_privkey(self):
|
||||
return self._privkey
|
||||
def get_encprivkey(self):
|
||||
|
@ -379,7 +379,7 @@ class ServermapUpdater:
|
||||
# we use unpack_prefix_and_signature, so we need 1k
|
||||
self._read_size = 1000
|
||||
self._need_privkey = False
|
||||
if mode == MODE_WRITE and not self._node._privkey:
|
||||
if mode == MODE_WRITE and not self._node.get_privkey():
|
||||
self._need_privkey = True
|
||||
# check+repair: repair requires the privkey, so if we didn't happen
|
||||
# to ask for it during the check, we'll have problems doing the
|
||||
@ -595,7 +595,7 @@ class ServermapUpdater:
|
||||
verinfo = self._got_results_one_share(shnum, data, peerid, lp)
|
||||
last_verinfo = verinfo
|
||||
last_shnum = shnum
|
||||
self._node._cache.add(verinfo, shnum, 0, data, now)
|
||||
self._node._add_to_cache(verinfo, shnum, 0, data, now)
|
||||
except CorruptShareError, e:
|
||||
# log it and give the other shares a chance to be processed
|
||||
f = failure.Failure()
|
||||
@ -657,7 +657,7 @@ class ServermapUpdater:
|
||||
if not self._node.get_pubkey():
|
||||
fingerprint = hashutil.ssk_pubkey_fingerprint_hash(pubkey_s)
|
||||
assert len(fingerprint) == 32
|
||||
if fingerprint != self._node._fingerprint:
|
||||
if fingerprint != self._node.get_fingerprint():
|
||||
raise CorruptShareError(peerid, shnum,
|
||||
"pubkey doesn't match fingerprint")
|
||||
self._node._populate_pubkey(self._deserialize_pubkey(pubkey_s))
|
||||
@ -674,7 +674,7 @@ class ServermapUpdater:
|
||||
|
||||
if verinfo not in self._valid_versions:
|
||||
# it's a new pair. Verify the signature.
|
||||
valid = self._node._pubkey.verify(prefix, signature)
|
||||
valid = self._node.get_pubkey().verify(prefix, signature)
|
||||
if not valid:
|
||||
raise CorruptShareError(peerid, shnum, "signature is invalid")
|
||||
|
||||
|
@ -714,7 +714,7 @@ class Servermap(unittest.TestCase, PublishMixin):
|
||||
d.addCallback(lambda res: ms(mode=MODE_WRITE))
|
||||
d.addCallback(lambda sm: self.failUnlessOneRecoverable(sm, 10))
|
||||
d.addCallback(lambda res: ms(mode=MODE_READ))
|
||||
# this more stops at k+epsilon, and epsilon=k, so 6 shares
|
||||
# this mode stops at k+epsilon, and epsilon=k, so 6 shares
|
||||
d.addCallback(lambda sm: self.failUnlessOneRecoverable(sm, 6))
|
||||
d.addCallback(lambda res: ms(mode=MODE_ANYTHING))
|
||||
# this mode stops at 'k' shares
|
||||
|
Loading…
x
Reference in New Issue
Block a user