summaryrefslogtreecommitdiff
path: root/source4/dsdb
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-05-21 20:06:01 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:08:19 -0500
commite2112ba3b7d491f6b6d9957b57a36a78efed18a9 (patch)
tree0c1d731eaae11579a71a635dd7d78043b435face /source4/dsdb
parent03f520fd1232ef14eeb75af439685c6978db04e3 (diff)
downloadsamba-e2112ba3b7d491f6b6d9957b57a36a78efed18a9.tar.gz
samba-e2112ba3b7d491f6b6d9957b57a36a78efed18a9.tar.bz2
samba-e2112ba3b7d491f6b6d9957b57a36a78efed18a9.zip
r15782: More fixes for async cases
(This used to be commit 3c9434e264710a1fa29adedbe571d5324ecae906)
Diffstat (limited to 'source4/dsdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/objectguid.c13
-rw-r--r--source4/dsdb/samdb/ldb_modules/password_hash.c7
-rw-r--r--source4/dsdb/samdb/ldb_modules/samldb.c48
3 files changed, 42 insertions, 26 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c
index 71591f187f..96457447fb 100644
--- a/source4/dsdb/samdb/ldb_modules/objectguid.c
+++ b/source4/dsdb/samdb/ldb_modules/objectguid.c
@@ -133,8 +133,10 @@ static int objectguid_add_async(struct ldb_module *module, struct ldb_request *r
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.add.message = msg = ldb_msg_copy_shallow(down_req, req->op.add.message);
if (msg == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -152,16 +154,7 @@ static int objectguid_add_async(struct ldb_module *module, struct ldb_request *r
if (ret) {
return ret;
}
-
- 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);
diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c
index 617962b909..0d4f0c6a0f 100644
--- a/source4/dsdb/samdb/ldb_modules/password_hash.c
+++ b/source4/dsdb/samdb/ldb_modules/password_hash.c
@@ -205,6 +205,8 @@ static int password_hash_handle(struct ldb_module *module, struct ldb_request *r
case LDB_REQ_MODIFY:
modified_orig_request->op.mod.message = msg2;
break;
+ default:
+ return LDB_ERR_OPERATIONS_ERROR;
}
/* Send the (modified) request of the original caller down to the database */
@@ -1275,7 +1277,7 @@ static int password_hash_add_async_do_add(struct ldb_async_handle *h) {
ac = talloc_get_type(h->private_data, struct ph_async_context);
- domain = get_domain_data(ac->module, ac, ac->search_res);
+ domain = get_domain_data(ac->module, ac, ac->dom_res);
if (domain == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -1693,7 +1695,8 @@ static int ph_async_wait(struct ldb_async_handle *handle) {
return LDB_SUCCESS;
}
}
- return LDB_SUCCESS;
+
+ break;
case PH_MOD_DO_REQ:
if (ac->down_req->async.handle->state != LDB_ASYNC_DONE) {
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c
index 31cf6143a1..8a708af83b 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -625,6 +625,20 @@ static int samldb_fill_user_or_computer_object(struct ldb_module *module, const
return LDB_ERR_OPERATIONS_ERROR;
}
+ /* make sure we also add person, organizationalPerson and top */
+ if ( ! samldb_find_or_add_attribute(module, msg2, "objectclass", "person", "person")) {
+ talloc_free(mem_ctx);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+ if ( ! samldb_find_or_add_attribute(module, msg2, "objectclass", "organizationalPerson", "organizationalPerson")) {
+ talloc_free(mem_ctx);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+ if ( ! samldb_find_or_add_attribute(module, msg2, "objectclass", "top", "top")) {
+ talloc_free(mem_ctx);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
/* meddle with objectclass */
if (ldb_msg_find_element(msg2, "samAccountName") == NULL) {
@@ -762,13 +776,16 @@ static int samldb_add(struct ldb_module *module, struct ldb_request *req)
return ldb_next_request(module, req);
}
- /* is user or computer? add all relevant missing objects */
- if ((samldb_find_attribute(msg, "objectclass", "user") != NULL) ||
- (samldb_find_attribute(msg, "objectclass", "computer") != NULL)) {
- ret = samldb_fill_user_or_computer_object(module, msg, &msg2);
- if (ret) {
- return ret;
- }
+ /* is user or computer? Skip if not */
+ if ((samldb_find_attribute(msg, "objectclass", "user") == NULL) &&
+ (samldb_find_attribute(msg, "objectclass", "computer") == NULL)) {
+ return ldb_next_request(module, req);
+ }
+
+ /* add all relevant missing objects */
+ ret = samldb_fill_user_or_computer_object(module, msg, &msg2);
+ if (ret) {
+ return ret;
}
/* is group? add all relevant missing objects */
@@ -830,13 +847,16 @@ static int samldb_add_async(struct ldb_module *module, struct ldb_request *req)
return LDB_ERR_OPERATIONS_ERROR;
}
- /* is user or computer? add all relevant missing objects */
- if ((samldb_find_attribute(msg, "objectclass", "user") != NULL) ||
- (samldb_find_attribute(msg, "objectclass", "computer") != NULL)) {
- ret = samldb_fill_user_or_computer_object(module, msg, &msg2);
- if (ret) {
- return ret;
- }
+ /* is user or computer? Skip if not */
+ if ((samldb_find_attribute(msg, "objectclass", "user") == NULL) &&
+ (samldb_find_attribute(msg, "objectclass", "computer") == NULL)) {
+ return ldb_next_request(module, req);
+ }
+
+ /* add all relevant missing objects */
+ ret = samldb_fill_user_or_computer_object(module, msg, &msg2);
+ if (ret) {
+ return ret;
}
/* is group? add all relevant missing objects */