udisks2/udisks-2.6.5-fix-crypttab-n...

61 lines
2.0 KiB
Diff

From fe99b1f8e790e0f4c466ad027a9d1a017b842d01 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Mon, 4 Dec 2017 14:53:14 +0100
Subject: [PATCH] Always try to read configuration from crypttab in
handle_unlock
Even if we have passphrase from user, we still need to check
crypttab for name and options.
---
src/udiskslinuxencrypted.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/src/udiskslinuxencrypted.c b/src/udiskslinuxencrypted.c
index 5789eff..16a404d 100644
--- a/src/udiskslinuxencrypted.c
+++ b/src/udiskslinuxencrypted.c
@@ -325,6 +325,20 @@ handle_unlock (UDisksEncrypted *encrypted,
goto out;
}
+ /* check if in crypttab file */
+ error = NULL;
+ if (!check_crypttab (block,
+ TRUE,
+ &is_in_crypttab,
+ &crypttab_name,
+ &crypttab_passphrase,
+ &crypttab_options,
+ &error))
+ {
+ g_dbus_method_invocation_take_error (invocation, error);
+ goto out;
+ }
+
/* we need the uid of the caller for the unlocked-luks file */
error = NULL;
if (!udisks_daemon_util_get_caller_uid_sync (daemon, invocation, NULL /* GCancellable */, &caller_uid, NULL, NULL, &error))
@@ -345,19 +359,6 @@ handle_unlock (UDisksEncrypted *encrypted,
}
else
{
- /* check if in crypttab file */
- error = NULL;
- if (!check_crypttab (block,
- TRUE,
- &is_in_crypttab,
- &crypttab_name,
- &crypttab_passphrase,
- &crypttab_options,
- &error))
- {
- g_dbus_method_invocation_take_error (invocation, error);
- goto out;
- }
if (is_in_crypttab && crypttab_passphrase != NULL && strlen (crypttab_passphrase) > 0)
{
effective_passphrase = g_string_new (crypttab_passphrase);
--
1.8.3.1