From ba6fccf443978b40e0187a7e589dd2cf6874fc39 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 17 Feb 2022 10:59:45 +0100 Subject: [PATCH] s4:kdc: let sdb_entry_to_hdb_entry() initialize *h at the beginning This is clearer and make further changes easier. Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett --- source4/kdc/sdb_to_hdb.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/source4/kdc/sdb_to_hdb.c b/source4/kdc/sdb_to_hdb.c index f832a9e7fcd..a682de17e98 100644 --- a/source4/kdc/sdb_to_hdb.c +++ b/source4/kdc/sdb_to_hdb.c @@ -172,6 +172,8 @@ static int sdb_entry_to_hdb_entry(krb5_context context, unsigned int i; int rc; + ZERO_STRUCTP(h); + rc = krb5_copy_principal(context, s->principal, &h->principal); @@ -290,9 +292,6 @@ static int sdb_entry_to_hdb_entry(krb5_context context, } } - h->generation = NULL; - h->extensions = NULL; /* really sure ? FIXME */ - return 0; error: free_hdb_entry(h); @@ -311,11 +310,16 @@ int sdb_entry_ex_to_hdb_entry_ex(krb5_context context, const struct sdb_entry_ex *s, hdb_entry *h) { - struct samba_kdc_entry *skdc_entry; + int ret; - ZERO_STRUCTP(h); + ret = sdb_entry_to_hdb_entry(context, &s->entry, h); + if (ret != 0) { + return ret; + } if (s->ctx != NULL) { + struct samba_kdc_entry *skdc_entry; + skdc_entry = talloc_get_type(s->ctx, struct samba_kdc_entry); h->context = skdc_entry; @@ -324,5 +328,5 @@ int sdb_entry_ex_to_hdb_entry_ex(krb5_context context, samba_kdc_hdb_entry_destructor); } - return sdb_entry_to_hdb_entry(context, &s->entry, h); + return 0; }