mokutil/mokutil-clean-request.patch

43 lines
1.1 KiB
Diff
Raw Normal View History

From a8165e89893bbaf8245fda6a59bcfe562bee4854 Mon Sep 17 00:00:00 2001
From: Gary Ching-Pang Lin <glin@suse.com>
Date: Wed, 12 Feb 2014 15:57:51 +0800
Subject: [PATCH] Clean the request when all keys are removed
Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
---
src/mokutil.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/mokutil.c b/src/mokutil.c
index 935cb94..1c32313 100644
--- a/src/mokutil.c
+++ b/src/mokutil.c
@@ -513,6 +513,24 @@ delete_data_from_list (efi_guid_t type, void *data, uint32_t data_size,
if (start == NULL)
return 0;
+ /* all keys are removed */
+ if (total == 0) {
+ test_and_delete_var (var_name);
+
+ /* delete the password */
+ if (strcmp (var_name, "MokNew") == 0)
+ test_and_delete_var ("MokAuth");
+ else if (strcmp (var_name, "MokXNew") == 0)
+ test_and_delete_var ("MokXAuth");
+ else if (strcmp (var_name, "MokDel") == 0)
+ test_and_delete_var ("MokDelAuth");
+ else if (strcmp (var_name, "MokXDel") == 0)
+ test_and_delete_var ("MokXDelAuth");
+
+ ret = 1;
+ goto done;
+ }
+
/* remove the key or hash */
if (remain > 0)
memmove (start, end, remain);
--
1.8.4.5