If we receive a PREAUTH_REQUIRED error and fail to generate any real
preauthentication, error out immediately instead of continuing to
generate non-preauthenticated requests until we hit the loop count.
There is a lot of room to generate a more meaningful error about why
we failed to generate preauth (although in many cases the answer may
be too complicated to explain in an error message), but that requires
more radical restructuring of the preauth framework.
ticket: 6430
target_version: 1.10
tags: pullup
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25469
dc483132-0cff-0310-8789-
dd5450dbe970
krb5_data *encoded_previous_request, krb5_pa_data **in_padata,
krb5_pa_data ***out_padata, krb5_prompter_fct prompter,
void *prompter_data, krb5_clpreauth_rock preauth_rock,
- krb5_gic_opt_ext *opte);
+ krb5_gic_opt_ext *opte, krb5_boolean *got_real_out);
krb5_error_code KRB5_CALLCONV
krb5_do_preauth_tryagain(krb5_context context, krb5_kdc_req *request,
krb5_data *out)
{
krb5_error_code code;
+ krb5_boolean got_real;
if (ctx->loopcount >= MAX_IN_TKT_LOOPS) {
code = KRB5_GET_IN_TKT_LOOP;
ctx->prompter,
ctx->prompter_data,
&ctx->preauth_rock,
- ctx->opte);
+ ctx->opte,
+ &got_real);
+ if (code == 0 && !got_real && ctx->preauth_required)
+ code = KRB5_PREAUTH_FAILED;
if (code != 0)
goto cleanup;
} else {
int canon_flag = 0;
krb5_keyblock *strengthen_key = NULL;
krb5_keyblock encrypting_key;
- krb5_boolean fast_avail;
+ krb5_boolean fast_avail, got_real;
encrypting_key.length = 0;
encrypting_key.contents = NULL;
code = sort_krb5_padata_sequence(context,
&ctx->request->client->realm,
ctx->preauth_to_use);
+ ctx->preauth_required = TRUE;
} else if (canon_flag && ctx->err_reply->error == KDC_ERR_WRONG_REALM) {
if (ctx->err_reply->client == NULL ||
ctx->prompter,
ctx->prompter_data,
&ctx->preauth_rock,
- ctx->opte);
+ ctx->opte,
+ &got_real);
if (code != 0)
goto cleanup;
krb5_boolean enc_pa_rep_permitted;
krb5_boolean have_restarted;
krb5_boolean sent_nontrivial_preauth;
+ krb5_boolean preauth_required;
};
krb5_error_code
krb5_data *encoded_previous_request,
krb5_pa_data **in_padata, krb5_pa_data ***out_padata,
krb5_prompter_fct prompter, void *prompter_data,
- krb5_clpreauth_rock rock, krb5_gic_opt_ext *opte)
+ krb5_clpreauth_rock rock, krb5_gic_opt_ext *opte,
+ krb5_boolean *got_real_out)
{
unsigned int h;
int i, j, out_pa_list_size;
static const int paorder[] = { PA_INFO, PA_REAL };
int realdone;
+ *got_real_out = FALSE;
+
if (in_padata == NULL) {
*out_padata = NULL;
return(0);
if (etype_info)
krb5_free_etype_info(context, etype_info);
+ *got_real_out = realdone;
return(0);
cleanup:
if (out_pa_list) {