Skip to content

Commit

Permalink
Simplify gss_krb5int_copy_ccache()
Browse files Browse the repository at this point in the history
Use krb5_cc_copy_creds() to reduce the amount of code in
gss_krb5int_copy_ccache().
  • Loading branch information
cryptomilk authored and greghudson committed Dec 13, 2016
1 parent 56d05e8 commit b8acba5
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/lib/gssapi/krb5/copy_ccache.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ gss_krb5int_copy_ccache(OM_uint32 *minor_status,
const gss_buffer_t value)
{
krb5_gss_cred_id_t k5creds;
krb5_cc_cursor cursor;
krb5_creds creds;
krb5_error_code code;
krb5_context context;
krb5_ccache out_ccache;
Expand Down Expand Up @@ -37,20 +35,14 @@ gss_krb5int_copy_ccache(OM_uint32 *minor_status,
return GSS_S_FAILURE;
}

code = krb5_cc_start_seq_get(context, k5creds->ccache, &cursor);
code = krb5_cc_copy_creds(context, k5creds->ccache, out_ccache);
if (code) {
k5_mutex_unlock(&k5creds->lock);
*minor_status = code;
save_error_info(*minor_status, context);
krb5_free_context(context);
return(GSS_S_FAILURE);
}
while (!code && !krb5_cc_next_cred(context, k5creds->ccache, &cursor,
&creds)) {
code = krb5_cc_store_cred(context, out_ccache, &creds);
krb5_free_cred_contents(context, &creds);
}
krb5_cc_end_seq_get(context, k5creds->ccache, &cursor);
k5_mutex_unlock(&k5creds->lock);
*minor_status = code;
if (code)
Expand Down

0 comments on commit b8acba5

Please sign in to comment.