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

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 <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Stefan Metzmacher 2022-02-17 10:59:45 +01:00
parent 7312bca8c7
commit ba6fccf443

View File

@ -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;
}