gsskrb5: Fix dead code issues in deleg cred path

This commit is contained in:
Nicolas Williams
2022-01-17 18:10:08 -06:00
parent 82b8c906e9
commit 00dd104b96

View File

@@ -157,29 +157,20 @@ gsskrb5_accept_delegated_token(OM_uint32 *minor_status,
krb5_ccache ccache = NULL;
krb5_error_code kret;
int32_t ac_flags, ret = GSS_S_COMPLETE;
gsskrb5_cred handle;
*minor_status = 0;
/* XXX Create a new delegated_cred_handle? */
if (delegated_cred_handle == NULL) {
ret = GSS_S_COMPLETE;
goto out;
}
if (delegated_cred_handle == NULL)
return GSS_S_COMPLETE;
*delegated_cred_handle = NULL;
kret = krb5_cc_resolve(context, "MEMORY:anonymous", &ccache);
if (kret) {
ctx->flags &= ~GSS_C_DELEG_FLAG;
goto out;
}
if (kret == 0)
kret = krb5_cc_initialize(context, ccache, ctx->source);
if (kret) {
ctx->flags &= ~GSS_C_DELEG_FLAG;
goto out;
}
krb5_auth_con_removeflags(context,
if (kret == 0) {
(void) krb5_auth_con_removeflags(context,
ctx->auth_context,
KRB5_AUTH_CONTEXT_DO_TIME,
&ac_flags);
@@ -187,9 +178,10 @@ gsskrb5_accept_delegated_token(OM_uint32 *minor_status,
ctx->auth_context,
ccache,
&ctx->fwd_data);
krb5_auth_con_setflags(context,
(void) krb5_auth_con_setflags(context,
ctx->auth_context,
ac_flags);
}
if (kret) {
ctx->flags &= ~GSS_C_DELEG_FLAG;
ret = GSS_S_FAILURE;
@@ -197,9 +189,6 @@ gsskrb5_accept_delegated_token(OM_uint32 *minor_status,
goto out;
}
if (delegated_cred_handle) {
gsskrb5_cred handle;
ret = _gsskrb5_krb5_import_cred(minor_status,
&ccache,
NULL,
@@ -244,15 +233,10 @@ gsskrb5_accept_delegated_token(OM_uint32 *minor_status,
ret = GSS_S_FAILURE;
goto out;
}
}
out:
if (ccache) {
/* Don't destroy the default cred cache */
if (delegated_cred_handle == NULL)
krb5_cc_close(context, ccache);
else
krb5_cc_destroy(context, ccache);
}
return ret;
}