1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

s4:kdc: Free error message returned by krb5_get_error_message()

Also check whether the message is NULL. Passing NULL to vasprintf() is
undefined behaviour.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Joseph Sutton 2023-08-11 10:25:08 +12:00 committed by Andrew Bartlett
parent 9d485b262a
commit c1061ae8a7

View File

@ -3680,14 +3680,18 @@ krb5_error_code dsdb_extract_aes_256_key(krb5_context context,
ENC_HMAC_SHA1_96_AES256,
&supported_enctypes);
if (krb5_ret != 0) {
const char *krb5_err = krb5_get_error_message(context, krb5_ret);
DBG_ERR("Failed to parse supplementalCredentials "
"of %s with %s kvno using "
"ENCTYPE_HMAC_SHA1_96_AES256 "
"Kerberos Key: %s\n",
ldb_dn_get_linearized(msg->dn),
(kvno != NULL) ? "previous" : "current",
krb5_get_error_message(context,
krb5_ret));
krb5_err != NULL ? krb5_err : "<unknown>");
krb5_free_error_message(context, krb5_err);
return krb5_ret;
}