From ad6228af78ac4a3b901bd4d4cca29bb5b41ec95b Mon Sep 17 00:00:00 2001 From: Iker Pedrosa Date: Mon, 26 May 2025 15:55:03 +0200 Subject: [PATCH] Various fixes - nss.c: shadow_logfd to stderr - vipw: restore the original terminal pgrp after editing Resolves: RHEL-83431 Resolves: RHEL-70844 Resolves: RHEL-72940 Signed-off-by: Iker Pedrosa --- shadow-4.9-shadow-logfd.patch | 15 +++++++++ shadow-4.9.0-vipw-restore-terminal.patch | 41 ++++++++++++++++++++++++ shadow-utils.spec | 12 ++++++- 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 shadow-4.9-shadow-logfd.patch create mode 100644 shadow-4.9.0-vipw-restore-terminal.patch diff --git a/shadow-4.9-shadow-logfd.patch b/shadow-4.9-shadow-logfd.patch new file mode 100644 index 0000000..25cde20 --- /dev/null +++ b/shadow-4.9-shadow-logfd.patch @@ -0,0 +1,15 @@ +diff -up shadow-4.9/lib/nss.c.shadow-logfd shadow-4.9/lib/nss.c +--- shadow-4.9/lib/nss.c.shadow-logfd 2021-07-22 23:55:35.000000000 +0200 ++++ shadow-4.9/lib/nss.c 2025-04-07 15:26:58.957447229 +0200 +@@ -42,6 +42,10 @@ void nss_init(char *nsswitch_path) { + char *line = NULL, *p, *token, *saveptr; + size_t len = 0; + ++ if (shadow_logfd == NULL) { ++ shadow_logfd = stderr; ++ } ++ + if (atomic_flag_test_and_set(&nss_init_started)) { + // Another thread has started nss_init, wait for it to complete + while (!atomic_load(&nss_init_completed)) + diff --git a/shadow-4.9.0-vipw-restore-terminal.patch b/shadow-4.9.0-vipw-restore-terminal.patch new file mode 100644 index 0000000..90fbc06 --- /dev/null +++ b/shadow-4.9.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 243ecc0..5ac842a 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.9 -Release: 12%{?dist} +Release: 13%{?dist} Epoch: 2 License: BSD and GPLv2+ URL: https://github.com/shadow-maint/shadow @@ -84,6 +84,10 @@ Patch30: shadow-4.9-gpasswd-fix-password-leak.patch Patch31: shadow-4.9-disable-sssd.patch # Downstream only patch Patch32: shadow-4.9-salt-remove-rounds.patch +# Downstream only patch +Patch33: shadow-4.9-shadow-logfd.patch +# https://github.com/shadow-maint/shadow/commit/3b12ab7e29b0f3c766b39269da76a5ef3a753b22 +Patch34: shadow-4.9.0-vipw-restore-terminal.patch ### Dependencies ### Requires: audit-libs >= 1.6.5 @@ -177,6 +181,8 @@ Development files for shadow-utils-subid. %patch30 -p1 -b .gpasswd-fix-password-leak %patch31 -p1 -b .disable-sssd %patch32 -p1 -b .salt-remove-rounds +%patch33 -p1 -b .shadow-logfd +%patch34 -p1 -b .vipw-restore-terminal iconv -f ISO88591 -t utf-8 doc/HOWTO > doc/HOWTO.utf8 cp -f doc/HOWTO.utf8 doc/HOWTO @@ -347,6 +353,10 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/libsubid.la %{_libdir}/libsubid.so %changelog +* Mon May 26 2025 Iker Pedrosa - 2:4.9-13 +- nss.c: shadow_logfd to stderr. Resolves: RHEL-83431 +- vipw: restore the original terminal pgrp after editing. Resolves: RHEL-70844 and RHEL-72940 + * Mon Nov 4 2024 Iker Pedrosa - 2:4.9-12 - salt: remove rounds from salt string. Resolves: RHEL-58978