cc8bf3
From 5c6f2fc4f63b2812b0305a3f0de9904c5ebd38ef Mon Sep 17 00:00:00 2001
cc8bf3
From: Robbie Harwood <rharwood@redhat.com>
cc8bf3
Date: Mon, 15 Apr 2019 19:56:50 -0400
cc8bf3
Subject: [PATCH] Handle gss_import_cred() failure when importing gssx creds
cc8bf3
cc8bf3
Otherwise, we might attempt to set options on a non-existent handle,
cc8bf3
leading to a segfault.
cc8bf3
cc8bf3
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
cc8bf3
Reviewed-by: Simo Sorce <simo@redhat.com>
cc8bf3
Merges: #244
cc8bf3
(cherry picked from commit 84cf88f6c6cfeb8e3fd2c26ed0fe9fe5bf3810d2)
cc8bf3
---
cc8bf3
 proxy/src/gp_export.c | 4 ++++
cc8bf3
 1 file changed, 4 insertions(+)
cc8bf3
cc8bf3
diff --git a/proxy/src/gp_export.c b/proxy/src/gp_export.c
cc8bf3
index 403e339..7ad8037 100644
cc8bf3
--- a/proxy/src/gp_export.c
cc8bf3
+++ b/proxy/src/gp_export.c
cc8bf3
@@ -476,6 +476,10 @@ uint32_t gp_import_gssx_cred(uint32_t *min, struct gp_call_ctx *gpcall,
cc8bf3
     }
cc8bf3
 
cc8bf3
     ret_maj = gss_import_cred(&ret_min, &token, out);
cc8bf3
+    if (ret_maj) {
cc8bf3
+        GPDEBUG("gss_import_cred failed when importing gssx cred\n");
cc8bf3
+        goto done;
cc8bf3
+    }
cc8bf3
 
cc8bf3
     /* check if there is any client option we need to set on credentials */
cc8bf3
     gp_set_cred_options(cred, *out);