aboutsummaryrefslogtreecommitdiff
path: root/lib/hdb/dbinfo.c
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2023-06-26 22:56:52 +0000
committerCy Schubert <cy@FreeBSD.org>2023-06-26 22:56:52 +0000
commitb6a943f7197af1a5eb6bb028b9b808ec5016e30c (patch)
treecfbb91e940dd89d0e1d46095f43c228d7d079fa0 /lib/hdb/dbinfo.c
parent6f4e10db3298f6d65e1e646fe52aaafc3682b788 (diff)
Heimdal 7.8.0 does not support OpenSSL 3.0. 7.9.0 will but it hasn't been released yet. We are importing f62e2f278 for its OpenSSL 3.0 support.
Diffstat (limited to 'lib/hdb/dbinfo.c')
-rw-r--r--lib/hdb/dbinfo.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/hdb/dbinfo.c b/lib/hdb/dbinfo.c
index e2890255b2ef..60b11f8cd663 100644
--- a/lib/hdb/dbinfo.c
+++ b/lib/hdb/dbinfo.c
@@ -271,5 +271,21 @@ hdb_db_dir(krb5_context context)
const char *
hdb_default_db(krb5_context context)
{
- return HDB_DEFAULT_DB;
+ static char *default_hdb = NULL;
+ struct hdb_dbinfo *dbinfo = NULL;
+ struct hdb_dbinfo *d = NULL;
+ const char *s;
+
+ if (default_hdb)
+ return default_hdb;
+
+ (void) hdb_get_dbinfo(context, &dbinfo);
+ while ((d = hdb_dbinfo_get_next(dbinfo, d)) != NULL) {
+ if ((s = hdb_dbinfo_get_dbname(context, d)) &&
+ (default_hdb = strdup(s)))
+ break;
+ }
+
+ hdb_free_dbinfo(context, &dbinfo);
+ return default_hdb ? default_hdb : HDB_DEFAULT_DB;
}