mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-16 05:10:03 +01:00
Fix luksKillSLot exit code if slot is inactive or invalid. (Issue 108)
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@624 36d66b0a-2a48-0410-832c-cd162a569da5
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
* Support Nettle 2.4 crypto backend (for ripemd160).
|
* Support Nettle 2.4 crypto backend (for ripemd160).
|
||||||
* If device is not rotational, do not use Gutmann wipe method.
|
* If device is not rotational, do not use Gutmann wipe method.
|
||||||
* Add crypt_last_error() API call.
|
* Add crypt_last_error() API call.
|
||||||
|
* Fix luksKillSLot exit code if slot is inactive or invalid.
|
||||||
|
|
||||||
2011-09-22 Milan Broz <mbroz@redhat.com>
|
2011-09-22 Milan Broz <mbroz@redhat.com>
|
||||||
* Support key-slot option for luksOpen (use only explicit keyslot).
|
* Support key-slot option for luksOpen (use only explicit keyslot).
|
||||||
|
|||||||
@@ -646,6 +646,7 @@ static int action_luksKillSlot(int arg __attribute__((unused)))
|
|||||||
case CRYPT_SLOT_INACTIVE:
|
case CRYPT_SLOT_INACTIVE:
|
||||||
log_err(_("Key %d not active. Can't wipe.\n"), opt_key_slot);
|
log_err(_("Key %d not active. Can't wipe.\n"), opt_key_slot);
|
||||||
case CRYPT_SLOT_INVALID:
|
case CRYPT_SLOT_INVALID:
|
||||||
|
r = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1301,7 +1302,7 @@ int main(int argc, const char **argv)
|
|||||||
if (!strcmp(aname, "luksKillSlot") && action_argc > 1)
|
if (!strcmp(aname, "luksKillSlot") && action_argc > 1)
|
||||||
opt_key_slot = atoi(action_argv[1]);
|
opt_key_slot = atoi(action_argv[1]);
|
||||||
if (opt_key_slot != CRYPT_ANY_SLOT &&
|
if (opt_key_slot != CRYPT_ANY_SLOT &&
|
||||||
(opt_key_slot < 0 || opt_key_slot > crypt_keyslot_max(CRYPT_LUKS1)))
|
(opt_key_slot < 0 || opt_key_slot >= crypt_keyslot_max(CRYPT_LUKS1)))
|
||||||
usage(popt_context, EXIT_FAILURE, _("Key slot is invalid."),
|
usage(popt_context, EXIT_FAILURE, _("Key slot is invalid."),
|
||||||
poptGetInvocationName(popt_context));
|
poptGetInvocationName(popt_context));
|
||||||
|
|
||||||
|
|||||||
@@ -160,6 +160,8 @@ echo "key1" | $CRYPTSETUP luksOpen $LOOPDEV $DEV_NAME || fail
|
|||||||
# Unsuccessful Key Delete - nothing may change
|
# Unsuccessful Key Delete - nothing may change
|
||||||
prepare "[7] unsuccessful delete"
|
prepare "[7] unsuccessful delete"
|
||||||
echo "invalid" | $CRYPTSETUP luksKillSlot $LOOPDEV 1 2>/dev/null && fail
|
echo "invalid" | $CRYPTSETUP luksKillSlot $LOOPDEV 1 2>/dev/null && fail
|
||||||
|
$CRYPTSETUP -q luksKillSlot $LOOPDEV 8 2>/dev/null && fail
|
||||||
|
$CRYPTSETUP -q luksKillSlot $LOOPDEV 7 2>/dev/null && fail
|
||||||
check
|
check
|
||||||
|
|
||||||
# Delete Key Test
|
# Delete Key Test
|
||||||
|
|||||||
Reference in New Issue
Block a user