|
|
9af0d9 |
From 167d9775dd88cc91f74393fa487f126d21c560c7 Mon Sep 17 00:00:00 2001
|
|
|
9af0d9 |
From: Simo Sorce <simo@redhat.com>
|
|
|
9af0d9 |
Date: Thu, 27 Aug 2020 17:20:44 -0400
|
|
|
9af0d9 |
Subject: [PATCH] Avoid unnecessary allocation in gpm_inquire_mechs_for_name()
|
|
|
9af0d9 |
|
|
|
9af0d9 |
Signed-off-by: Simo Sorce <simo@redhat.com>
|
|
|
9af0d9 |
[rharwood@redhat.com: clarified commit message]
|
|
|
9af0d9 |
Reviewed-by: Robbie Harwood <rharwood@redhat.com>
|
|
|
9af0d9 |
(cherry picked from commit c0561c078bc22b9523ac25f515ad85b735c26a92)
|
|
|
9af0d9 |
(cherry picked from commit ebd66fbf42887220a0ff38cfea03a7b20fa4da17)
|
|
|
9af0d9 |
---
|
|
|
9af0d9 |
src/client/gpm_indicate_mechs.c | 12 +++---------
|
|
|
9af0d9 |
1 file changed, 3 insertions(+), 9 deletions(-)
|
|
|
9af0d9 |
|
|
|
9af0d9 |
diff --git a/src/client/gpm_indicate_mechs.c b/src/client/gpm_indicate_mechs.c
|
|
|
9af0d9 |
index 4041dcd..73fadf0 100644
|
|
|
9af0d9 |
--- a/src/client/gpm_indicate_mechs.c
|
|
|
9af0d9 |
+++ b/src/client/gpm_indicate_mechs.c
|
|
|
9af0d9 |
@@ -390,7 +390,7 @@ OM_uint32 gpm_inquire_mechs_for_name(OM_uint32 *minor_status,
|
|
|
9af0d9 |
uint32_t ret_min;
|
|
|
9af0d9 |
uint32_t ret_maj;
|
|
|
9af0d9 |
uint32_t discard;
|
|
|
9af0d9 |
- gss_OID name_type = GSS_C_NO_OID;
|
|
|
9af0d9 |
+ gss_OID_desc name_type;
|
|
|
9af0d9 |
int present;
|
|
|
9af0d9 |
|
|
|
9af0d9 |
if (!minor_status) {
|
|
|
9af0d9 |
@@ -407,19 +407,14 @@ OM_uint32 gpm_inquire_mechs_for_name(OM_uint32 *minor_status,
|
|
|
9af0d9 |
return GSS_S_FAILURE;
|
|
|
9af0d9 |
}
|
|
|
9af0d9 |
|
|
|
9af0d9 |
- ret_min = gp_conv_gssx_to_oid_alloc(&input_name->name_type, &name_type);
|
|
|
9af0d9 |
- if (ret_min) {
|
|
|
9af0d9 |
- ret_maj = GSS_S_FAILURE;
|
|
|
9af0d9 |
- goto done;
|
|
|
9af0d9 |
- }
|
|
|
9af0d9 |
-
|
|
|
9af0d9 |
ret_maj = gss_create_empty_oid_set(&ret_min, mech_types);
|
|
|
9af0d9 |
if (ret_maj) {
|
|
|
9af0d9 |
goto done;
|
|
|
9af0d9 |
}
|
|
|
9af0d9 |
|
|
|
9af0d9 |
+ gp_conv_gssx_to_oid(&input_name->name_type, &name_type);
|
|
|
9af0d9 |
for (unsigned i = 0; i < global_mechs.info_len; i++) {
|
|
|
9af0d9 |
- ret_maj = gss_test_oid_set_member(&ret_min, name_type,
|
|
|
9af0d9 |
+ ret_maj = gss_test_oid_set_member(&ret_min, &name_type,
|
|
|
9af0d9 |
global_mechs.info[i].name_types,
|
|
|
9af0d9 |
&present);
|
|
|
9af0d9 |
if (ret_maj) {
|
|
|
9af0d9 |
@@ -437,7 +432,6 @@ OM_uint32 gpm_inquire_mechs_for_name(OM_uint32 *minor_status,
|
|
|
9af0d9 |
}
|
|
|
9af0d9 |
|
|
|
9af0d9 |
done:
|
|
|
9af0d9 |
- gss_release_oid(&discard, &name_type);
|
|
|
9af0d9 |
if (ret_maj) {
|
|
|
9af0d9 |
gss_release_oid_set(&discard, mech_types);
|
|
|
9af0d9 |
*minor_status = ret_min;
|