KUDU-2385: Fix typo in KinitContext::DoRenewal()

On platforms without krb5_get_init_creds_opt_set_out_ccache(),
krb5_cc_store_cred() is called to insert the newly acquired
credential into the ccache. However, there was a typo in the code
which resulted in inserting the old credential into ccache.
This change fixes the typo to make sure the new credential is
inserted into ccache.

Testing done: confirmed on SLES11 that the new credential
is being inserted by checking the 'auth time' of the ticket
in ccache. Impala uses a slightly different #ifdef which
explicitly checks if krb5_get_init_creds_opt_set_out_ccache()
is defined on the platform so this code path is actually
used when running Impala on SLES11.

Change-Id: I3a22b8d41d15eb1982a3fd5b96575e28edaad31c
Reviewed-on: http://gerrit.cloudera.org:8080/9840
Reviewed-by: Todd Lipcon <t...@apache.org>
Tested-by: Todd Lipcon <t...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/f7ab95e7
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/f7ab95e7
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/f7ab95e7

Branch: refs/heads/master
Commit: f7ab95e7d70faa07a64e73d9d0bda367e9d4fafc
Parents: 6a323db
Author: Michael Ho <k...@cloudera.com>
Authored: Wed Mar 28 10:53:24 2018 -0700
Committer: Todd Lipcon <t...@apache.org>
Committed: Wed Mar 28 20:39:10 2018 +0000

----------------------------------------------------------------------
 src/kudu/security/init.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/f7ab95e7/src/kudu/security/init.cc
----------------------------------------------------------------------
diff --git a/src/kudu/security/init.cc b/src/kudu/security/init.cc
index cd15df3..2b50fb2 100644
--- a/src/kudu/security/init.cc
+++ b/src/kudu/security/init.cc
@@ -276,7 +276,7 @@ Status KinitContext::DoRenewal() {
       KRB5_RETURN_NOT_OK_PREPEND(krb5_cc_initialize(g_krb5_ctx, ccache_, 
principal_),
                                  "Reacquire error: could not init ccache");
 
-      KRB5_RETURN_NOT_OK_PREPEND(krb5_cc_store_cred(g_krb5_ctx, ccache_, 
&creds),
+      KRB5_RETURN_NOT_OK_PREPEND(krb5_cc_store_cred(g_krb5_ctx, ccache_, 
&new_creds),
                                  "Reacquire error: could not store creds in 
cache");
 #endif
     }

Reply via email to