kadm5: Add KADM5_CONFIG_ASYNC_HDB_WRITES param
This commit is contained in:
@@ -225,6 +225,7 @@ typedef struct _kadm5_policy_ent_t {
|
||||
#define KADM5_CONFIG_ENCTYPES (1 << 18)
|
||||
#define KADM5_CONFIG_READONLY_ADMIN_SERVER (1 << 19)
|
||||
#define KADM5_CONFIG_READONLY_KADMIN_PORT (1 << 20)
|
||||
#define KADM5_CONFIG_ASYNC_HDB_WRITES (1 << 21)
|
||||
|
||||
#define KADM5_PRIV_GET (1 << 0)
|
||||
#define KADM5_PRIV_ADD (1 << 1)
|
||||
|
||||
@@ -140,6 +140,12 @@ change(void *server_handle,
|
||||
ret = context->db->hdb_open(context->context, context->db, O_RDWR, 0);
|
||||
if(ret)
|
||||
return ret;
|
||||
|
||||
if (context->config.mask & KADM5_CONFIG_ASYNC_HDB_WRITES) {
|
||||
ret = context->db->hdb_set_sync(context->context, context->db, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
ret = kadm5_log_init(context);
|
||||
@@ -376,6 +382,12 @@ kadm5_s_chpass_principal_with_key(void *server_handle,
|
||||
ret = context->db->hdb_open(context->context, context->db, O_RDWR, 0);
|
||||
if(ret)
|
||||
return ret;
|
||||
|
||||
if (context->config.mask & KADM5_CONFIG_ASYNC_HDB_WRITES) {
|
||||
ret = context->db->hdb_set_sync(context->context, context->db, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
ret = kadm5_log_init(context);
|
||||
|
||||
@@ -56,6 +56,12 @@ kadm5_s_lock(void *server_handle)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (context->config.mask & KADM5_CONFIG_ASYNC_HDB_WRITES) {
|
||||
ret = context->db->hdb_set_sync(context->context, context->db, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = context->db->hdb_lock(context->context, context->db, HDB_WLOCK);
|
||||
if (ret) {
|
||||
(void) context->db->hdb_close(context->context, context->db);
|
||||
|
||||
@@ -205,6 +205,14 @@ kadm5_s_create_principal_with_key(void *server_handle,
|
||||
hdb_free_entry(context->context, context->db, &ent);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (context->config.mask & KADM5_CONFIG_ASYNC_HDB_WRITES) {
|
||||
ret = context->db->hdb_set_sync(context->context, context->db, 0);
|
||||
if (ret) {
|
||||
hdb_free_entry(context->context, context->db, &ent);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret = kadm5_log_init(context);
|
||||
@@ -324,6 +332,14 @@ kadm5_s_create_principal(void *server_handle,
|
||||
hdb_free_entry(context->context, context->db, &ent);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (context->config.mask & KADM5_CONFIG_ASYNC_HDB_WRITES) {
|
||||
ret = context->db->hdb_set_sync(context->context, context->db, 0);
|
||||
if (ret) {
|
||||
hdb_free_entry(context->context, context->db, &ent);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret = kadm5_log_init(context);
|
||||
|
||||
@@ -101,6 +101,15 @@ kadm5_s_delete_principal(void *server_handle, krb5_principal princ)
|
||||
krb5_warn(context->context, ret, "opening database");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (context->config.mask & KADM5_CONFIG_ASYNC_HDB_WRITES) {
|
||||
ret = context->db->hdb_set_sync(context->context, context->db, 0);
|
||||
if (ret) {
|
||||
krb5_warn(context->context, ret,
|
||||
"disabling synchronous updates");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret = kadm5_log_init(context);
|
||||
|
||||
@@ -111,6 +111,12 @@ modify_principal(void *server_handle,
|
||||
ret = context->db->hdb_open(context->context, context->db, O_RDWR, 0);
|
||||
if(ret)
|
||||
return ret;
|
||||
|
||||
if (context->config.mask & KADM5_CONFIG_ASYNC_HDB_WRITES) {
|
||||
ret = context->db->hdb_set_sync(context->context, context->db, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
ret = kadm5_log_init(context);
|
||||
|
||||
@@ -103,6 +103,12 @@ kadm5_s_prune_principal(void *server_handle,
|
||||
ret = context->db->hdb_open(context->context, context->db, O_RDWR, 0);
|
||||
if(ret)
|
||||
return ret;
|
||||
|
||||
if (context->config.mask & KADM5_CONFIG_ASYNC_HDB_WRITES) {
|
||||
ret = context->db->hdb_set_sync(context->context, context->db, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
ret = kadm5_log_init(context);
|
||||
|
||||
@@ -111,6 +111,12 @@ kadm5_s_randkey_principal(void *server_handle,
|
||||
ret = context->db->hdb_open(context->context, context->db, O_RDWR, 0);
|
||||
if(ret)
|
||||
return ret;
|
||||
|
||||
if (context->config.mask & KADM5_CONFIG_ASYNC_HDB_WRITES) {
|
||||
ret = context->db->hdb_set_sync(context->context, context->db, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
ret = kadm5_log_init(context);
|
||||
|
||||
@@ -108,6 +108,12 @@ kadm5_s_rename_principal(void *server_handle,
|
||||
ret = context->db->hdb_open(context->context, context->db, O_RDWR, 0);
|
||||
if(ret)
|
||||
return ret;
|
||||
|
||||
if (context->config.mask & KADM5_CONFIG_ASYNC_HDB_WRITES) {
|
||||
ret = context->db->hdb_set_sync(context->context, context->db, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
ret = kadm5_log_init(context);
|
||||
|
||||
@@ -120,10 +120,17 @@ kadm5_s_setkey_principal_3(void *server_handle,
|
||||
size_t i;
|
||||
|
||||
memset(&ent, 0, sizeof(ent));
|
||||
if (!context->keep_open)
|
||||
ret = context->db->hdb_open(context->context, context->db, O_RDWR, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (!context->keep_open) {
|
||||
ret = context->db->hdb_open(context->context, context->db, O_RDWR, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (context->config.mask & KADM5_CONFIG_ASYNC_HDB_WRITES) {
|
||||
ret = context->db->hdb_set_sync(context->context, context->db, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
ret = kadm5_log_init(context);
|
||||
if (ret) {
|
||||
|
||||
Reference in New Issue
Block a user