From 6c244f9713d2060bb7fbedf1c953b923b5ff7e74 Mon Sep 17 00:00:00 2001 From: zhouchenchen123 Date: Wed, 21 Dec 2022 14:33:34 +0800 Subject: [PATCH] backport some patch --- SDAP-sdap_get_generic_send-fix-mem-leak.patch | 28 ++++++++++++ pam_sss_gss-KRB5CCNAME-may-be-NULL.patch | 33 ++++++++++++++ ...l-free-one-malloc-allocated-variable.patch | 45 +++++++++++++++++++ sssd.spec | 8 +++- 4 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 SDAP-sdap_get_generic_send-fix-mem-leak.patch create mode 100644 pam_sss_gss-KRB5CCNAME-may-be-NULL.patch create mode 100644 sssctl-free-one-malloc-allocated-variable.patch diff --git a/SDAP-sdap_get_generic_send-fix-mem-leak.patch b/SDAP-sdap_get_generic_send-fix-mem-leak.patch new file mode 100644 index 0000000..4f9f450 --- /dev/null +++ b/SDAP-sdap_get_generic_send-fix-mem-leak.patch @@ -0,0 +1,28 @@ +From cabc6cee761a2a10236e9fe6bdbacb9de5415160 Mon Sep 17 00:00:00 2001 +From: Alexey Tikhonov +Date: Fri, 22 Apr 2022 20:21:31 +0200 +Subject: [PATCH] SDAP: sdap_get_generic_send(): fix mem leak +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Reviewed-by: Pavel Březina +--- + src/providers/ldap/sdap_async.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/providers/ldap/sdap_async.c b/src/providers/ldap/sdap_async.c +index ebccd591e..1749c4f99 100644 +--- a/src/providers/ldap/sdap_async.c ++++ b/src/providers/ldap/sdap_async.c +@@ -2124,6 +2124,7 @@ struct tevent_req *sdap_get_generic_send(TALLOC_CTX *memctx, + false, NULL, NULL, 0, timeout, + allow_paging); + if (subreq == NULL) { ++ talloc_zfree(req); + return NULL; + } + tevent_req_set_callback(subreq, sdap_get_generic_done, req); +-- +2.32.0.windows.1 + diff --git a/pam_sss_gss-KRB5CCNAME-may-be-NULL.patch b/pam_sss_gss-KRB5CCNAME-may-be-NULL.patch new file mode 100644 index 0000000..3324cd4 --- /dev/null +++ b/pam_sss_gss-KRB5CCNAME-may-be-NULL.patch @@ -0,0 +1,33 @@ +From 9aad30711a5928f0e8a3627305b6449291de507f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pavel=20B=C5=99ezina?= +Date: Mon, 23 May 2022 11:05:01 +0200 +Subject: [PATCH] pam_sss_gss: KRB5CCNAME may be NULL + +Resolves: https://github.com/SSSD/sssd/issues/6180 + +:fixes: A regression in pam_sss_gss module causing a failure if + KRB5CCNAME environment variable was not set was fixed. + +Reviewed-by: Alexey Tikhonov +Reviewed-by: Sumit Bose +--- + src/sss_client/pam_sss_gss.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/sss_client/pam_sss_gss.c b/src/sss_client/pam_sss_gss.c +index 51047efc3..77a58e4cf 100644 +--- a/src/sss_client/pam_sss_gss.c ++++ b/src/sss_client/pam_sss_gss.c +@@ -492,7 +492,8 @@ static errno_t sss_cli_getenv(const char *variable_name, char **_value) + { + char *value = getenv(variable_name); + if (value == NULL) { +- return ENOENT; ++ *_value = NULL; ++ return EOK; + } + + *_value = strdup(value); +-- +2.32.0.windows.1 + diff --git a/sssctl-free-one-malloc-allocated-variable.patch b/sssctl-free-one-malloc-allocated-variable.patch new file mode 100644 index 0000000..52e230c --- /dev/null +++ b/sssctl-free-one-malloc-allocated-variable.patch @@ -0,0 +1,45 @@ +From 886ff516cf98ade239677ba3a3e3591fa341ce9b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Alejandro=20L=C3=B3pez?= +Date: Wed, 6 Apr 2022 11:58:48 +0200 +Subject: [PATCH] sssctl: free one malloc-allocated variable. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +One variable is allocated by popt using malloc and has to be freed. +As it is a const char *, we need to bypass the const modifier. + +Reviewed-by: Alexey Tikhonov +Reviewed-by: Pavel Březina +--- + src/tools/sssctl/sssctl_logs.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/src/tools/sssctl/sssctl_logs.c b/src/tools/sssctl/sssctl_logs.c +index bd758f272..c375700b4 100644 +--- a/src/tools/sssctl/sssctl_logs.c ++++ b/src/tools/sssctl/sssctl_logs.c +@@ -356,9 +356,6 @@ errno_t sssctl_debug_level(struct sss_cmdline *cmdline, + + CHECK_ROOT(ret, debug_prg_name); + +- /* free pc_config_file? */ +- /* free debug_as_string? */ +- + debug_to_set = parse_debug_level(debug_as_string); + CHECK(debug_to_set == SSSDBG_INVALID, fini, "Invalid debug level."); + +@@ -387,6 +384,10 @@ errno_t sssctl_debug_level(struct sss_cmdline *cmdline, + + fini: + talloc_free(ctx); ++ /* pc_config_file is allocated by popt using malloc(). ++ * debug_as_string is not allocated but points to the command line. */ ++ free(discard_const(pc_config_file)); ++ + return ret; + } + +-- +2.32.0.windows.1 + diff --git a/sssd.spec b/sssd.spec index eb8c26c..e0b663a 100644 --- a/sssd.spec +++ b/sssd.spec @@ -1,12 +1,15 @@ Name: sssd Version: 2.6.1 -Release: 5 +Release: 6 Summary: System Security Services Daemon License: GPLv3+ and LGPLv3+ URL: https://pagure.io/SSSD/sssd/ Source0: https://github.com/SSSD/sssd/releases/download/%{version}/%{name}-%{version}.tar.gz Patch6000: backport-UTILS-fixes-CWE-394.patch +Patch6001: pam_sss_gss-KRB5CCNAME-may-be-NULL.patch +Patch6002: SDAP-sdap_get_generic_send-fix-mem-leak.patch +Patch6003: sssctl-free-one-malloc-allocated-variable.patch Requires: python3-sssd = %{version}-%{release} Requires: libldb @@ -544,6 +547,9 @@ fi %{_libdir}/%{name}/modules/libwbclient.so %changelog +* Wed Dec 21 2022 zhouchenchen - 2.6.1-6 +- backport some patch + * Tue Dec 20 2022 zhouchenchen - 2.6.1-5 - fix CWE-394 issue -- Gitee