X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/distorted-keys/blobdiff_plain/c47f2aba7d705252c660ba1ad0931fbb93122d80..7b1fe7a30da02085479a6d5c3b3f8f0fc7fddf65:/cryptop.recover diff --git a/cryptop.recover b/cryptop.recover old mode 100644 new mode 100755 index f661569..f1fc9db --- a/cryptop.recover +++ b/cryptop.recover @@ -28,21 +28,34 @@ case "${KEYSLIB+t}" in t) ;; *) echo >&2 "$0: KEYSLIB unset"; exit 1 ;; esac . "$KEYSLIB"/keyfunc.sh defhelp <&2 "$quis: unknown key \`$key'"; exit 1; fi +checkword "recovery instance" "$inst" checkword "recovery key label" "$recov" +case $kowner in + $USERV_USER) ;; + *) echo >&2 "$quis: you're not the owner of key \`$key'"; exit 1 ;; +esac mktmp nubid=$(cat $kdir/nubid) readmeta $kdir -read_profile "$profile" +read_profile $kowner "$profile" if [ -f $knub ]; then nubbin=$(nubid <$knub) case "$nubbin" in @@ -54,11 +67,12 @@ if [ -f $knub ]; then fi umask 077 -recover $recov $kowner/$klabel >$knub.new +recover $recov $inst $kowner/$klabel >$knub.new nubbin=$(nubid <$knub.new) case "$nubbin" in "$nubid") ;; *) + rm -f $knub.new echo >&2 "$quis: recovery produced incorrect nub" exit 1 ;;