summaryrefslogtreecommitdiff
path: root/source4/ldap_server
diff options
context:
space:
mode:
authorNadezhda Ivanova <nadezhda.ivanova@postpath.com>2009-12-15 20:29:20 +0200
committerNadezhda Ivanova <nadezhda.ivanova@postpath.com>2009-12-15 20:29:20 +0200
commit4330efe0f22b7318058867a554222c3c0049f644 (patch)
tree0587d6d2b8f5699394b9b31588bc09d2d3904eca /source4/ldap_server
parentb85f6f63e6e957970f09acb2aab14e63d2661a22 (diff)
downloadsamba-4330efe0f22b7318058867a554222c3c0049f644.tar.gz
samba-4330efe0f22b7318058867a554222c3c0049f644.tar.bz2
samba-4330efe0f22b7318058867a554222c3c0049f644.zip
Removed ldb_modify_ctrl from ldb, implemented as a static in ldap_backend.
Diffstat (limited to 'source4/ldap_server')
-rw-r--r--source4/ldap_server/ldap_backend.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c
index 5eabda972e..d983a54261 100644
--- a/source4/ldap_server/ldap_backend.c
+++ b/source4/ldap_server/ldap_backend.c
@@ -171,6 +171,48 @@ static int map_ldb_error(TALLOC_CTX *mem_ctx, int ldb_err,
/* result is 1:1 for now */
return ldb_err;
}
+/* create and execute a modify request */
+static int ldb_mod_req_with_controls(struct ldb_context *ldb,
+ const struct ldb_message *message,
+ struct ldb_control **controls)
+{
+ struct ldb_request *req;
+ int ret;
+
+ ret = ldb_msg_sanity_check(ldb, message);
+ if (ret != LDB_SUCCESS) {
+ return ret;
+ }
+
+ ret = ldb_build_mod_req(&req, ldb, ldb,
+ message,
+ controls,
+ NULL,
+ ldb_op_default_callback,
+ NULL);
+
+ if (ret != LDB_SUCCESS) {
+ return ret;
+ }
+
+ ret = ldb_transaction_start(ldb);
+ if (ret != LDB_SUCCESS) {
+ return ret;
+ }
+
+ ret = ldb_request(ldb, req);
+ if (ret == LDB_SUCCESS) {
+ ret = ldb_wait(req->handle, LDB_WAIT_ALL);
+ }
+
+ if (ret == LDB_SUCCESS) {
+ return ldb_transaction_commit(ldb);
+ }
+ ldb_transaction_cancel(ldb);
+
+ talloc_free(req);
+ return ret;
+}
/*
connect to the sam database
@@ -546,7 +588,7 @@ reply:
NT_STATUS_HAVE_NO_MEMORY(modify_reply);
if (result == LDAP_SUCCESS) {
- ldb_ret = ldb_modify_ctrl(samdb, msg, call->request->controls);
+ ldb_ret = ldb_mod_req_with_controls(samdb, msg, call->request->controls);
result = map_ldb_error(local_ctx, ldb_ret, &errstr);
}