shadow-utils/shadow-4.9-salt-remove-rounds.patch
Iker Pedrosa e8b686171b salt: adapt patch correctly
Resolves: RHEL-58978

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
2024-11-05 12:53:43 +01:00

25 lines
589 B
Diff

diff --git a/libmisc/salt.c b/libmisc/salt.c
index efef4e59..823b093d 100644
--- a/libmisc/salt.c
+++ b/libmisc/salt.c
@@ -439,6 +439,19 @@ static /*@observer@*/const char *gensalt (size_t salt_size)
exit (1);
}
+ char *pos = strstr(retval, "$rounds=");
+ 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);
+ }
+ }
+
return retval;
#else /* USE_XCRYPT_GENSALT */
/* Check if the result buffer is long enough. */