Blame SOURCES/Always-use-the-encype-we-selected.patch

e8d79a
From 64bf7f099fe52a214794486d16e3383ff25e8682 Mon Sep 17 00:00:00 2001
e8d79a
From: Simo Sorce <simo@redhat.com>
e8d79a
Date: Tue, 27 Feb 2018 11:59:25 -0500
e8d79a
Subject: [PATCH] Always use the encype we selected
e8d79a
e8d79a
The enctype is selected from the keytab or from the fallback code.
e8d79a
Either way make sure to use the enctype stored in the key block.
e8d79a
e8d79a
Signed-off-by: Simo Sorce <simo@redhat.com>
e8d79a
Reviewed-by: Robbie Harwood <rharwood@redhat.com>
e8d79a
Merges: #226
e8d79a
(cherry picked from commit d73c96d658059ce64ecd41ff2924071d86f2b54f)
e8d79a
---
e8d79a
 src/gp_export.c | 7 +++----
e8d79a
 1 file changed, 3 insertions(+), 4 deletions(-)
e8d79a
e8d79a
diff --git a/src/gp_export.c b/src/gp_export.c
e8d79a
index c9f5fd4..5e8e160 100644
e8d79a
--- a/src/gp_export.c
e8d79a
+++ b/src/gp_export.c
e8d79a
@@ -168,11 +168,10 @@ uint32_t gp_init_creds_handle(uint32_t *min, const char *svc_name,
e8d79a
                                  GP_CREDS_HANDLE_KEY_ENCTYPE, 0,
e8d79a
                                  &handle->key);
e8d79a
         if (ret == 0) {
e8d79a
-            ret = krb5_c_make_random_key(handle->context,
e8d79a
-                                         GP_CREDS_HANDLE_KEY_ENCTYPE,
e8d79a
+            ret = krb5_c_make_random_key(handle->context, handle->key->enctype,
e8d79a
                                          handle->key);
e8d79a
             GPDEBUG("Service: %s, Enckey: [ephemeral], Enctype: %d\n",
e8d79a
-                    svc_name, GP_CREDS_HANDLE_KEY_ENCTYPE);
e8d79a
+                    svc_name, handle->key->enctype);
e8d79a
         }
e8d79a
         if (ret) {
e8d79a
             ret_min = ret;
e8d79a
@@ -254,7 +253,7 @@ static int gp_decrypt_buffer(krb5_context context, krb5_keyblock *key,
e8d79a
 
e8d79a
     memset(&enc_handle, '\0', sizeof(krb5_enc_data));
e8d79a
 
e8d79a
-    enc_handle.enctype = GP_CREDS_HANDLE_KEY_ENCTYPE;
e8d79a
+    enc_handle.enctype = key->enctype;
e8d79a
     enc_handle.ciphertext.data = in->octet_string_val;
e8d79a
     enc_handle.ciphertext.length = in->octet_string_len;
e8d79a