1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-22 22:04:08 +03:00

s4:kdc: avoid using sdb_entry_ex in netr_samlogon_generic_logon()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Stefan Metzmacher 2022-03-23 04:17:01 +01:00
parent e7b101e12e
commit bf9ec0a67b

View File

@ -55,7 +55,7 @@ static NTSTATUS netr_samlogon_generic_logon(struct irpc_message *msg,
enum ndr_err_code ndr_err; enum ndr_err_code ndr_err;
int code; int code;
krb5_principal principal; krb5_principal principal;
struct sdb_entry_ex sentry = {}; struct sdb_entry sentry = {};
struct sdb_keys skeys; struct sdb_keys skeys;
unsigned int i; unsigned int i;
const uint8_t *d = NULL; const uint8_t *d = NULL;
@ -112,7 +112,7 @@ static NTSTATUS netr_samlogon_generic_logon(struct irpc_message *msg,
principal, principal,
SDB_F_GET_KRBTGT | SDB_F_DECRYPT, SDB_F_GET_KRBTGT | SDB_F_DECRYPT,
0, 0,
&sentry.entry); &sentry);
krb5_free_principal(mki_ctx->krb5_context, principal); krb5_free_principal(mki_ctx->krb5_context, principal);
if (code != 0) { if (code != 0) {
DEBUG(0, ("Failed to fetch krbtgt@%s principal entry!\n", DEBUG(0, ("Failed to fetch krbtgt@%s principal entry!\n",
@ -131,7 +131,7 @@ static NTSTATUS netr_samlogon_generic_logon(struct irpc_message *msg,
* Brute force variant because MIT KRB5 doesn't provide a function like * Brute force variant because MIT KRB5 doesn't provide a function like
* krb5_checksum_to_enctype(). * krb5_checksum_to_enctype().
*/ */
skeys = sentry.entry.keys; skeys = sentry.keys;
for (i = 0; i < skeys.len; i++) { for (i = 0; i < skeys.len; i++) {
krb5_keyblock krbtgt_keyblock = skeys.val[i].key; krb5_keyblock krbtgt_keyblock = skeys.val[i].key;
@ -145,7 +145,7 @@ static NTSTATUS netr_samlogon_generic_logon(struct irpc_message *msg,
} }
} }
sdb_free_entry(&sentry); sdb_entry_free(&sentry);
if (code != 0) { if (code != 0) {
return NT_STATUS_LOGON_FAILURE; return NT_STATUS_LOGON_FAILURE;