99 lines
3.5 KiB
Diff
99 lines
3.5 KiB
Diff
From 15b514abf47704fb4e5e5bea36fb847d1c199c45 Mon Sep 17 00:00:00 2001
|
|
From: Julien Rische <jrische@redhat.com>
|
|
Date: Tue, 6 Aug 2024 10:38:01 +0200
|
|
Subject: [PATCH] Fix various issues detected by static analysis
|
|
|
|
Signed-off-by: Julien Rische <jrische@redhat.com>
|
|
(cherry picked from commit be676f3c6338971d953c8da52f4172040c5e06a4)
|
|
---
|
|
src/client/gpm_accept_sec_context.c | 1 +
|
|
src/gp_creds.c | 1 +
|
|
src/gp_rpc_init_sec_context.c | 2 ++
|
|
tests/interposetest.c | 5 +++--
|
|
tests/t_accept.c | 2 +-
|
|
5 files changed, 8 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/src/client/gpm_accept_sec_context.c b/src/client/gpm_accept_sec_context.c
|
|
index ab20b03..d508615 100644
|
|
--- a/src/client/gpm_accept_sec_context.c
|
|
+++ b/src/client/gpm_accept_sec_context.c
|
|
@@ -105,6 +105,7 @@ OM_uint32 gpm_accept_sec_context(OM_uint32 *minor_status,
|
|
if (outbuf) {
|
|
*output_token = *outbuf;
|
|
free(outbuf);
|
|
+ outbuf = NULL;
|
|
}
|
|
if (ret_flags) {
|
|
*ret_flags = ctx->ctx_flags;
|
|
diff --git a/src/gp_creds.c b/src/gp_creds.c
|
|
index 843d1a3..1a0258a 100644
|
|
--- a/src/gp_creds.c
|
|
+++ b/src/gp_creds.c
|
|
@@ -800,6 +800,7 @@ done:
|
|
gss_release_cred(&discard, &user_cred);
|
|
gss_release_name(&discard, &target_name);
|
|
gss_delete_sec_context(&discard, &initiator_context, NULL);
|
|
+ gss_delete_sec_context(&discard, &acceptor_context, NULL);
|
|
gss_release_buffer(&discard, &init_token);
|
|
gss_release_buffer(&discard, &accept_token);
|
|
gss_release_name(&discard, &req_name);
|
|
diff --git a/src/gp_rpc_init_sec_context.c b/src/gp_rpc_init_sec_context.c
|
|
index f362dbc..7fe7365 100644
|
|
--- a/src/gp_rpc_init_sec_context.c
|
|
+++ b/src/gp_rpc_init_sec_context.c
|
|
@@ -33,6 +33,7 @@ int gp_init_sec_context(struct gp_call_ctx *gpcall,
|
|
};
|
|
uint32_t gccn_before = 0;
|
|
uint32_t gccn_after = 0;
|
|
+ uint32_t discard;
|
|
int ret;
|
|
|
|
isca = &arg->init_sec_context;
|
|
@@ -192,6 +193,7 @@ done:
|
|
|
|
GPRPCDEBUG(gssx_res_init_sec_context, iscr);
|
|
|
|
+ gss_delete_sec_context(&discard, &ctx, NULL);
|
|
gss_release_name(&ret_min, &target_name);
|
|
gss_release_oid(&ret_min, &mech_type);
|
|
gss_release_cred(&ret_min, &ich);
|
|
diff --git a/tests/interposetest.c b/tests/interposetest.c
|
|
index 0cdd473..7ab8ecc 100644
|
|
--- a/tests/interposetest.c
|
|
+++ b/tests/interposetest.c
|
|
@@ -377,7 +377,7 @@ void run_server(struct aproc *data)
|
|
uint32_t ret_min;
|
|
gss_ctx_id_t context_handle = GSS_C_NO_CONTEXT;
|
|
gss_cred_id_t cred_handle = GSS_C_NO_CREDENTIAL;
|
|
- gss_name_t src_name;
|
|
+ gss_name_t src_name = GSS_C_NO_NAME;
|
|
gss_buffer_desc out_token = GSS_C_EMPTY_BUFFER;
|
|
gss_cred_id_t deleg_cred = GSS_C_NO_CREDENTIAL;
|
|
gss_OID_set mech_set = GSS_C_NO_OID_SET;
|
|
@@ -591,7 +591,8 @@ void run_server(struct aproc *data)
|
|
goto done;
|
|
}
|
|
|
|
- fprintf(stdout, "Server, RECV: %s\n", (char *)out_token.value);
|
|
+ fprintf(stdout, "Server, RECV: %*s\n", (int)out_token.length,
|
|
+ (char *)out_token.value);
|
|
|
|
gss_release_buffer(&ret_min, &out_token);
|
|
|
|
diff --git a/tests/t_accept.c b/tests/t_accept.c
|
|
index 3afb7ac..8a663fe 100644
|
|
--- a/tests/t_accept.c
|
|
+++ b/tests/t_accept.c
|
|
@@ -9,7 +9,7 @@ int main(int argc, const char *argv[])
|
|
gss_ctx_id_t context_handle = GSS_C_NO_CONTEXT;
|
|
gss_buffer_desc in_token = GSS_C_EMPTY_BUFFER;
|
|
gss_buffer_desc out_token = GSS_C_EMPTY_BUFFER;
|
|
- gss_name_t src_name;
|
|
+ gss_name_t src_name = GSS_C_NO_NAME;
|
|
uint32_t ret_maj;
|
|
uint32_t ret_min;
|
|
int ret = -1;
|
|
--
|
|
2.45.2
|
|
|