Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1mx4f5-0003hk-NL for mharc-grub-devel@gnu.org; Tue, 14 Dec 2021 05:03:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mx4ez-0003hE-Sh for Grub-devel@gnu.org; Tue, 14 Dec 2021 05:03:50 -0500 Received: from smtpbg516.qq.com ([203.205.250.54]:60576) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mx4eu-0007rk-2M for Grub-devel@gnu.org; Tue, 14 Dec 2021 05:03:46 -0500 X-QQ-mid: bizesmtp52t1639476212tsfraoux Received: from localhost.localdomain (unknown [119.98.189.137]) by esmtp6.qq.com (ESMTP) with id ; Tue, 14 Dec 2021 18:03:32 +0800 (CST) X-QQ-SSF: 01400000002000D0D000B00D0000000 X-QQ-FEAT: l9UnPr2jXJ/WFNbvafyfA4lnL5gSCaKpjAE2tYmB7w8AYGTUikH4YMPbN9DGI NOxDIp2EI/EwLGQ2cwH2+Dr5Q+UVW4ZT0apG4dVbAq/XalqjJ45ViUzxPhQon+Urei3S1V2 utRx2IzANYtZgNAOlCFJB6RTBStaGbGyMMSiKmjzSlupVzyrM9eyisAtCzJkgKvTi9pMk43 0H/cossEO1MEoOBKudGMLheprktOQCcH7/aB1IXNsZjL/3rmp9zjnIAHAfLSfsWPlXjUUT/ 1PFh+YWwYTc+bmwBxgLmT7KeqDOgWSIpXFF+MAQQnQ0BTID0yTQsTIX2jMCJ0pKPMANEW9h F0cOYwp9loVkKQkY/Lm9PVmt7yvKKPd3DxmZCwB X-QQ-GoodBg: 2 From: zhouzilong To: Grub-devel@gnu.org Cc: zhouzilong@uniontech.com Subject: [PATCH] normal: Cancel the authentication when the submenu returns to the parent menu Date: Tue, 14 Dec 2021 18:03:23 +0800 Message-Id: <20211214100323.10892-1-zhouzilong@uniontech.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:uniontech.com:qybgforeign:qybgforeign1 X-QQ-Bgrelay: 1 Received-SPF: pass client-ip=203.205.250.54; envelope-from=zhouzilong@uniontech.com; helo=smtpbg516.qq.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Dec 2021 10:03:50 -0000 It could be confusing for the user to enter a menu entry with the "--Unrestricted" parameter set (no authentication required), but the user still needed to authenticate before returning to the parent menu via "ESC". This logic was probably incorrect, so I changed it. Signed-off-by: zhouzilong --- grub-core/normal/menu.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c index 8397886fa..fc2ca6ff0 100644 --- a/grub-core/normal/menu.c +++ b/grub-core/normal/menu.c @@ -897,13 +897,16 @@ grub_show_menu (grub_menu_t menu, int nested, int autoboot) if (grub_normal_exit_level) break; - err2 = grub_auth_check_authentication (NULL); - if (err2) - { - grub_print_error (); - grub_errno = GRUB_ERR_NONE; - continue; - } + if (!nested) + { + err2 = grub_auth_check_authentication (NULL); + if (err2) + { + grub_print_error (); + grub_errno = GRUB_ERR_NONE; + continue; + } + } break; } -- 2.20.1