From 893f67ca5faf5945a23ef165b49f5a3f182bb883 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Tue, 2 Dec 2025 12:24:11 -0500 Subject: [PATCH] Fix issues discovered by OSCI tests Related: RHEL-124447 Signed-off-by: Stephen Gallagher --- ...fault-on-receiving-bad-CLI-arguments.patch | 38 +++++++++++++++++++ 0003-Restore-error-message.patch | 29 ++++++++++++++ sscg.spec | 7 ++++ 3 files changed, 74 insertions(+) create mode 100644 0002-Avoid-segfault-on-receiving-bad-CLI-arguments.patch create mode 100644 0003-Restore-error-message.patch diff --git a/0002-Avoid-segfault-on-receiving-bad-CLI-arguments.patch b/0002-Avoid-segfault-on-receiving-bad-CLI-arguments.patch new file mode 100644 index 0000000..6da94b3 --- /dev/null +++ b/0002-Avoid-segfault-on-receiving-bad-CLI-arguments.patch @@ -0,0 +1,38 @@ +From f40d0070641543a140428d70211d53d36fd2c34b Mon Sep 17 00:00:00 2001 +From: Stephen Gallagher +Date: Tue, 2 Dec 2025 12:12:26 -0500 +Subject: [PATCH 2/3] Avoid segfault on receiving bad CLI arguments + +Signed-off-by: Stephen Gallagher +--- + src/sscg.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/src/sscg.c b/src/sscg.c +index d2dce334cff1342d975e9867a2c82a222d76925e..070d567bb189d42a20fd0a80f8fe2f7caae4d9eb 100644 +--- a/src/sscg.c ++++ b/src/sscg.c +@@ -59,7 +59,7 @@ int + main (int argc, const char **argv) + { + int ret, sret; +- struct sscg_options *options; ++ struct sscg_options *options = NULL; + bool build_client_cert = false; + char *dhparams_file = NULL; + +@@ -361,7 +361,10 @@ main (int argc, const char **argv) + done: + if (ret != EOK) + { +- sscg_io_utils_delete_output_files (options->streams); ++ if (options) ++ { ++ sscg_io_utils_delete_output_files (options->streams); ++ } + } + talloc_zfree (main_ctx); + if (getenv ("SSCG_TALLOC_REPORT")) +-- +2.52.0 + diff --git a/0003-Restore-error-message.patch b/0003-Restore-error-message.patch new file mode 100644 index 0000000..dd66fd6 --- /dev/null +++ b/0003-Restore-error-message.patch @@ -0,0 +1,29 @@ +From 08dacb632cc331027f39dcfa0b782aeb6f2f893a Mon Sep 17 00:00:00 2001 +From: Stephen Gallagher +Date: Tue, 2 Dec 2025 12:19:04 -0500 +Subject: [PATCH 3/3] Restore error message + +This was dropped in 4.0, but should be retained in RHEL 9 and 10 for +compatibility, particularly with existing tests that look for specific +messages. + +Signed-off-by: Stephen Gallagher +--- + src/sscg.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/sscg.c b/src/sscg.c +index 070d567bb189d42a20fd0a80f8fe2f7caae4d9eb..9f46cd622a4d55bd634a370ccc81ff063422b5af 100644 +--- a/src/sscg.c ++++ b/src/sscg.c +@@ -361,6 +361,7 @@ main (int argc, const char **argv) + done: + if (ret != EOK) + { ++ SSCG_ERROR ("%s\n", strerror (ret)); + if (options) + { + sscg_io_utils_delete_output_files (options->streams); +-- +2.52.0 + diff --git a/sscg.spec b/sscg.spec index 52f680a..0a9d156 100644 --- a/sscg.spec +++ b/sscg.spec @@ -28,6 +28,13 @@ BuildRequires: help2man # dhparam file generation by default. Patch: 0001-Restore-defaulting-to-dhparams.pem-creation.patch +# Upstream patch to avoid segfault when receiving bad CLI arguments +Patch: 0002-Avoid-segfault-on-receiving-bad-CLI-arguments.patch + +# Downstream patch to restore error message at the end of execution that is +# checked by certain tests +Patch: 0003-Restore-error-message.patch + %description A utility to aid in the creation of more secure "self-signed" certificates. The certificates created by this tool are generated in a