diff options
author | Joey Hess <joey@kitenet.net> | 2013-10-01 14:10:45 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-10-01 14:38:46 -0400 |
commit | 5e242ed6de52c52bab51c94a23d8ad1fac80b6a4 (patch) | |
tree | 2e950d1d2185f9b4bdba4fbc20b72dac2f3518dc /Command/RecvKey.hs | |
parent | 142ba4db72679fa2b17eb4ae33ac7d9764a71b09 (diff) |
fix transferring to gcrypt repo from direct mode repo
recvkey was told it was receiving a HMAC key from a direct mode repo,
and that confused it into rejecting the transfer, since it has no way to
verify a key using that backend, since there is no HMAC backend.
I considered making recvkey skip verification in the case of an unknown
backend. However, that could lead to bad results; a key can legitimately be
in the annex with a backend that the remote git-annex-shell doesn't know
about. Better to keep it rejecting if it cannot verify.
Instead, made the gcrypt special remote not set the direct mode flag when
sending (and receiving) files.
Also, added some recvkey messages when its checks fail, since otherwise
all that is shown is a confusing error message from rsync when the remote
git-annex-shell exits nonzero.
Diffstat (limited to 'Command/RecvKey.hs')
-rw-r--r-- | Command/RecvKey.hs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Command/RecvKey.hs b/Command/RecvKey.hs index eb2c88ca9..3b2a8c496 100644 --- a/Command/RecvKey.hs +++ b/Command/RecvKey.hs @@ -72,7 +72,18 @@ start key = ifM (inAnnex key) return $ size == size' if oksize then case Backend.maybeLookupBackendName (Types.Key.keyBackendName key) of - Nothing -> return False - Just backend -> maybe (return True) (\a -> a key tmp) + Nothing -> do + warning "recvkey: received key from direct mode repository using unknown backend; cannot check; discarding" + return False + Just backend -> maybe (return True) runfsck (Types.Backend.fsckKey backend) - else return False + else do + warning "recvkey: received key with wrong size; discarding" + return False + where + runfsck check = ifM (check key tmp) + ( return True + , do + warning "recvkey: received key from direct mode repository seems to have changed as it was transferred; discarding" + return False + ) |