Skip to content

Commit

Permalink
Rename gss-krb5 cred tgt_expire field
Browse files Browse the repository at this point in the history
The tgt_expire field is used to store non-TGT expiry times in a couple
of cases: when the ccache has no TGT, and after we've obtained a cred
for the target service.  Rename it to just "expire" to be less
misleading.
  • Loading branch information
greghudson committed Jun 27, 2012
1 parent d53df94 commit 5ed8835
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/lib/gssapi/krb5/accept_sec_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ rd_and_store_for_creds(context, auth_context, inbuf, out_cred)
cred->usage = GSS_C_INITIATE; /* we can't accept with this */
/* cred->name already set */
cred->keytab = NULL; /* no keytab associated with this... */
cred->tgt_expire = creds[0]->times.endtime; /* store the end time */
cred->expire = creds[0]->times.endtime; /* store the end time */
cred->ccache = ccache; /* the ccache containing the credential */
cred->destroy_ccache = 1;
ccache = NULL; /* cred takes ownership so don't destroy */
Expand Down
4 changes: 2 additions & 2 deletions src/lib/gssapi/krb5/acquire_cred.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ scan_ccache(krb5_context context, krb5_gss_cred_id_rec *cred,
endtime = creds.times.endtime;
krb5_free_cred_contents(context, &creds);
if (is_tgt || !got_endtime)
cred->tgt_expire = creds.times.endtime;
cred->expire = creds.times.endtime;
got_endtime = 1;
}
krb5_cc_end_seq_get(context, ccache, &cursor);
Expand Down Expand Up @@ -657,7 +657,7 @@ acquire_cred(OM_uint32 *minor_status, gss_name_t desired_name,
goto krb_error_out;

if (time_rec)
*time_rec = (cred->tgt_expire > now) ? (cred->tgt_expire - now) : 0;
*time_rec = (cred->expire > now) ? (cred->expire - now) : 0;
}

*minor_status = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/gssapi/krb5/gssapiP_krb5.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ typedef struct _krb5_gss_cred_id_rec {

/* ccache (init) data */
krb5_ccache ccache;
krb5_timestamp tgt_expire;
krb5_timestamp expire;
krb5_enctype *req_enctypes; /* limit negotiated enctypes to this list */
char *password;
} krb5_gss_cred_id_rec, *krb5_gss_cred_id_t;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/gssapi/krb5/iakerb.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ iakerb_initiator_step(iakerb_ctx_id_t ctx,
goto cleanup;
if (!(flags & KRB5_INIT_CREDS_STEP_FLAG_CONTINUE)) {
krb5_init_creds_get_times(ctx->k5c, ctx->icc, &times);
cred->tgt_expire = times.endtime;
cred->expire = times.endtime;

krb5_init_creds_free(ctx->k5c, ctx->icc);
ctx->icc = NULL;
Expand All @@ -571,7 +571,7 @@ iakerb_initiator_step(iakerb_ctx_id_t ctx,
goto cleanup;
if (!(flags & KRB5_TKT_CREDS_STEP_FLAG_CONTINUE)) {
krb5_tkt_creds_get_times(ctx->k5c, ctx->tcc, &times);
cred->tgt_expire = times.endtime;
cred->expire = times.endtime;

krb5_tkt_creds_free(ctx->k5c, ctx->tcc);
ctx->tcc = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/gssapi/krb5/init_sec_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ static krb5_error_code get_credentials(context, cred, server, now,
krb5_free_cred_contents(context, &tgt_creds);
goto cleanup;
}
cred->tgt_expire = tgt_creds.times.endtime;
cred->expire = tgt_creds.times.endtime;
krb5_free_cred_contents(context, &tgt_creds);

code = krb5_get_credentials(context, flags, cred->ccache,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/gssapi/krb5/inq_cred.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ krb5_gss_inquire_cred(minor_status, cred_handle, name, lifetime_ret,
goto fail;
}

if (cred->tgt_expire > 0) {
if ((lifetime = cred->tgt_expire - now) < 0)
if (cred->expire > 0) {
if ((lifetime = cred->expire - now) < 0)
lifetime = 0;
}
else
Expand Down
4 changes: 2 additions & 2 deletions src/lib/gssapi/krb5/s4u_gss_glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ kg_compose_deleg_cred(OM_uint32 *minor_status,

cred->usage = GSS_C_INITIATE;

cred->tgt_expire = subject_creds->times.endtime;
cred->expire = subject_creds->times.endtime;

code = kg_init_name(context, subject_creds->client, NULL, NULL, NULL, 0,
&cred->name);
Expand Down Expand Up @@ -282,7 +282,7 @@ kg_compose_deleg_cred(OM_uint32 *minor_status,
if (code != 0)
goto cleanup;

*time_rec = cred->tgt_expire - now;
*time_rec = cred->expire - now;
}

major_status = GSS_S_COMPLETE;
Expand Down

0 comments on commit 5ed8835

Please sign in to comment.