static int ltdb_lock_read(struct ldb_module *module)
{
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
int tdb_ret = 0;
int ret;
pid_t pid = getpid();
if (ldb_kv->pid != pid) {
- ldb_asprintf_errstring(
- ldb_module_get_ctx(module),
- __location__": Reusing ldb opend by pid %d in "
- "process %d\n",
- ldb_kv->pid,
- pid);
+ ldb_asprintf_errstring(ldb_module_get_ctx(module),
+ __location__
+ ": Reusing ldb opend by pid %d in "
+ "process %d\n",
+ ldb_kv->pid,
+ pid);
return LDB_ERR_PROTOCOL_ERROR;
}
static int ltdb_unlock_read(struct ldb_module *module)
{
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
pid_t pid = getpid();
if (ldb_kv->pid != pid) {
- ldb_asprintf_errstring(
- ldb_module_get_ctx(module),
- __location__": Reusing ldb opend by pid %d in "
- "process %d\n",
- ldb_kv->pid,
- pid);
+ ldb_asprintf_errstring(ldb_module_get_ctx(module),
+ __location__
+ ": Reusing ldb opend by pid %d in "
+ "process %d\n",
+ ldb_kv->pid,
+ pid);
return LDB_ERR_PROTOCOL_ERROR;
}
- if (!tdb_transaction_active(ldb_kv->tdb) && ldb_kv->read_lock_count == 1) {
+ if (!tdb_transaction_active(ldb_kv->tdb) &&
+ ldb_kv->read_lock_count == 1) {
tdb_unlockall_read(ldb_kv->tdb);
ldb_kv->read_lock_count--;
return 0;
const struct ldb_message *msg)
{
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
TDB_DATA key;
const struct ldb_val *guid_val;
int ret;
return ldb_kv_key_dn(module, mem_ctx, msg->dn);
}
- guid_val = ldb_msg_find_ldb_val(msg,
- ldb_kv->cache->GUID_index_attribute);
+ guid_val =
+ ldb_msg_find_ldb_val(msg, ldb_kv->cache->GUID_index_attribute);
if (guid_val == NULL) {
ldb_asprintf_errstring(ldb_module_get_ctx(module),
"Did not find GUID attribute %s "
static int ldb_kv_modified(struct ldb_module *module, struct ldb_dn *dn)
{
int ret = LDB_SUCCESS;
- struct ldb_kv_private *ldb_kv = talloc_get_type(ldb_module_get_private(module), struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv = talloc_get_type(
+ ldb_module_get_private(module), struct ldb_kv_private);
/* only allow modifies inside a transaction, otherwise the
* ldb is unsafe */
{
if (ldb_kv->warn_reindex) {
ldb_debug(ldb_module_get_ctx(module),
- LDB_DEBUG_ERROR, "Reindexing %s due to modification on %s",
- ldb_kv->kv_ops->name(ldb_kv), ldb_dn_get_linearized(dn));
+ LDB_DEBUG_ERROR,
+ "Reindexing %s due to modification on %s",
+ ldb_kv->kv_ops->name(ldb_kv),
+ ldb_dn_get_linearized(dn));
}
ret = ldb_kv_reindex(module);
}
int flgs)
{
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
TDB_DATA tdb_key;
struct ldb_val ldb_key;
struct ldb_val ldb_data;
* LDB_ERR_ENTRY_ALREADY_EXISTS means the DN, not
* the GUID, so re-map
*/
- if (ret == LDB_ERR_ENTRY_ALREADY_EXISTS
- && !is_special
- && ldb_kv->cache->GUID_index_attribute != NULL) {
+ if (ret == LDB_ERR_ENTRY_ALREADY_EXISTS && !is_special &&
+ ldb_kv->cache->GUID_index_attribute != NULL) {
ret = LDB_ERR_CONSTRAINT_VIOLATION;
}
goto done;
struct ldb_module *module = ctx->module;
struct ldb_request *req = ctx->req;
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
int ret = LDB_SUCCESS;
if (ldb_kv->max_key_length != 0 &&
ldb_kv->cache->GUID_index_attribute == NULL &&
- !ldb_dn_is_special(req->op.add.message->dn))
- {
+ !ldb_dn_is_special(req->op.add.message->dn)) {
ldb_set_errstring(ldb_module_get_ctx(module),
"Must operate ldb_mdb in GUID "
"index mode, but " LTDB_IDXGUID " not set.");
const struct ldb_message *msg)
{
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
struct ldb_val ldb_key;
TDB_DATA tdb_key;
int ret;
ldb_key.data = tdb_key.dptr;
ldb_key.length = tdb_key.dsize;
- ret = ldb_kv->kv_ops->delete(ldb_kv, ldb_key);
+ ret = ldb_kv->kv_ops->delete (ldb_kv, ldb_key);
TALLOC_FREE(tdb_key_ctx);
if (ret != 0) {
struct ldb_message_element *el;
bool is_special = ldb_dn_is_special(msg->dn);
- if (!is_special
- && ldb_kv->cache->GUID_index_attribute != NULL
- && ldb_attr_cmp(name, ldb_kv->cache->GUID_index_attribute) == 0) {
+ if (!is_special && ldb_kv->cache->GUID_index_attribute != NULL &&
+ ldb_attr_cmp(name, ldb_kv->cache->GUID_index_attribute) == 0) {
struct ldb_context *ldb = ldb_module_get_ctx(module);
- ldb_asprintf_errstring(ldb, "Must not modify GUID "
+ ldb_asprintf_errstring(ldb,
+ "Must not modify GUID "
"attribute %s (used as DB index)",
ldb_kv->cache->GUID_index_attribute);
return LDB_ERR_CONSTRAINT_VIOLATION;
module, ldb_kv, msg, name);
}
- ret = ldb_kv_index_del_value(module, ldb_kv, msg, el, i);
+ ret =
+ ldb_kv_index_del_value(module, ldb_kv, msg, el, i);
if (ret != LDB_SUCCESS) {
return ret;
}
{
struct ldb_context *ldb = ldb_module_get_ctx(module);
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
struct ldb_message *msg2;
unsigned int i, j;
int ret = LDB_SUCCESS, idx;
goto done;
}
- ret = ldb_kv_index_add_element(module, ldb_kv, msg2, el);
+ ret =
+ ldb_kv_index_add_element(module, ldb_kv, msg2, el);
if (ret != LDB_SUCCESS) {
goto done;
}
if (msg->elements[i].num_values == 0) {
/* Delete the whole attribute */
ret = ldb_kv_msg_delete_attribute(
- module, ldb_kv, msg2, msg->elements[i].name);
+ module,
+ ldb_kv,
+ msg2,
+ msg->elements[i].name);
if (ret == LDB_ERR_NO_SUCH_ATTRIBUTE &&
control_permissive) {
ret = LDB_SUCCESS;
{
struct ldb_module *module = ctx->module;
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
struct ldb_request *req = ctx->req;
struct ldb_message *msg;
int ret = LDB_SUCCESS;
pid_t pid = getpid();
if (ldb_kv->pid != pid) {
- ldb_asprintf_errstring(
- ldb_module_get_ctx(ldb_kv->module),
- __location__": Reusing ldb opend by pid %d in "
- "process %d\n",
- ldb_kv->pid,
- pid);
+ ldb_asprintf_errstring(ldb_module_get_ctx(ldb_kv->module),
+ __location__
+ ": Reusing ldb opend by pid %d in "
+ "process %d\n",
+ ldb_kv->pid,
+ pid);
return LDB_ERR_PROTOCOL_ERROR;
}
pid_t pid = getpid();
if (ldb_kv->pid != pid) {
- ldb_asprintf_errstring(
- ldb_module_get_ctx(ldb_kv->module),
- __location__": Reusing ldb opend by pid %d in "
- "process %d\n",
- ldb_kv->pid,
- pid);
+ ldb_asprintf_errstring(ldb_module_get_ctx(ldb_kv->module),
+ __location__
+ ": Reusing ldb opend by pid %d in "
+ "process %d\n",
+ ldb_kv->pid,
+ pid);
return LDB_ERR_PROTOCOL_ERROR;
}
pid_t pid = getpid();
if (ldb_kv->pid != pid) {
- ldb_asprintf_errstring(
- ldb_module_get_ctx(ldb_kv->module),
- __location__": Reusing ldb opend by pid %d in "
- "process %d\n",
- ldb_kv->pid,
- pid);
+ ldb_asprintf_errstring(ldb_module_get_ctx(ldb_kv->module),
+ __location__
+ ": Reusing ldb opend by pid %d in "
+ "process %d\n",
+ ldb_kv->pid,
+ pid);
return LDB_ERR_PROTOCOL_ERROR;
}
pid_t pid = getpid();
if (ldb_kv->pid != pid) {
- ldb_asprintf_errstring(
- ldb_module_get_ctx(ldb_kv->module),
- __location__": Reusing ldb opend by pid %d in "
- "process %d\n",
- ldb_kv->pid,
- pid);
+ ldb_asprintf_errstring(ldb_module_get_ctx(ldb_kv->module),
+ __location__
+ ": Reusing ldb opend by pid %d in "
+ "process %d\n",
+ ldb_kv->pid,
+ pid);
return LDB_ERR_PROTOCOL_ERROR;
}
static int ldb_kv_start_trans(struct ldb_module *module)
{
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
pid_t pid = getpid();
if (ldb_kv->pid != pid) {
- ldb_asprintf_errstring(
- ldb_module_get_ctx(ldb_kv->module),
- __location__": Reusing ldb opend by pid %d in "
- "process %d\n",
- ldb_kv->pid,
- pid);
+ ldb_asprintf_errstring(ldb_module_get_ctx(ldb_kv->module),
+ __location__
+ ": Reusing ldb opend by pid %d in "
+ "process %d\n",
+ ldb_kv->pid,
+ pid);
return LDB_ERR_PROTOCOL_ERROR;
}
{
int ret;
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
pid_t pid = getpid();
if (ldb_kv->pid != pid) {
- ldb_asprintf_errstring(
- ldb_module_get_ctx(module),
- __location__": Reusing ldb opend by pid %d in "
- "process %d\n",
- ldb_kv->pid,
- pid);
+ ldb_asprintf_errstring(ldb_module_get_ctx(module),
+ __location__
+ ": Reusing ldb opend by pid %d in "
+ "process %d\n",
+ ldb_kv->pid,
+ pid);
return LDB_ERR_PROTOCOL_ERROR;
}
{
int ret;
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
if (!ldb_kv->prepared_commit) {
ret = ldb_kv_prepare_commit(module);
if (ldb_kv->kv_ops->finish_write(ldb_kv) != 0) {
ret = ldb_kv->kv_ops->error(ldb_kv);
- ldb_asprintf_errstring(ldb_module_get_ctx(module),
- "Failure during tdb_transaction_commit(): %s -> %s",
- ldb_kv->kv_ops->errorstr(ldb_kv),
- ldb_strerror(ret));
+ ldb_asprintf_errstring(
+ ldb_module_get_ctx(module),
+ "Failure during tdb_transaction_commit(): %s -> %s",
+ ldb_kv->kv_ops->errorstr(ldb_kv),
+ ldb_strerror(ret));
return ret;
}
static int ldb_kv_del_trans(struct ldb_module *module)
{
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
if (ldb_kv_index_transaction_cancel(module) != 0) {
ldb_kv->kv_ops->abort_write(ldb_kv);
struct ldb_module *module = ctx->module;
struct ldb_request *req = ctx->req;
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
TALLOC_CTX *tmp_ctx = NULL;
struct ldb_seqnum_request *seq;
struct ldb_seqnum_result *res;
void *ctx)
{
struct kv_ctx kv_ctx = {
- .kv_traverse_fn = fn,
- .ctx = ctx,
- .ldb_kv = ldb_kv
- };
+ .kv_traverse_fn = fn, .ctx = ctx, .ldb_kv = ldb_kv};
if (tdb_transaction_active(ldb_kv->tdb)) {
return tdb_traverse(
ldb_kv->tdb, ltdb_traverse_fn_wrapper, &kv_ctx);
tdb_ret = tdb_delete(ldb_kv->tdb, key);
if (tdb_ret != 0) {
- ldb_debug(ldb, LDB_DEBUG_ERROR,
+ ldb_debug(ldb,
+ LDB_DEBUG_ERROR,
"Failed to delete %*.*s "
"for rekey as %*.*s: %s",
- (int)key.dsize, (int)key.dsize,
+ (int)key.dsize,
+ (int)key.dsize,
(const char *)key.dptr,
- (int)key2.dsize, (int)key2.dsize,
+ (int)key2.dsize,
+ (int)key2.dsize,
(const char *)key.dptr,
tdb_errorstr(ldb_kv->tdb));
ctx->error = ltdb_err_map(tdb_error(ldb_kv->tdb));
}
tdb_ret = tdb_store(ldb_kv->tdb, key2, data, 0);
if (tdb_ret != 0) {
- ldb_debug(ldb, LDB_DEBUG_ERROR,
+ ldb_debug(ldb,
+ LDB_DEBUG_ERROR,
"Failed to rekey %*.*s as %*.*s: %s",
- (int)key.dsize, (int)key.dsize,
+ (int)key.dsize,
+ (int)key.dsize,
(const char *)key.dptr,
- (int)key2.dsize, (int)key2.dsize,
+ (int)key2.dsize,
+ (int)key2.dsize,
(const char *)key.dptr,
tdb_errorstr(ldb_kv->tdb));
ctx->error = ltdb_err_map(tdb_error(ldb_kv->tdb));
void *private_data),
void *ctx)
{
- struct kv_ctx kv_ctx = {
- .parser = parser,
- .ctx = ctx,
- .ldb_kv = ldb_kv
- };
+ struct kv_ctx kv_ctx = {.parser = parser, .ctx = ctx, .ldb_kv = ldb_kv};
TDB_DATA key = {
.dptr = ldb_key.data,
.dsize = ldb_key.length
static int ldb_kv_lock_read(struct ldb_module *module)
{
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
return ldb_kv->kv_ops->lock_read(module);
}
static int ldb_kv_unlock_read(struct ldb_module *module)
{
void *data = ldb_module_get_private(module);
- struct ldb_kv_private *ldb_kv = talloc_get_type(data, struct ldb_kv_private);
+ struct ldb_kv_private *ldb_kv =
+ talloc_get_type(data, struct ldb_kv_private);
return ldb_kv->kv_ops->unlock_read(module);
}
errno = 0;
/* note that we use quite a large default hash size */
- ldb_kv->tdb = ltdb_wrap_open(ldb_kv, path, 10000,
- tdb_flags, open_flags,
- ldb_get_create_perms(ldb), ldb);
+ ldb_kv->tdb = ltdb_wrap_open(ldb_kv,
+ path,
+ 10000,
+ tdb_flags,
+ open_flags,
+ ldb_get_create_perms(ldb),
+ ldb);
if (!ldb_kv->tdb) {
ldb_asprintf_errstring(ldb,
"Unable to open tdb '%s': %s", path, strerror(errno));