From f32ada08876a28b8fff3d4a3df7c47a5c1a2720a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Tue, 29 Nov 2005 18:48:07 +0000 Subject: [PATCH] Only match db databases on filename starting with '/'. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16311 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/hdb/hdb.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/lib/hdb/hdb.c b/lib/hdb/hdb.c index 3c27718af..d6d75b1d4 100644 --- a/lib/hdb/hdb.c +++ b/lib/hdb/hdb.c @@ -53,17 +53,17 @@ static struct hdb_method methods[] = { #endif #if defined(OPENLDAP) && !defined(OPENLDAP_MODULE) {"ldap:", hdb_ldap_create}, -#endif -#if HAVE_DB1 || HAVE_DB3 - {"", hdb_db_create}, -#elif defined(HAVE_NDBM) - {"", hdb_ndbm_create}, -#elif defined(OPENLDAP) && !defined(OPENLDAP_MODULE) - {"", hdb_ldap_create}, #endif {NULL, NULL} }; +#if HAVE_DB1 || HAVE_DB3 +static struct hdb_method dbmetod = {"", hdb_db_create }; +#elif defined(HAVE_NDBM) +static struct hdb_method dbmetod = {"", hdb_ndbm_create }; +#endif + + krb5_error_code hdb_next_enctype2key(krb5_context context, const hdb_entry *e, @@ -327,11 +327,19 @@ find_method (const char *filename, const char **rest) { const struct hdb_method *h; - for (h = methods; h->prefix != NULL; ++h) + for (h = methods; h->prefix != NULL; ++h) { if (strncmp (filename, h->prefix, strlen(h->prefix)) == 0) { *rest = filename + strlen(h->prefix); return h; } + } +#if defined(HAVE_DB1) || defined(HAVE_DB3) || define(HAVE_NDBM) + if (filename[0] == '/') { + *rest = filename; + return &dbmetod; + } +#endif + return NULL; } @@ -357,8 +365,6 @@ hdb_list_builtin(krb5_context context, char **list) 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);