/* Add the local record. */ int map_add_do_local(struct ldb_handle *handle) { struct map_context *ac; ac = talloc_get_type(handle->private_data, struct map_context); ldb_set_timeout_from_prev_req(ac->module->ldb, ac->orig_req, ac->local_req); ac->step = MAP_ADD_LOCAL; handle->state = LDB_ASYNC_INIT; handle->status = LDB_SUCCESS; return ldb_next_request(ac->module, ac->local_req); }
/* Modify the remote record. */ int map_modify_do_remote(struct ldb_handle *handle) { struct map_context *ac; ac = talloc_get_type(handle->private_data, struct map_context); ldb_set_timeout_from_prev_req(ac->module->ldb, ac->orig_req, ac->remote_req); ac->step = MAP_MODIFY_REMOTE; handle->state = LDB_ASYNC_INIT; handle->status = LDB_SUCCESS; return ldb_next_remote_request(ac->module, ac->remote_req); }
static int samldb_add(struct ldb_module *module, struct ldb_request *req) { const struct ldb_message *msg = req->op.add.message; struct ldb_message *msg2 = NULL; struct ldb_request *down_req; int ret; ldb_debug(module->ldb, LDB_DEBUG_TRACE, "samldb_add_record\n"); if (ldb_dn_is_special(msg->dn)) { /* do not manipulate our control entries */ return ldb_next_request(module, req); } /* is user or computer? */ if ((samdb_find_attribute(module->ldb, msg, "objectclass", "user") != NULL) || (samdb_find_attribute(module->ldb, 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 */ if ( ! msg2 ) { if (samdb_find_attribute(module->ldb, msg, "objectclass", "group") != NULL) { ret = samldb_fill_group_object(module, msg, &msg2); if (ret) { return ret; } } } /* perhaps a foreignSecurityPrincipal? */ if ( ! msg2 ) { if (samdb_find_attribute(module->ldb, msg, "objectclass", "foreignSecurityPrincipal") != NULL) { ret = samldb_fill_foreignSecurityPrincipal_object(module, msg, &msg2); if (ret) { return ret; } } } if (msg2 == NULL) { return ldb_next_request(module, req); } down_req = talloc(req, struct ldb_request); if (down_req == NULL) { return LDB_ERR_OPERATIONS_ERROR; } *down_req = *req; down_req->op.add.message = talloc_steal(down_req, msg2); ldb_set_timeout_from_prev_req(module->ldb, req, down_req); /* go on with the call chain */ ret = ldb_next_request(module, down_req); /* do not free down_req as the call results may be linked to it, * it will be freed when the upper level request get freed */ if (ret == LDB_SUCCESS) { req->handle = down_req->handle; } return ret; }