From fc29aad6c55481b5a61061b4e1f6b9a9275fb627 Mon Sep 17 00:00:00 2001 From: songmingliang Date: Tue, 20 Aug 2024 16:26:52 +0800 Subject: [PATCH] check that the password contains the username (cherry picked from commit 6f807938cddf9a2be9988bf248a69c17d7177a91) --- ...t-the-password-contains-the-username.patch | 81 +++++++++++++++++++ anaconda.spec | 13 ++- 2 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 0001-check-that-the-password-contains-the-username.patch diff --git a/0001-check-that-the-password-contains-the-username.patch b/0001-check-that-the-password-contains-the-username.patch new file mode 100644 index 0000000..bc50e77 --- /dev/null +++ b/0001-check-that-the-password-contains-the-username.patch @@ -0,0 +1,81 @@ +From f5882812416bf30f840b1c683ad8f4bac459a82d Mon Sep 17 00:00:00 2001 +From: songmingliang +Date: Tue, 20 Aug 2024 16:04:58 +0800 +Subject: [PATCH] check that the password contains the username + +--- + pyanaconda/ui/gui/spokes/root_password.py | 2 ++ + pyanaconda/ui/tui/spokes/root_password.py | 1 + + pyanaconda/ui/tui/spokes/user.py | 1 + + pyanaconda/ui/tui/tuiobject.py | 11 +++++++++++ + 4 files changed, 15 insertions(+) + +diff --git a/pyanaconda/ui/gui/spokes/root_password.py b/pyanaconda/ui/gui/spokes/root_password.py +index a9157ab..90eda48 100644 +--- a/pyanaconda/ui/gui/spokes/root_password.py ++++ b/pyanaconda/ui/gui/spokes/root_password.py +@@ -101,6 +101,8 @@ class PasswordSpoke(FirstbootSpokeMixIn, NormalSpoke, GUISpokeInputCheckHandler) + initial_password_confirmation_content=self.password_confirmation, + policy_name=PASSWORD_POLICY_ROOT + ) ++ # configure root username for checking ++ self.checker.username = "root" + # configure the checker for password checking + self.checker.secret_type = constants.SecretType.PASSWORD + # remove any placeholder texts if either password or confirmation field changes content from initial state +diff --git a/pyanaconda/ui/tui/spokes/root_password.py b/pyanaconda/ui/tui/spokes/root_password.py +index dfaca4e..2dc39c0 100644 +--- a/pyanaconda/ui/tui/spokes/root_password.py ++++ b/pyanaconda/ui/tui/spokes/root_password.py +@@ -151,6 +151,7 @@ class RootPasswordSpoke(NormalTUISpoke): + func_args=(algo,) + ) + password_dialog.no_separator = True ++ password_dialog.username = "root" + self._password = password_dialog.run() + + if self._password is None: +diff --git a/pyanaconda/ui/tui/spokes/user.py b/pyanaconda/ui/tui/spokes/user.py +index a107063..e914c1c 100644 +--- a/pyanaconda/ui/tui/spokes/user.py ++++ b/pyanaconda/ui/tui/spokes/user.py +@@ -148,6 +148,7 @@ class UserSpoke(FirstbootSpokeMixIn, NormalTUISpoke): + title=_("Password"), + policy_name=PASSWORD_POLICY_USER + ) ++ password_dialog.username = self.user.name + if self.user.password: + entry = EntryWidget(password_dialog.title, _(PASSWORD_SET)) + else: +diff --git a/pyanaconda/ui/tui/tuiobject.py b/pyanaconda/ui/tui/tuiobject.py +index c642931..5a7f9a0 100644 +--- a/pyanaconda/ui/tui/tuiobject.py ++++ b/pyanaconda/ui/tui/tuiobject.py +@@ -218,6 +218,15 @@ class PasswordDialog(Dialog): + self._process_password = process_func + self._func_args = func_args + self._dialog_message = message ++ self._username = "" ++ ++ @property ++ def username(self): ++ return self._username ++ ++ @username.setter ++ def username(self, new_username): ++ self._username = new_username + + def run(self): + """Get password input from user and call setter callback at the end. +@@ -259,6 +268,8 @@ class PasswordDialog(Dialog): + password_check_request.password = password + password_check_request.password_confirmation = "" + password_check_request.policy = self._policy ++ # configure username for checking ++ password_check_request.username = self.username + + # validate the password + password_check = input_checking.PasswordValidityCheck() +-- +2.27.0 + diff --git a/anaconda.spec b/anaconda.spec index 9e9b3ce..fb00622 100644 --- a/anaconda.spec +++ b/anaconda.spec @@ -1,7 +1,7 @@ %define _empty_manifest_terminate_build 0 Name: anaconda Version: 36.16.5 -Release: 37 +Release: 38 Summary: Graphical system installer License: GPLv2+ and MIT URL: http://fedoraproject.org/wiki/Anaconda @@ -61,6 +61,8 @@ Patch9025: bugfix-import-new-BlockDev.patch Patch9026: bugfix-fix-custom-storage-chinese-tip.patch Patch10000: 0001-add-loongarch-support-for-anaconda.patch +# https://github.com/rhinstaller/anaconda/pull/4235 +Patch10001: 0001-check-that-the-password-contains-the-username.patch %define dasbusver 1.3 @@ -316,6 +318,15 @@ update-desktop-database &> /dev/null || : %{_prefix}/libexec/anaconda/dd_* %changelog +* Tue Aug 20 2024 songmingliang - 36.16.5-38 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC: Fix the root user creation GTK GUI not checking if a password + contains the user name. + Fix the non-root user creation Text UI not checking if a password + contains the user name. + * Wed Jun 26 2024 sunhai - 36.16.5-37 - Type:bugfix - ID:NA