diff --git a/lib/hdb/hdb.c b/lib/hdb/hdb.c index 0f8cef23f..2d6cee744 100644 --- a/lib/hdb/hdb.c +++ b/lib/hdb/hdb.c @@ -742,7 +742,8 @@ hdb_create(krb5_context context, HDB **db, const char *filename) *db = NULL; if (filename == NULL) - filename = HDB_DEFAULT_DB; + filename = hdb_default_db(context); + cb_ctx.h = find_method(filename, &cb_ctx.residual); cb_ctx.filename = filename; @@ -822,8 +823,11 @@ hdb_create(krb5_context context, HDB **db, const char *filename) filename); return ENOTSUP; } - if (!*db) + if (!*db) { ret = (*cb_ctx.h->create)(context, db, cb_ctx.residual); + if (ret == 0) + (*db)->hdb_method_name = cb_ctx.h->prefix; + } if (ret == 0 && *db) ret = load_config(context, *db); if (ret && *db) { diff --git a/lib/hdb/hdb.h b/lib/hdb/hdb.h index 80c3020e8..558210f06 100644 --- a/lib/hdb/hdb.h +++ b/lib/hdb/hdb.h @@ -117,6 +117,7 @@ typedef struct hdb_entry_ex { typedef struct HDB { void *hdb_db; void *hdb_dbc; /** don't use, only for DB3 */ + const char *hdb_method_name; char *hdb_name; int hdb_master_key_set; hdb_master_key hdb_master_key; @@ -302,7 +303,7 @@ typedef struct HDB { krb5_error_code (*hdb_set_sync)(krb5_context, struct HDB *, int); }HDB; -#define HDB_INTERFACE_VERSION 10 +#define HDB_INTERFACE_VERSION 11 struct hdb_method { int version; diff --git a/lib/hdb/keytab.c b/lib/hdb/keytab.c index 97c923f08..83cc851d9 100644 --- a/lib/hdb/keytab.c +++ b/lib/hdb/keytab.c @@ -159,8 +159,9 @@ find_db (krb5_context context, } } hdb_free_dbinfo(context, &head); - if (*dbname == NULL) - *dbname = strdup(HDB_DEFAULT_DB); + if (*dbname == NULL && + (*dbname = strdup(hdb_default_db(context))) == NULL) + return krb5_enomem(context); return 0; } diff --git a/lib/kadm5/ipropd_slave.c b/lib/kadm5/ipropd_slave.c index 3fb08b96a..cd9a6f57a 100644 --- a/lib/kadm5/ipropd_slave.c +++ b/lib/kadm5/ipropd_slave.c @@ -527,7 +527,14 @@ receive_everything(krb5_context context, int fd, if (ret) krb5_err(context, IPROPD_RESTART, ret, "Failed to lock iprop log for writes"); - ret = asprintf(&dbname, "%s-NEW", server_context->db->hdb_name); + if (server_context->db->hdb_method_name) { + ret = asprintf(&dbname, "%.*s:%s-NEW", + (int) strlen(server_context->db->hdb_method_name) - 1, + server_context->db->hdb_method_name, + server_context->db->hdb_name); + } else { + ret = asprintf(&dbname, "%s-NEW", server_context->db->hdb_name); + } if (ret == -1) krb5_err(context, IPROPD_RESTART, ENOMEM, "asprintf"); ret = hdb_create(context, &mydb, dbname);