From b9f993655170cd53e50dd0d454382ca45d69ef85 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sun, 25 Sep 2016 20:32:49 +0200 Subject: [PATCH] s4-sdb: Generate etypes list out of keys list This etypes list is Heimdal specific. It doesn't make sense to allocate and fill it in db-glue. Signed-off-by: Andreas Schneider Reviewed-by: Guenther Deschner --- source4/kdc/sdb_to_hdb.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/source4/kdc/sdb_to_hdb.c b/source4/kdc/sdb_to_hdb.c index 7ec4046acdc..66ee763dd60 100644 --- a/source4/kdc/sdb_to_hdb.c +++ b/source4/kdc/sdb_to_hdb.c @@ -277,24 +277,29 @@ static int sdb_entry_to_hdb_entry(krb5_context context, sdb_flags_to_hdb_flags(&s->flags, &h->flags); - if (s->etypes) { + h->etypes = NULL; + if (h->keys.val != NULL) { h->etypes = malloc(sizeof(*h->etypes)); if (h->etypes == NULL) { rc = ENOMEM; goto error; } - h->etypes->len = s->etypes->len; + + h->etypes->len = s->keys.len; + h->etypes->val = calloc(h->etypes->len, sizeof(int)); if (h->etypes->val == NULL) { rc = ENOMEM; goto error; } + for (i = 0; i < h->etypes->len; i++) { - h->etypes->val[i] = s->etypes->val[i]; + Key k = h->keys.val[i]; + + h->etypes->val[i] = KRB5_KEY_TYPE(&(k.key)); } - } else { - h->etypes = NULL; } + h->generation = NULL; h->extensions = NULL; /* really sure ? FIXME */