From 1a22d88c93b173ef4221f69d566be1e1f4797850 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sun, 21 May 2006 20:21:34 +0000 Subject: r15783: Fix previous commit, was the wrong way to deal with the problem (This used to be commit 36537100db491012d8124f7aca266a8290f2eee6) --- source4/dsdb/samdb/ldb_modules/samldb.c | 50 ++++++++++++++++----------------- 1 file changed, 24 insertions(+), 26 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules') diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c index 8a708af83b..706c0bb5c3 100644 --- a/source4/dsdb/samdb/ldb_modules/samldb.c +++ b/source4/dsdb/samdb/ldb_modules/samldb.c @@ -776,16 +776,14 @@ static int samldb_add(struct ldb_module *module, struct ldb_request *req) return ldb_next_request(module, req); } - /* 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 user or computer? */ + if ((samldb_find_attribute(msg, "objectclass", "user") != NULL) || + (samldb_find_attribute(msg, "objectclass", "computer") != NULL)) { + /* 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 */ @@ -842,21 +840,14 @@ static int samldb_add_async(struct ldb_module *module, struct ldb_request *req) return ldb_next_request(module, req); } - down_req = talloc(module, struct ldb_request); - if (down_req == NULL) { - return LDB_ERR_OPERATIONS_ERROR; - } - - /* is user or computer? Skip if not */ + /* is user or computer? */ 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; + /* 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 */ @@ -879,11 +870,18 @@ static int samldb_add_async(struct ldb_module *module, struct ldb_request *req) } } + if (msg2 == NULL) { + return ldb_next_request(module, req); + } + + down_req = talloc(module, struct ldb_request); + if (down_req == NULL) { + return LDB_ERR_OPERATIONS_ERROR; + } + *down_req = *req; - if (msg2 != NULL) { - down_req->op.add.message = talloc_steal(down_req, msg2); - } + down_req->op.add.message = talloc_steal(down_req, msg2); /* go on with the call chain */ ret = ldb_next_request(module, down_req); -- cgit