From 5cf0fed2af19fc1e50c554b6ae63f566c0fecb2e Mon Sep 17 00:00:00 2001 From: Iker Pedrosa Date: Mon, 26 May 2025 12:10:33 +0200 Subject: [PATCH] vipw: restore the original terminal pgrp after editing Resolves: RHEL-93172 Signed-off-by: Iker Pedrosa --- shadow-4.15.0-vipw-restore-terminal.patch | 41 +++++++++++++++++++++++ shadow-utils.spec | 7 +++- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 shadow-4.15.0-vipw-restore-terminal.patch diff --git a/shadow-4.15.0-vipw-restore-terminal.patch b/shadow-4.15.0-vipw-restore-terminal.patch new file mode 100644 index 0000000..90fbc06 --- /dev/null +++ b/shadow-4.15.0-vipw-restore-terminal.patch @@ -0,0 +1,41 @@ +From 3b12ab7e29b0f3c766b39269da76a5ef3a753b22 Mon Sep 17 00:00:00 2001 +From: "Todd C. Miller" +Date: Thu, 23 Jan 2025 19:11:09 -0700 +Subject: [PATCH] src/vipw.c: Restore the original terminal pgrp after editing + +This fixes a problem when the shell is not in monitor mode (job control +enabled) which resulted in the terminal pgrp being set to an invalid +value once vipw exited. + +Fixes: 7eca1112fbd7 (2019-11-11; "Fix vipw not resuming correctly when suspended") +Closes: +Reported-by: +Tested-by: Alejandro Colomar +Reviewed-by: Alejandro Colomar +--- + src/vipw.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/src/vipw.c b/src/vipw.c +index a855e0d7..dbc87db9 100644 +--- a/src/vipw.c ++++ b/src/vipw.c +@@ -372,8 +372,14 @@ vipwedit (const char *file, int (*file_lock) (void), int (*file_unlock) (void)) + } + } + +- if (orig_pgrp != -1) ++ if (orig_pgrp != -1) { ++ /* Restore terminal pgrp after editing. */ ++ if (tcsetpgrp(STDIN_FILENO, orig_pgrp) == -1) { ++ fprintf(stderr, "%s: %s: %s", Prog, ++ "tcsetpgrp", strerror(errno)); ++ } + sigprocmask(SIG_SETMASK, &omask, NULL); ++ } + + if (-1 == pid) { + vipwexit (editor, 1, 1); +-- +2.49.0 + diff --git a/shadow-utils.spec b/shadow-utils.spec index 27a9e8d..7843944 100644 --- a/shadow-utils.spec +++ b/shadow-utils.spec @@ -1,7 +1,7 @@ Summary: Utilities for managing accounts and shadow password files Name: shadow-utils Version: 4.15.0 -Release: 5%{?dist} +Release: 6%{?dist} Epoch: 2 License: BSD-3-Clause AND GPL-2.0-or-later URL: https://github.com/shadow-maint/shadow @@ -32,6 +32,8 @@ Patch4: shadow-4.15.0-account-tools-setuid.patch Patch5: shadow-4.15.0-getdef-spurious-error.patch # https://github.com/shadow-maint/shadow/commit/903593249630054ab5df327481f7386f718088cc Patch6: shadow-4.15.0-useradd-fix-write-full-return.patch +# https://github.com/shadow-maint/shadow/commit/3b12ab7e29b0f3c766b39269da76a5ef3a753b22 +Patch7: shadow-4.15.0-vipw-restore-terminal.patch ### Dependencies ### Requires: audit-libs >= 1.6.5 @@ -280,6 +282,9 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/libsubid.a %{_libdir}/libsubid.so %changelog +* Mon May 26 2025 Iker Pedrosa - 2:4.15.0-6 +- vipw: restore the original terminal pgrp after editing. Resolves: RHEL-93172 + * Mon Nov 4 2024 Iker Pedrosa - 2:4.15.0-5 - Disable nscd. Resolves: RHEL-56355 - useradd: fix write_full() return value