kdc: Add missing encryption retval check

This commit is contained in:
Nicolas Williams
2022-01-17 10:47:41 -06:00
parent dca1048e96
commit 4d5c5c6737

View File

@@ -1196,25 +1196,29 @@ _kdc_encode_reply(krb5_context context,
return ret; return ret;
} }
if(rep->msg_type == krb_as_rep) { if(rep->msg_type == krb_as_rep) {
krb5_encrypt_EncryptedData(context, ret = krb5_encrypt_EncryptedData(context,
crypto, crypto,
KRB5_KU_AS_REP_ENC_PART, KRB5_KU_AS_REP_ENC_PART,
buf, buf,
len, len,
ckvno, ckvno,
&rep->enc_part); &rep->enc_part);
free(buf); free(buf);
ASN1_MALLOC_ENCODE(AS_REP, buf, buf_size, rep, &len, ret); if (ret == 0)
ASN1_MALLOC_ENCODE(AS_REP, buf, buf_size, rep, &len, ret);
} else { } else {
krb5_encrypt_EncryptedData(context, ret = krb5_encrypt_EncryptedData(context,
crypto, crypto,
rk_is_subkey ? KRB5_KU_TGS_REP_ENC_PART_SUB_KEY : KRB5_KU_TGS_REP_ENC_PART_SESSION, rk_is_subkey ?
buf, KRB5_KU_TGS_REP_ENC_PART_SUB_KEY :
len, KRB5_KU_TGS_REP_ENC_PART_SESSION,
ckvno, buf,
&rep->enc_part); len,
free(buf); ckvno,
ASN1_MALLOC_ENCODE(TGS_REP, buf, buf_size, rep, &len, ret); &rep->enc_part);
free(buf);
if (ret == 0)
ASN1_MALLOC_ENCODE(TGS_REP, buf, buf_size, rep, &len, ret);
} }
krb5_crypto_destroy(context, crypto); krb5_crypto_destroy(context, crypto);
if(ret) { if(ret) {