From 525c7fe95dca0f63aca871197bf363c9e3910f85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Fri, 19 Mar 2004 20:08:28 +0000 Subject: [PATCH] (hdb_list_builtin): return a list of builtin backends git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@13547 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/hdb/hdb.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/lib/hdb/hdb.c b/lib/hdb/hdb.c index cdd017bd5..df992e9f3 100644 --- a/lib/hdb/hdb.c +++ b/lib/hdb/hdb.c @@ -314,6 +314,38 @@ find_method (const char *filename, const char **rest) return NULL; } +krb5_error_code +hdb_list_builtin(krb5_context context, char **list) +{ + const struct hdb_method *h; + size_t len = 0; + char *p, *buf = NULL; + + for (h = methods; h->prefix != NULL; ++h) { + if (h->prefix[0] == '\0') + continue; + len += strlen(h->prefix) + 2; + } + + len += 1; + buf = malloc(len); + if (buf == NULL) { + krb5_set_error_string(context, "malloc: out of memory"); + return ENOMEM; + } + buf[0] = '\0'; + + for (h = methods; h->prefix != NULL; ++h) { + if (h->prefix[0] == '\0') + continue; + if (h != methods) + strlcat(buf, ", ", len); + strlcat(buf, h->prefix, len); + } + *list = buf; + return 0; +} + krb5_error_code hdb_create(krb5_context context, HDB **db, const char *filename) {