- Resolves: CVE-2024-45779 CVE-2024-45778 CVE-2025-1118 - Resolves: CVE-2025-0677 CVE-2024-45782 CVE-2025-0690 - Resolves: CVE-2024-45783 CVE-2025-0624 CVE-2024-45776 - Resolves: CVE-2025-0622 CVE-2024-45774 CVE-2024-45775 - Resolves: CVE-2024-45781 CVE-2024-45780 - Resolves: #RHEL-79700 - Resolves: #RHEL-79341 - Resolves: #RHEL-79875 - Resolves: #RHEL-79849 - Resolves: #RHEL-79707 - Resolves: #RHEL-79857 - Resolves: #RHEL-79709 - Resolves: #RHEL-79846 - Resolves: #RHEL-75737 - Resolves: #RHEL-79713 - Resolves: #RHEL-73785 - Resolves: #RHEL-73787 - Resolves: #RHEL-79704 - Resolves: #RHEL-79702 Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
56 lines
1.9 KiB
Diff
56 lines
1.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Glenn Washburn <development@efficientek.com>
|
|
Date: Thu, 9 Dec 2021 11:14:53 -0600
|
|
Subject: [PATCH] cryptodisk: Improve error messaging in cryptomount
|
|
invocations
|
|
|
|
Update such that "cryptomount -u UUID" will not print two error messages
|
|
when an invalid passphrase is given and the most relevant error message
|
|
will be displayed.
|
|
|
|
Signed-off-by: Glenn Washburn <development@efficientek.com>
|
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
|
---
|
|
grub-core/disk/cryptodisk.c | 21 +++++++++++++++++----
|
|
1 file changed, 17 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c
|
|
index 2749187..3a896c6 100644
|
|
--- a/grub-core/disk/cryptodisk.c
|
|
+++ b/grub-core/disk/cryptodisk.c
|
|
@@ -1109,7 +1109,10 @@ grub_cryptodisk_scan_device (const char *name,
|
|
if (grub_errno == GRUB_ERR_BAD_MODULE)
|
|
grub_error_pop ();
|
|
|
|
- if (grub_errno != GRUB_ERR_NONE)
|
|
+ if (search_uuid != NULL)
|
|
+ /* Push error onto stack to save for cryptomount. */
|
|
+ grub_error_push ();
|
|
+ else
|
|
grub_print_error ();
|
|
|
|
cleanup:
|
|
@@ -1146,9 +1149,19 @@ grub_cmd_cryptomount (grub_extcmd_context_t ctxt, int argc, char **args)
|
|
found_uuid = grub_device_iterate (&grub_cryptodisk_scan_device, NULL);
|
|
search_uuid = NULL;
|
|
|
|
- if (!found_uuid)
|
|
- return grub_error (GRUB_ERR_BAD_ARGUMENT, "no such cryptodisk found");
|
|
- return GRUB_ERR_NONE;
|
|
+ if (found_uuid)
|
|
+ return GRUB_ERR_NONE;
|
|
+ else if (grub_errno == GRUB_ERR_NONE)
|
|
+ {
|
|
+ /*
|
|
+ * Try to pop the next error on the stack. If there is not one, then
|
|
+ * no device matched the given UUID.
|
|
+ */
|
|
+ grub_error_pop ();
|
|
+ if (grub_errno == GRUB_ERR_NONE)
|
|
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, "no such cryptodisk found");
|
|
+ }
|
|
+ return grub_errno;
|
|
}
|
|
else if (state[1].set || (argc == 0 && state[2].set))
|
|
{
|