Skip to content

Commit

Permalink
Generalize request_enc_pa_rep() in get_in_tkt.c
Browse files Browse the repository at this point in the history
In get_in_tkt.c, rename request_enc_pa_rep() to add_padata() and add
pa_type, octets, and length parameters.

[ghudson@mit.edu: used a shorter function name and added a comment;
rewrote commit message]
  • Loading branch information
cryptomilk authored and greghudson committed Apr 27, 2016
1 parent 2f8b9ef commit 91bb3a4
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/lib/krb5/krb/get_in_tkt.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,10 @@ make_preauth_list(krb5_context context,

#define MAX_IN_TKT_LOOPS 16

/* Add a pa-data item with the specified type and contents to *padptr. */
static krb5_error_code
request_enc_pa_rep(krb5_pa_data ***padptr)
add_padata(krb5_pa_data ***padptr, krb5_preauthtype pa_type,
const void *contents, unsigned int length)
{
size_t size = 0;
krb5_pa_data **pad = *padptr;
Expand All @@ -350,8 +352,16 @@ request_enc_pa_rep(krb5_pa_data ***padptr)
if (pa == NULL)
return ENOMEM;
pa->contents = NULL;
pa->length = 0;
pa->pa_type = KRB5_ENCPADATA_REQ_ENC_PA_REP;
pa->length = length;
if (contents != NULL) {
pa->contents = malloc(length);
if (pa->contents == NULL) {
free(pa);
return ENOMEM;
}
memcpy(pa->contents, contents, length);
}
pa->pa_type = pa_type;
pad[size] = pa;
*padptr = pad;
return 0;
Expand Down Expand Up @@ -1264,8 +1274,10 @@ init_creds_step_request(krb5_context context,
}
if (ctx->request->padata)
ctx->sent_nontrivial_preauth = TRUE;
if (ctx->enc_pa_rep_permitted)
code = request_enc_pa_rep(&ctx->request->padata);
if (ctx->enc_pa_rep_permitted) {
code = add_padata(&ctx->request->padata, KRB5_ENCPADATA_REQ_ENC_PA_REP,
NULL, 0);
}
if (code)
goto cleanup;
code = krb5int_fast_prep_req(context, ctx->fast_state,
Expand Down

0 comments on commit 91bb3a4

Please sign in to comment.