salt: adapt patch correctly

Resolves: RHEL-58978

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
This commit is contained in:
Iker Pedrosa 2024-11-05 12:53:43 +01:00
parent 136201eed8
commit e8b686171b
2 changed files with 23 additions and 12 deletions

View File

@ -1,14 +1,24 @@
diff -up shadow-4.9/libmisc/salt.c.salt-remove-rounds shadow-4.9/libmisc/salt.c diff --git a/libmisc/salt.c b/libmisc/salt.c
--- shadow-4.9/libmisc/salt.c.salt-remove-rounds 2024-11-04 10:36:46.063856730 +0100 index efef4e59..823b093d 100644
+++ shadow-4.9/libmisc/salt.c 2024-11-04 10:40:40.890708080 +0100 --- a/libmisc/salt.c
@@ -528,6 +528,10 @@ static /*@observer@*/const char *gensalt +++ b/libmisc/salt.c
result[salt_len] = '\0'; @@ -439,6 +439,19 @@ static /*@observer@*/const char *gensalt (size_t salt_size)
exit (1);
} }
+ if (strstr(result, "rounds=") != NULL) { + char *pos = strstr(retval, "$rounds=");
+ result[3] = '\0'; + if (pos != NULL) {
+ char str[128];
+ int len;
+ int ret;
+
+ ret = sprintf(str, "%lu", rounds);
+ if (ret > 0) {
+ len = strlen("$rounds=") + strlen(str);
+ memmove(pos, pos + len, strlen(pos + len) + 1);
+ }
+ } + }
+ +
char *retval = crypt_gensalt (result, rounds, NULL, 0); return retval;
#else /* USE_XCRYPT_GENSALT */
/* Should not happen, but... */ /* Check if the result buffer is long enough. */

View File

@ -1,7 +1,7 @@
Summary: Utilities for managing accounts and shadow password files Summary: Utilities for managing accounts and shadow password files
Name: shadow-utils Name: shadow-utils
Version: 4.9 Version: 4.9
Release: 11%{?dist} Release: 12%{?dist}
Epoch: 2 Epoch: 2
License: BSD and GPLv2+ License: BSD and GPLv2+
URL: https://github.com/shadow-maint/shadow URL: https://github.com/shadow-maint/shadow
@ -82,6 +82,7 @@ Patch29: shadow-4.9-skip-over-reserved-ids.patch
Patch30: shadow-4.9-gpasswd-fix-password-leak.patch Patch30: shadow-4.9-gpasswd-fix-password-leak.patch
# Downstream only patch # Downstream only patch
Patch31: shadow-4.9-disable-sssd.patch Patch31: shadow-4.9-disable-sssd.patch
# Downstream only patch
Patch32: shadow-4.9-salt-remove-rounds.patch Patch32: shadow-4.9-salt-remove-rounds.patch
### Dependencies ### ### Dependencies ###
@ -346,7 +347,7 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/libsubid.la
%{_libdir}/libsubid.so %{_libdir}/libsubid.so
%changelog %changelog
* Mon Nov 4 2024 Iker Pedrosa <ipedrosa@redhat.com> - 2:4.9-11 * Mon Nov 4 2024 Iker Pedrosa <ipedrosa@redhat.com> - 2:4.9-12
- salt: remove rounds from salt string. Resolves: RHEL-58978 - salt: remove rounds from salt string. Resolves: RHEL-58978
* Fri Sep 13 2024 Iker Pedrosa <ipedrosa@redhat.com> - 2:4.9-10 * Fri Sep 13 2024 Iker Pedrosa <ipedrosa@redhat.com> - 2:4.9-10