iprop: More default HDB type fixes
This commit is contained in:
@@ -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) {
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user