summaryrefslogtreecommitdiffstats
path: root/source4/lib/ldb
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-05-20 19:37:21 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:08:15 -0500
commit6d0969aa1adff4c7f134bd6e3e42997e72b41cf6 (patch)
tree67b86f66eb8f698988c3484c55774e3b1397ced5 /source4/lib/ldb
parente23cc70a72e6582e91bcfdaf1d6ed2191e7e23a6 (diff)
downloadsamba-6d0969aa1adff4c7f134bd6e3e42997e72b41cf6.tar.gz
samba-6d0969aa1adff4c7f134bd6e3e42997e72b41cf6.tar.xz
samba-6d0969aa1adff4c7f134bd6e3e42997e72b41cf6.zip
r15761: Fix-as-you-go ...
Testing various async paths and uncovering bugs (This used to be commit 099d873ea596ece18efe63b06bc64e7f97a96f82)
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r--source4/lib/ldb/common/ldb_msg.c2
-rw-r--r--source4/lib/ldb/include/ldb.h8
-rw-r--r--source4/lib/ldb/modules/operational.c26
3 files changed, 11 insertions, 25 deletions
diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c
index b09f2ce6eda..bae17e7046d 100644
--- a/source4/lib/ldb/common/ldb_msg.c
+++ b/source4/lib/ldb/common/ldb_msg.c
@@ -734,7 +734,7 @@ int ldb_msg_check_string_attribute(const struct ldb_message *msg, const char *na
return 0;
val.data = discard_const(value);
- val.length = strlen(value) + 1;
+ val.length = strlen(value);
if (ldb_msg_find_val(el, &val))
return 1;
diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h
index 866b062d06c..9f0613feaad 100644
--- a/source4/lib/ldb/include/ldb.h
+++ b/source4/lib/ldb/include/ldb.h
@@ -619,17 +619,17 @@ struct ldb_async_handle {
struct ldb_search {
const struct ldb_dn *base;
enum ldb_scope scope;
- struct ldb_parse_tree *tree;
+ const struct ldb_parse_tree *tree;
const char * const *attrs;
struct ldb_result *res;
};
struct ldb_add {
- struct ldb_message *message;
+ const struct ldb_message *message;
};
struct ldb_modify {
- struct ldb_message *message;
+ const struct ldb_message *message;
};
struct ldb_delete {
@@ -647,7 +647,7 @@ struct ldb_register_control {
struct ldb_request {
- int operation;
+ enum ldb_request_type operation;
union {
struct ldb_search search;
diff --git a/source4/lib/ldb/modules/operational.c b/source4/lib/ldb/modules/operational.c
index 070f91e762a..d796e93e544 100644
--- a/source4/lib/ldb/modules/operational.c
+++ b/source4/lib/ldb/modules/operational.c
@@ -522,8 +522,10 @@ static int operational_add_async(struct ldb_module *module, struct ldb_request *
return LDB_ERR_OPERATIONS_ERROR;
}
+ *down_req = *req;
+
/* we have to copy the message as the caller might have it as a const */
- msg = ldb_msg_copy_shallow(down_req, req->op.add.message);
+ down_req->op.mod.message = msg = ldb_msg_copy_shallow(down_req, req->op.mod.message);
if (msg == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -543,15 +545,6 @@ static int operational_add_async(struct ldb_module *module, struct ldb_request *
}
}
- down_req->op.add.message = msg;
-
- down_req->controls = req->controls;
- down_req->creds = req->creds;
-
- down_req->async.context = req->async.context;
- down_req->async.callback = req->async.callback;
- down_req->async.timeout = req->async.timeout;
-
/* go on with the call chain */
ret = ldb_next_request(module, down_req);
@@ -583,8 +576,10 @@ static int operational_modify_async(struct ldb_module *module, struct ldb_reques
return LDB_ERR_OPERATIONS_ERROR;
}
+ *down_req = *req;
+
/* we have to copy the message as the caller might have it as a const */
- msg = ldb_msg_copy_shallow(down_req, req->op.mod.message);
+ down_req->op.mod.message = msg = ldb_msg_copy_shallow(down_req, req->op.mod.message);
if (msg == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -600,16 +595,7 @@ static int operational_modify_async(struct ldb_module *module, struct ldb_reques
talloc_free(down_req);
return -1;
}
-
- down_req->op.mod.message = msg;
- down_req->controls = req->controls;
- down_req->creds = req->creds;
-
- down_req->async.context = req->async.context;
- down_req->async.callback = req->async.callback;
- down_req->async.timeout = req->async.timeout;
-
/* go on with the call chain */
ret = ldb_next_request(module, down_req);