Blob Blame History Raw
From 14ecfa9fe9e843bdb2eb09c60a5ec592c8de4cdc Mon Sep 17 00:00:00 2001
From: Simo Sorce <simo@redhat.com>
Date: Mon, 14 Dec 2015 17:38:36 -0500
Subject: [PATCH 1/2] Since krb5 1.14 inquire_context may return no name

In 1.14 a patch to more officially support partially established contexts
has been intrdouced. With this patch names are not returned.

Cope with that by checking if a name is provided before trying to convert.

Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Robbie Harwood <rharwood@redhat.com>
---
 proxy/src/gp_export.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/proxy/src/gp_export.c b/proxy/src/gp_export.c
index 0ef3128..3b9a23b 100644
--- a/proxy/src/gp_export.c
+++ b/proxy/src/gp_export.c
@@ -526,14 +526,18 @@ uint32_t gp_export_ctx_id_to_gssx(uint32_t *min, int type, gss_OID mech,
         goto done;
     }
 
-    ret_maj = gp_conv_name_to_gssx(&ret_min, src_name, &out->src_name);
-    if (ret_maj) {
-        goto done;
+    if (src_name != GSS_C_NO_NAME) {
+        ret_maj = gp_conv_name_to_gssx(&ret_min, src_name, &out->src_name);
+        if (ret_maj) {
+            goto done;
+        }
     }
 
-    ret_maj = gp_conv_name_to_gssx(&ret_min, targ_name, &out->targ_name);
-    if (ret_maj) {
-        goto done;
+    if (targ_name != GSS_C_NO_NAME) {
+        ret_maj = gp_conv_name_to_gssx(&ret_min, targ_name, &out->targ_name);
+        if (ret_maj) {
+            goto done;
+        }
     }
 
     out->lifetime = lifetime_rec;
-- 
2.6.4