bind/backport-0056-Free-resources-when-gss_accept_sec_context-fails.patch
jiangheng ad37c37958 backport some patches from community
(cherry picked from commit a9fd9ece9b9436b6103d084920c6897ef1adbae6)
2022-09-03 21:36:21 +08:00

35 lines
1.1 KiB
Diff

From dc1ed887760fc64d65034eb38b2066dc5bf54e04 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= <michal@isc.org>
Date: Thu, 8 Apr 2021 10:33:44 +0200
Subject: [PATCH] Free resources when gss_accept_sec_context() fails
Even if a call to gss_accept_sec_context() fails, it might still cause a
GSS-API response token to be allocated and left for the caller to
release. Make sure the token is released before an early return from
dst_gssapi_acceptctx().
(cherry picked from commit d954e152d9f2901118b1fe36d3931ec244317fab)
Conflict: NA
Reference: https://gitlab.isc.org/isc-projects/bind9/-/commit/dc1ed887760fc64d65034eb38b2066dc5bf54e04
---
lib/dns/gssapictx.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/dns/gssapictx.c b/lib/dns/gssapictx.c
index 549bd47f78..482c25e1cc 100644
--- a/lib/dns/gssapictx.c
+++ b/lib/dns/gssapictx.c
@@ -715,6 +715,9 @@ dst_gssapi_acceptctx(gss_cred_id_t cred,
default:
gss_log(3, "failed gss_accept_sec_context: %s",
gss_error_tostring(gret, minor, buf, sizeof(buf)));
+ if (gouttoken.length > 0U) {
+ (void)gss_release_buffer(&minor, &gouttoken);
+ }
return (result);
}
--
2.23.0