public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/grub2] rawhide: Change login error message
@ 2026-06-02 18:42 Josue Hernandez
0 siblings, 0 replies; only message in thread
From: Josue Hernandez @ 2026-06-02 18:42 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/grub2
Branch : rawhide
Commit : 1b5edb14bff6b022b6ff76c777bf1d522af74279
Author : Josue Hernandez <josherna@redhat.com>
Date : 2026-06-02T11:30:28-06:00
Stats : +134/-2 in 3 file(s)
URL : https://src.fedoraproject.org/rpms/grub2/c/1b5edb14bff6b022b6ff76c777bf1d522af74279?branch=rawhide
Log:
Change login error message
Login error message shows the line of code where it was called
which is not user friendly, This proposal adds better and more
human log messages when authentication fails
Signed-off-by: Josue Hernandez <josherna@redhat.com>
---
diff --git a/0436-Change-login-error-message.patch b/0436-Change-login-error-message.patch
new file mode 100644
index 0000000..b1b61ef
--- /dev/null
+++ b/0436-Change-login-error-message.patch
@@ -0,0 +1,128 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Josue Hernandez <josherna@redhat.com>
+Date: Mon, 25 May 2026 17:19:47 -0600
+Subject: [PATCH] Change login error message
+
+Login error message shows the line of code where it was called
+which is not user friendly, This proposal adds better and more
+human log messages when authentication fails
+
+Signed-off-by: Josue Hernandez <josherna@redhat.com>
+---
+ grub-core/commands/password.c | 2 +-
+ grub-core/commands/password_pbkdf2.c | 2 +-
+ grub-core/kern/err.c | 14 ++++++++++++++
+ grub-core/normal/auth.c | 17 +++++++++++++----
+ include/grub/err.h | 2 ++
+ 5 files changed, 31 insertions(+), 6 deletions(-)
+
+diff --git a/grub-core/commands/password.c b/grub-core/commands/password.c
+index 6d42c9b02..607ee6435 100644
+--- a/grub-core/commands/password.c
++++ b/grub-core/commands/password.c
+@@ -35,7 +35,7 @@ check_password (const char *user, const char *entered,
+ void *password)
+ {
+ if (grub_crypto_memcmp (entered, password, GRUB_AUTH_MAX_PASSLEN) != 0)
+- return GRUB_ACCESS_DENIED;
++ grub_user_error(GRUB_ERR_ACCESS_DENIED, N_("Authentication error"));
+
+ grub_auth_authenticate (user);
+
+diff --git a/grub-core/commands/password_pbkdf2.c b/grub-core/commands/password_pbkdf2.c
+index bcb902f97..915fcdc47 100644
+--- a/grub-core/commands/password_pbkdf2.c
++++ b/grub-core/commands/password_pbkdf2.c
+@@ -58,7 +58,7 @@ check_password (const char *user, const char *entered, void *pin)
+ if (err)
+ ret = grub_crypto_gcry_error (err);
+ else if (grub_crypto_memcmp (buf, pass->expected, pass->buflen) != 0)
+- ret = GRUB_ACCESS_DENIED;
++ ret = grub_user_error(GRUB_ERR_ACCESS_DENIED, N_("Authentication error"));
+ else
+ {
+ grub_auth_authenticate (user);
+diff --git a/grub-core/kern/err.c b/grub-core/kern/err.c
+index ba04b57fb..f4c1b42c5 100644
+--- a/grub-core/kern/err.c
++++ b/grub-core/kern/err.c
+@@ -37,6 +37,20 @@ static int grub_error_stack_assert;
+ #undef grub_error
+ #endif
+
++grub_err_t
++grub_user_error (grub_err_t n, const char *fmt, ...)
++{
++ va_list ap;
++
++ grub_errno = n;
++
++ va_start (ap, fmt);
++ grub_vsnprintf (grub_errmsg, sizeof (grub_errmsg), _(fmt), ap);
++ va_end (ap);
++
++ return n;
++}
++
+ grub_err_t
+ grub_error (grub_err_t n, const char *file, const char *function, const int line, const char *fmt, ...)
+ {
+diff --git a/grub-core/normal/auth.c b/grub-core/normal/auth.c
+index 71b361bc0..005de2fd9 100644
+--- a/grub-core/normal/auth.c
++++ b/grub-core/normal/auth.c
+@@ -253,12 +253,18 @@ grub_auth_check_authentication (const char *userlist)
+ grub_puts_ (N_("Enter username: "));
+
+ if (!grub_username_get (login, sizeof (login) - 1))
+- goto access_denied;
++ {
++ grub_user_error(GRUB_ERR_ACCESS_DENIED, N_("Error getting user"));
++ goto access_denied;
++ }
+
+ grub_puts_ (N_("Enter password: "));
+
+ if (!grub_password_get (entered, GRUB_AUTH_MAX_PASSLEN))
+- goto access_denied;
++ {
++ grub_user_error(GRUB_ERR_ACCESS_DENIED, N_("Error getting password"));
++ goto access_denied;
++ }
+
+ FOR_LIST_ELEMENTS (user, users)
+ {
+@@ -267,7 +273,10 @@ grub_auth_check_authentication (const char *userlist)
+ }
+
+ if (!cur || ! cur->callback)
+- goto access_denied;
++ {
++ grub_user_error(GRUB_ERR_ACCESS_DENIED, N_("Authentication error"));
++ goto access_denied;
++ }
+
+ cur->callback (login, entered, cur->arg);
+ if (is_authenticated (userlist))
+@@ -282,7 +291,7 @@ grub_auth_check_authentication (const char *userlist)
+ if (punishment_delay < GRUB_ULONG_MAX / 2)
+ punishment_delay *= 2;
+
+- return GRUB_ACCESS_DENIED;
++ return GRUB_ERR_ACCESS_DENIED;
+ }
+
+ static grub_err_t
+diff --git a/include/grub/err.h b/include/grub/err.h
+index 6379a6baf..dbd82b2ae 100644
+--- a/include/grub/err.h
++++ b/include/grub/err.h
+@@ -90,6 +90,8 @@ extern char EXPORT_VAR(grub_errmsg)[GRUB_MAX_ERRMSG];
+
+ grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *file, const char *function, const int line, const char *fmt, ...)
+ __attribute__ ((format (GNU_PRINTF, 5, 6)));
++grub_err_t EXPORT_FUNC(grub_user_error) (grub_err_t n, const char *fmt, ...)
++ __attribute__ ((format (GNU_PRINTF, 2, 3)));
+
+ #define grub_error(n, fmt, ...) grub_error (n, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
+
diff --git a/grub.patches b/grub.patches
index 681f835..c5fb4b5 100644
--- a/grub.patches
+++ b/grub.patches
@@ -431,4 +431,5 @@ Patch0431: 0431-commands-efi-tpm.c-check-if-PCR-is-enable-before-TPM.patch
Patch0432: 0432-tpm.c-disable-PCR8-measurements-at-the-configuration.patch
Patch0433: 0433-Add-support-for-efi-keyword.patch
Patch0434: 0434-tpm-Disable-any-GRUB_STRING_PCR-command-measurement.patch
-Patch0435: 0435-util-grub-editenv-remove-stale-env_block-on-unsuppor.patch
\ No newline at end of file
+Patch0435: 0435-util-grub-editenv-remove-stale-env_block-on-unsuppor.patch
+Patch0436: 0436-Change-login-error-message.patch
diff --git a/grub2.spec b/grub2.spec
index fee15fc..865fdc9 100644
--- a/grub2.spec
+++ b/grub2.spec
@@ -17,7 +17,7 @@
Name: grub2
Epoch: 1
Version: 2.12
-Release: 60%{?dist}
+Release: 61%{?dist}
Summary: Bootloader with support for Linux, Multiboot and more
License: GPL-3.0-or-later
URL: http://www.gnu.org/software/grub/
@@ -621,6 +621,9 @@ fi
%endif
%changelog
+* Tue May 26 2026 Josue Hernandez <josherna@redhat.com> - 2.12-61
+- Change login error message for more user frienly version
+
* Thu May 07 2026 Leo Sandoval <lsandova@redhat.com> - 2.12-60
- util/grub-editenv: remove stale env_block on unsupported filesystem
- Related: #2457333
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-06-02 18:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-02 18:42 [rpms/grub2] rawhide: Change login error message Josue Hernandez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox