[cryptsetup-luks/f16] Fix isLuks message (should appear only in verbose mode). Fix luksKillSLot exit code if slot is inact
okozina
okozina at fedoraproject.org
Thu Dec 22 14:23:32 UTC 2011
commit 17cd19e874c23fc7795bff65051156da641b17b0
Author: Ondrej Kozina <okozina at redhat.com>
Date: Thu Dec 22 15:16:30 2011 +0100
Fix isLuks message (should appear only in verbose mode).
Fix luksKillSLot exit code if slot is inactive or invalid.
cryptsetup-1.4.0-isluks_verbose.patch | 33 ++++++++++++++++++++++++++
cryptsetup-1.4.0_rc1-lukskillslot.patch | 39 +++++++++++++++++++++++++++++++
2 files changed, 72 insertions(+), 0 deletions(-)
---
diff --git a/cryptsetup-1.4.0-isluks_verbose.patch b/cryptsetup-1.4.0-isluks_verbose.patch
new file mode 100644
index 0000000..bf2964b
--- /dev/null
+++ b/cryptsetup-1.4.0-isluks_verbose.patch
@@ -0,0 +1,33 @@
+--- a/ChangeLog 2011-12-21 16:09:15.903613888 +0100
++++ b/ChangeLog 2011-12-21 16:12:34.009962766 +0100
+@@ -1,3 +1,6 @@
++2011-12-21 Ondrej Kozina <okozina at redhat.com>
++ * Print informative message in isLuks only in verbose mode.
++
+ 2011-06-08 Milan Broz <mbroz at redhat.com>
+ * Fix return code for status command when device doesn't exists.
+
+--- a/src/cryptsetup.c 2011-12-21 16:30:02.903719526 +0100
++++ b/src/cryptsetup.c 2011-12-21 16:32:00.727789625 +0100
+@@ -187,6 +187,13 @@ static void _log(int level, const char *
+ }
+ }
+
++static void _quiet_log(int level, const char *msg, void *usrptr)
++{
++ if (!opt_verbose && (level == CRYPT_LOG_ERROR || level == CRYPT_LOG_NORMAL))
++ level = CRYPT_LOG_VERBOSE;
++ _log(level, msg, usrptr);
++}
++
+ static void show_status(int errcode)
+ {
+ char error[256], *error_;
+@@ -817,6 +824,7 @@ static int action_isLuks(int arg __attri
+ if ((r = crypt_init(&cd, action_argv[0])))
+ goto out;
+
++ crypt_set_log_callback(cd, _quiet_log, NULL);
+ r = crypt_load(cd, CRYPT_LUKS1, NULL);
+ out:
+ crypt_free(cd);
diff --git a/cryptsetup-1.4.0_rc1-lukskillslot.patch b/cryptsetup-1.4.0_rc1-lukskillslot.patch
new file mode 100644
index 0000000..ea31afb
--- /dev/null
+++ b/cryptsetup-1.4.0_rc1-lukskillslot.patch
@@ -0,0 +1,39 @@
+--- a/ChangeLog 2011-12-21 16:35:08.145307411 +0100
++++ b/ChangeLog 2011-12-21 16:36:49.838516700 +0100
+@@ -1,5 +1,6 @@
+ 2011-12-21 Ondrej Kozina <okozina at redhat.com>
+ * Print informative message in isLuks only in verbose mode.
++ * Fix luksKillSLot exit code if slot is inactive or invalid.
+
+ 2011-06-08 Milan Broz <mbroz at redhat.com>
+ * Fix return code for status command when device doesn't exists.
+--- a/src/cryptsetup.c 2011-12-21 16:35:08.146307395 +0100
++++ b/src/cryptsetup.c 2011-12-21 16:39:50.679097217 +0100
+@@ -613,6 +613,7 @@ static int action_luksKillSlot(int arg __attribute__((unused)))
+ case CRYPT_SLOT_INACTIVE:
+ log_err(_("Key %d not active. Can't wipe.\n"), opt_key_slot);
+ case CRYPT_SLOT_INVALID:
++ r = -EINVAL;
+ goto out;
+ }
+
+@@ -1245,7 +1245,7 @@ int main(int argc, const char **argv)
+ if (!strcmp(aname, "luksKillSlot") && action_argc > 1)
+ opt_key_slot = atoi(action_argv[1]);
+ 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."),
+ poptGetInvocationName(popt_context));
+
+--- a/tests/compat-test 2011-12-21 15:59:53.809001558 +0100
++++ b/tests/compat-test 2011-12-21 16:41:34.850272053 +0100
+@@ -126,6 +126,8 @@ echo "key1" | $CRYPTSETUP luksOpen $LOOP
+
+ # Unsuccessful Key Delete - nothing may change
+ prepare "[7] unsuccessful delete"
++$CRYPTSETUP -q luksKillSlot $LOOPDEV 8 2>/dev/null && fail
++$CRYPTSETUP -q luksKillSlot $LOOPDEV 7 2>/dev/null && fail
+ echo "invalid" | $CRYPTSETUP luksKillSlot $LOOPDEV 1 2>/dev/null && fail
+ check
+
More information about the scm-commits
mailing list