grub2/0106-grub-core-normal-main.c-Don-t-drop-to-rescue-console.patch

117 lines
3.6 KiB
Diff
Raw Normal View History

From 41c6f91fce842b6c9565b8a61bf6289ba0f5cd6a Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Sun, 21 Sep 2014 18:51:09 +0200
Subject: [PATCH 106/506] * grub-core/normal/main.c: Don't drop to
rescue console in case of password-protected prompt and no menu entries.
---
ChangeLog | 5 +++++
grub-core/normal/main.c | 10 +++++++---
grub-core/normal/menu.c | 2 +-
grub-core/normal/menu_entry.c | 2 +-
grub-core/tests/cmdline_cat_test.c | 2 +-
include/grub/normal.h | 2 +-
6 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6d4e295..002461c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2014-09-21 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/normal/main.c: Don't drop to rescue console in
+ case of password-protected prompt and no menu entries.
+
+2014-09-21 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/commands/keylayouts.c: Ignore unknown keys.
2014-09-21 Vladimir Serbinenko <phcoder@gmail.com>
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index 3a926fc..c41f175 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -302,7 +302,7 @@ grub_enter_normal_mode (const char *config)
nested_level++;
grub_normal_execute (config, 0, 0);
grub_boot_time ("Entering shell");
- grub_cmdline_run (0);
+ grub_cmdline_run (0, 1);
nested_level--;
if (grub_normal_exit_level)
grub_normal_exit_level--;
@@ -424,11 +424,15 @@ grub_normal_read_line (char **line, int cont,
}
void
-grub_cmdline_run (int nested)
+grub_cmdline_run (int nested, int force_auth)
{
grub_err_t err = GRUB_ERR_NONE;
- err = grub_auth_check_authentication (NULL);
+ do
+ {
+ err = grub_auth_check_authentication (NULL);
+ }
+ while (err && force_auth);
if (err)
{
diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c
index b47991a..719e2fb 100644
--- a/grub-core/normal/menu.c
+++ b/grub-core/normal/menu.c
@@ -773,7 +773,7 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
case 'c':
menu_fini ();
- grub_cmdline_run (1);
+ grub_cmdline_run (1, 0);
goto refresh;
case 'e':
diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c
index b485df8..62c7e16 100644
--- a/grub-core/normal/menu_entry.c
+++ b/grub-core/normal/menu_entry.c
@@ -1396,7 +1396,7 @@ grub_menu_entry_run (grub_menu_entry_t entry)
case GRUB_TERM_CTRL | 'c':
case GRUB_TERM_KEY_F2:
- grub_cmdline_run (1);
+ grub_cmdline_run (1, 0);
goto refresh;
case GRUB_TERM_CTRL | 'x':
diff --git a/grub-core/tests/cmdline_cat_test.c b/grub-core/tests/cmdline_cat_test.c
index c3de5c4..f1e2143 100644
--- a/grub-core/tests/cmdline_cat_test.c
+++ b/grub-core/tests/cmdline_cat_test.c
@@ -109,7 +109,7 @@ cmdline_cat_test (void)
grub_video_checksum ("cmdline_cat");
if (!grub_test_use_gfxterm ())
- grub_cmdline_run (1);
+ grub_cmdline_run (1, 0);
grub_test_use_gfxterm_end ();
diff --git a/include/grub/normal.h b/include/grub/normal.h
index c4ab193..218cbab 100644
--- a/include/grub/normal.h
+++ b/include/grub/normal.h
@@ -66,7 +66,7 @@ void grub_menu_init_page (int nested, int edit,
struct grub_term_output *term);
void grub_normal_init_page (struct grub_term_output *term, int y);
char *grub_file_getline (grub_file_t file);
-void grub_cmdline_run (int nested);
+void grub_cmdline_run (int nested, int force_auth);
/* Defined in `cmdline.c'. */
char *grub_cmdline_get (const char *prompt);
--
2.4.3