svn commit: samba r17500 - in branches/SOC/mkhl/ldb-map/modules: .
mkhl at samba.org
mkhl at samba.org
Fri Aug 11 22:36:53 GMT 2006
Author: mkhl
Date: 2006-08-11 22:36:53 +0000 (Fri, 11 Aug 2006)
New Revision: 17500
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17500
Log:
Add function to check whether we are supposed to use a local partition at all.
Skip requests targeted at the local db if we aren't supposed to use it.
Martin
Modified:
branches/SOC/mkhl/ldb-map/modules/ldb_map.c
Changeset:
Modified: branches/SOC/mkhl/ldb-map/modules/ldb_map.c
===================================================================
--- branches/SOC/mkhl/ldb-map/modules/ldb_map.c 2006-08-11 22:11:29 UTC (rev 17499)
+++ branches/SOC/mkhl/ldb-map/modules/ldb_map.c 2006-08-11 22:36:53 UTC (rev 17500)
@@ -228,6 +228,20 @@
/* Dealing with DNs for different partitions
* ========================================= */
+/* Check whether any data should be stored in the local partition. */
+static
+BOOL
+map_check_local_db(struct ldb_module *module)
+{
+ const struct ldb_map_context *data = map_get_context(module);
+
+ if (!data->remote_base_dn || !data->local_base_dn) {
+ return False;
+ }
+
+ return True;
+}
+
/* WARK: verbatim copy from ldb_dn.c */
static
struct ldb_dn_component
@@ -2334,6 +2348,11 @@
return LDB_ERR_OPERATIONS_ERROR;
}
+ /* There is no local db, stop searching */
+ if (!map_check_local_db(ac->module)) {
+ return map_up_callback(ldb, ac->orig_req, ares);
+ }
+
/* Prepare local search context */
sc = map_init_search_context(ac, ares);
if (sc == NULL) {
@@ -2598,8 +2617,8 @@
ac->local_req->op.add.message = local;
ac->remote_req->op.add.message = remote;
- if (local->num_elements == 0) {
- /* No local data, just run the remote request */
+ if ((local->num_elements == 0) || (!map_check_local_db(ac->module))) {
+ /* No local data or db, just run the remote request */
talloc_free(ac->local_req);
req->handle = h; /* return our own handle to deal with this call */
return map_add_do_remote(h);
@@ -2761,8 +2780,8 @@
ac->local_req->op.mod.message = local;
ac->remote_req->op.mod.message = remote;
- if (local->num_elements == 0) {
- /* No local data, just run the remote request */
+ if ((local->num_elements == 0) || (!map_check_local_db(ac->module))) {
+ /* No local data or db, just run the remote request */
talloc_free(ac->local_req);
req->handle = h; /* return our own handle to deal with this call */
return map_modify_do_remote(h);
@@ -2877,16 +2896,11 @@
*(ac->remote_req) = *req; /* copy the request */
ac->remote_req->op.del.dn = ldb_dn_map_local(module, ac->remote_req, req->op.del.dn);
- /* The DN didn't change, so just pretend we were never here */
- /* TODO:: It's actually quite common for DNs not to change
- * until the remote one is rebased, so we need a
- * different way to test here.
- if (ldb_dn_compare(module->ldb, ac->remote_req->op.del.dn,
- req->op.del.dn) == 0) {
- talloc_free(h);
- return ldb_next_request(module, req);
+ /* No local db, just run the remote request */
+ if (!map_check_local_db(ac->module)) {
+ req->handle = h; /* return our own handle to deal with this call */
+ return map_delete_do_remote(h);
}
- */
ac->remote_req->context = NULL;
ac->remote_req->callback = NULL;
@@ -3032,6 +3046,12 @@
ac->remote_req->context = NULL;
ac->remote_req->callback = NULL;
+ /* No local db, just run the remote request */
+ if (!map_check_local_db(ac->module)) {
+ req->handle = h; /* return our own handle to deal with this call */
+ return map_rename_do_remote(h);
+ }
+
/* Prepare the fixup operation */
/* TODO: use GUIDs here instead -- or skip it when GUIDs are used. */
ac->down_req = map_build_fixup_req(ac, req->op.rename.newdn, ac->remote_req->op.rename.newdn);
More information about the samba-cvs
mailing list