[SCM] Samba Shared Repository - branch master updated - tevent-0-9-8-645-gee4f7f1

Andrew Tridgell tridge at samba.org
Tue Sep 22 18:12:07 MDT 2009


The branch, master has been updated
       via  ee4f7f1209cc7668e7245d21e9bf2424d8c77244 (commit)
       via  83bef7d047def0711b0893c6b2a5096b195811ef (commit)
       via  1dfcd4c22c7627c1474ecf929fa24fb35b381eae (commit)
       via  bb3bdb3a62b3b895b9e0c013483a6356ecd7a3aa (commit)
       via  4a74b2839753aa248f1c60f3e2d1f2441c0ac891 (commit)
       via  9b752399c11b84c2f671e0dcc6554b65e9d4c1ae (commit)
       via  fb84edabbe9f358031117de2cf78613c704ac600 (commit)
       via  430ee62e0c85c40df250ac42a3c35f22ddc70031 (commit)
       via  8a090265b700669ac9e1296bc3d808e8851945e6 (commit)
       via  a971b87a9e71cea5ef785b58c8d4ac3f4e3ea22d (commit)
       via  69cb91a2eb2c3853663a61c2ed8f38e8fdde0964 (commit)
       via  a30d6130869239a6d6160c50908092e1d1424af5 (commit)
       via  5d16b9c1bf3476ce24a48bd2796111e7e27c2064 (commit)
       via  2e98ee0907474990e2929c892f5ead731d7ddb34 (commit)
       via  ec5d01278a6f38f76eb6edfa2e9bfb2fc8eb6fbe (commit)
      from  1544c2b66c84f5bc7a773aa1a4aa4589d766a6d5 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit ee4f7f1209cc7668e7245d21e9bf2424d8c77244
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Sep 22 17:07:33 2009 -0700

    s4-drsserver: sort by DN to give tree order
    
    This might help the windows client with ordered requests. Later we
    need to support the "ancestors" mode flag.

commit 83bef7d047def0711b0893c6b2a5096b195811ef
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Sep 22 17:06:38 2009 -0700

    s4-ldb: server side sort args are const char *

commit 1dfcd4c22c7627c1474ecf929fa24fb35b381eae
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Sep 22 17:06:14 2009 -0700

    s4-ldb: fixed call argument order for ldb_dn_from_ldb_val
    
    This caused _lots_ of problems, especially in server side sort

commit bb3bdb3a62b3b895b9e0c013483a6356ecd7a3aa
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Sep 22 14:26:59 2009 -0700

    s4-ldb: added a bunch more debug for DC join
    
    These additional debug messages were added to help us track down
    w2k8->s4 domain join

commit 4a74b2839753aa248f1c60f3e2d1f2441c0ac891
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Sep 22 14:25:52 2009 -0700

    s4-ldb: when tracing, show ldb_set_debug messages

commit 9b752399c11b84c2f671e0dcc6554b65e9d4c1ae
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Sep 22 14:25:12 2009 -0700

    s4-ldbmodules: allow instanceType to be specified by clients
    
    This is needed for the WSPP ADS testsuite

commit fb84edabbe9f358031117de2cf78613c704ac600
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Sep 22 14:20:36 2009 -0700

    s4-util: windows only accepts lowercase hex encodings for extended DNs

commit 430ee62e0c85c40df250ac42a3c35f22ddc70031
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Sep 22 00:18:25 2009 -0700

    s4-torture: add some debug info to RPC-HANDLES

commit 8a090265b700669ac9e1296bc3d808e8851945e6
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Sep 22 00:18:03 2009 -0700

    s4-rpcserver: added support for shared handles
    
    This supports shared RPC handles across connections on all RPC
    interfaces.
    
    It turns out that w2k3 and w2k8 don't actually support this on all
    pipes. We need to test which pipes we should enable this on.

commit a971b87a9e71cea5ef785b58c8d4ac3f4e3ea22d
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Sep 22 00:16:58 2009 -0700

    s4-lsa: added support for QuerySecurity on LSA
    
    This follows the sd pattern from samba3

commit 69cb91a2eb2c3853663a61c2ed8f38e8fdde0964
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Sep 21 21:36:54 2009 -0700

    s4-rpcserver: added shared association groups
    
    This patch allows us to share association groups and their rpc handles
    between connections. This is needed for some DRSUAPI behaviour when
    recent windows clients connect.

commit a30d6130869239a6d6160c50908092e1d1424af5
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Sep 21 19:57:27 2009 -0700

    s4-rpcserver: run all RPC operations in a single task
    
    This will make it much easier to implement shared handles with
    association groups. It also means we can shared the ldb between RPC
    connections.

commit 5d16b9c1bf3476ce24a48bd2796111e7e27c2064
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Sep 21 19:56:36 2009 -0700

    s4-rpc: remove two unused functions

commit 2e98ee0907474990e2929c892f5ead731d7ddb34
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Sep 21 18:15:19 2009 -0700

    s4-ldb: only show the outer level of ldb ops when tracing

commit ec5d01278a6f38f76eb6edfa2e9bfb2fc8eb6fbe
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Sep 21 17:52:21 2009 -0700

    s4-ldb: don't show timestamps on every line of ldb traces
    
    This adds ldb_debug_add() and ldb_debug_end() to format multiline
    messages

-----------------------------------------------------------------------

Summary of changes:
 lib/util/data_blob.c                            |    5 +-
 lib/util/util_ldb.c                             |    5 +-
 source4/dsdb/repl/replicated_objects.c          |    4 +
 source4/dsdb/samdb/ldb_modules/instancetype.c   |    6 +
 source4/dsdb/samdb/ldb_modules/password_hash.c  |    5 +
 source4/dsdb/samdb/ldb_modules/pdc_fsmo.c       |    1 +
 source4/dsdb/samdb/ldb_modules/repl_meta_data.c |    3 +
 source4/dsdb/schema/schema_init.c               |    4 +
 source4/lib/ldb/common/attrib_handlers.c        |    6 +-
 source4/lib/ldb/common/ldb.c                    |  110 ++++++++++------
 source4/lib/ldb/common/ldb_debug.c              |   25 ++++
 source4/lib/ldb/common/ldb_modules.c            |   69 ++++++----
 source4/lib/ldb/include/ldb.h                   |    4 +-
 source4/lib/ldb/include/ldb_module.h            |    2 +
 source4/lib/ldb/include/ldb_private.h           |    3 +
 source4/rpc_server/dcerpc_server.c              |  165 +++++++++++++++--------
 source4/rpc_server/dcerpc_server.h              |   24 +++-
 source4/rpc_server/drsuapi/addentry.c           |    6 +
 source4/rpc_server/drsuapi/dcesrv_drsuapi.h     |    3 +-
 source4/rpc_server/drsuapi/drsutil.c            |   31 ++++-
 source4/rpc_server/drsuapi/getncchanges.c       |    3 +-
 source4/rpc_server/handles.c                    |   38 +++++-
 source4/rpc_server/lsa/dcesrv_lsa.c             |   87 ++++++++++++-
 source4/rpc_server/service_rpc.c                |    9 +-
 source4/torture/rpc/handles.c                   |    5 +
 25 files changed, 468 insertions(+), 155 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/data_blob.c b/lib/util/data_blob.c
index c7d01ba..825d8cf 100644
--- a/lib/util/data_blob.c
+++ b/lib/util/data_blob.c
@@ -163,8 +163,11 @@ _PUBLIC_ char *data_blob_hex_string(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob)
 		return NULL;
 	}
 
+	/* this must be lowercase or w2k8 cannot join a samba domain,
+	   as this routine is used to encode extended DNs and windows
+	   only accepts lowercase hexadecimal numbers */
 	for (i = 0; i < blob->length; i++)
-		slprintf(&hex_string[i*2], 3, "%02X", blob->data[i]);
+		slprintf(&hex_string[i*2], 3, "%02x", blob->data[i]);
 
 	hex_string[(blob->length*2)] = '\0';
 	return hex_string;
diff --git a/lib/util/util_ldb.c b/lib/util/util_ldb.c
index 6aea776..ac1e115 100644
--- a/lib/util/util_ldb.c
+++ b/lib/util/util_ldb.c
@@ -213,8 +213,9 @@ int gendb_search_single_extended_dn(struct ldb_context *ldb,
 	}
 
 	if (res->count > 1) {
-		/* the function is only supposed to return a single
-		   entry */
+		/* the function is only supposed to return a single entry */
+		DEBUG(0,(__location__ ": More than one return for baseDN %s  filter %s\n",
+			 ldb_dn_get_linearized(basedn), filter));
 		talloc_free(tmp_ctx);
 		return LDB_ERR_CONSTRAINT_VIOLATION;
 	}
diff --git a/source4/dsdb/repl/replicated_objects.c b/source4/dsdb/repl/replicated_objects.c
index 5ae622e..5d7ae11 100644
--- a/source4/dsdb/repl/replicated_objects.c
+++ b/source4/dsdb/repl/replicated_objects.c
@@ -441,6 +441,10 @@ WERROR dsdb_origin_objects_commit(struct ldb_context *ldb,
 
 	for (i=0; i < num_objects; i++) {
 		struct dom_sid *sid = NULL;
+
+		DEBUG(6,(__location__ ": adding %s\n", 
+			 ldb_dn_get_linearized(objects[i]->dn)));
+		
 		ret = ldb_add(ldb, objects[i]);
 		if (ret != 0) {
 			goto cancel;
diff --git a/source4/dsdb/samdb/ldb_modules/instancetype.c b/source4/dsdb/samdb/ldb_modules/instancetype.c
index 2e1f1de..de46c0a 100644
--- a/source4/dsdb/samdb/ldb_modules/instancetype.c
+++ b/source4/dsdb/samdb/ldb_modules/instancetype.c
@@ -89,6 +89,12 @@ static int instancetype_add(struct ldb_module *module, struct ldb_request *req)
 		return ldb_next_request(module, req);
 	}
 
+	if (ldb_msg_find_element(req->op.add.message, "instanceType")) {
+		/* TODO: we need to validate and possibly create a new
+		   partition */
+		return ldb_next_request(module, req);		
+	}
+
 	partition_ctrl = ldb_request_get_control(req, DSDB_CONTROL_CURRENT_PARTITION_OID);
 	if (!partition_ctrl) {
 		ldb_debug_set(ldb, LDB_DEBUG_FATAL,
diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c
index a50e5b4..fdb0441 100644
--- a/source4/dsdb/samdb/ldb_modules/password_hash.c
+++ b/source4/dsdb/samdb/ldb_modules/password_hash.c
@@ -1956,20 +1956,25 @@ static int password_hash_modify(struct ldb_module *module, struct ldb_request *r
 	/* check passwords are single valued here */
 	/* TODO: remove this when passwords will be single valued in schema */
 	if (sambaAttr && (sambaAttr->num_values > 1)) {
+		DEBUG(0,(__location__ ": %s\n", ldb_errstring(ldb)));
 		return LDB_ERR_CONSTRAINT_VIOLATION;
 	}
 	if (clearTextAttr && (clearTextAttr->num_values > 1)) {
+		DEBUG(0,(__location__ ": %s\n", ldb_errstring(ldb)));
 		return LDB_ERR_CONSTRAINT_VIOLATION;
 	}
 	if (ntAttr && (ntAttr->num_values > 1)) {
+		DEBUG(0,(__location__ ": %s\n", ldb_errstring(ldb)));
 		return LDB_ERR_CONSTRAINT_VIOLATION;
 	}
 	if (lmAttr && (lmAttr->num_values > 1)) {
+		DEBUG(0,(__location__ ": %s\n", ldb_errstring(ldb)));
 		return LDB_ERR_CONSTRAINT_VIOLATION;
 	}
 
 	ac = ph_init_context(module, req);
 	if (!ac) {
+		DEBUG(0,(__location__ ": %s\n", ldb_errstring(ldb)));
 		return LDB_ERR_OPERATIONS_ERROR;
 	}
 
diff --git a/source4/dsdb/samdb/ldb_modules/pdc_fsmo.c b/source4/dsdb/samdb/ldb_modules/pdc_fsmo.c
index fefaef4..950f87e 100644
--- a/source4/dsdb/samdb/ldb_modules/pdc_fsmo.c
+++ b/source4/dsdb/samdb/ldb_modules/pdc_fsmo.c
@@ -88,6 +88,7 @@ static int pdc_fsmo_init(struct ldb_module *module)
 		ldb_debug_set(ldb, LDB_DEBUG_FATAL,
 			      "pdc_fsmo_init: [%u] domain objects found on a base search",
 			      pdc_res->count);
+		DEBUG(0,(__location__ ": %s\n", ldb_errstring(ldb)));
 		talloc_free(mem_ctx);
 		return LDB_ERR_CONSTRAINT_VIOLATION;
 	}
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
index fa8bd64..39102e5 100644
--- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
+++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
@@ -466,6 +466,7 @@ static int replmd_add(struct ldb_module *module, struct ldb_request *req)
 	if (!schema) {
 		ldb_debug_set(ldb, LDB_DEBUG_FATAL,
 			      "replmd_add: no dsdb_schema loaded");
+		DEBUG(0,(__location__ ": %s\n", ldb_errstring(ldb)));
 		return LDB_ERR_CONSTRAINT_VIOLATION;
 	}
 
@@ -866,6 +867,7 @@ static int replmd_modify(struct ldb_module *module, struct ldb_request *req)
 	if (!schema) {
 		ldb_debug_set(ldb, LDB_DEBUG_FATAL,
 			      "replmd_modify: no dsdb_schema loaded");
+		DEBUG(0,(__location__ ": %s\n", ldb_errstring(ldb)));
 		return LDB_ERR_CONSTRAINT_VIOLATION;
 	}
 
@@ -1940,6 +1942,7 @@ static int replmd_extended_replicated_objects(struct ldb_module *module, struct
 	if (!ar->schema) {
 		ldb_debug_set(ldb, LDB_DEBUG_FATAL, "replmd_ctx_init: no loaded schema found\n");
 		talloc_free(ar);
+		DEBUG(0,(__location__ ": %s\n", ldb_errstring(ldb)));
 		return LDB_ERR_CONSTRAINT_VIOLATION;
 	}
 
diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c
index 8bb54f4..b876ab0 100644
--- a/source4/dsdb/schema/schema_init.c
+++ b/source4/dsdb/schema/schema_init.c
@@ -933,6 +933,7 @@ int dsdb_schema_from_ldb_results(TALLOC_CTX *mem_ctx, struct ldb_context *ldb,
 	if (!prefix_val) {
 		*error_string = talloc_asprintf(mem_ctx, 
 						"schema_fsmo_init: no prefixMap attribute found");
+		DEBUG(0,(__location__ ": %s\n", *error_string));
 		return LDB_ERR_CONSTRAINT_VIOLATION;
 	}
 	info_val = ldb_msg_find_ldb_val(schema_res->msgs[0], "schemaInfo");
@@ -950,6 +951,7 @@ int dsdb_schema_from_ldb_results(TALLOC_CTX *mem_ctx, struct ldb_context *ldb,
 		*error_string = talloc_asprintf(mem_ctx, 
 			      "schema_fsmo_init: failed to load oid mappings: %s",
 			      win_errstr(status));
+		DEBUG(0,(__location__ ": %s\n", *error_string));
 		return LDB_ERR_CONSTRAINT_VIOLATION;
 	}
 
@@ -968,6 +970,7 @@ int dsdb_schema_from_ldb_results(TALLOC_CTX *mem_ctx, struct ldb_context *ldb,
 				      "schema_fsmo_init: failed to load attribute definition: %s:%s",
 				      ldb_dn_get_linearized(attrs_res->msgs[i]->dn),
 				      win_errstr(status));
+			DEBUG(0,(__location__ ": %s\n", *error_string));
 			return LDB_ERR_CONSTRAINT_VIOLATION;
 		}
 
@@ -989,6 +992,7 @@ int dsdb_schema_from_ldb_results(TALLOC_CTX *mem_ctx, struct ldb_context *ldb,
 				      "schema_fsmo_init: failed to load class definition: %s:%s",
 				      ldb_dn_get_linearized(objectclass_res->msgs[i]->dn),
 				      win_errstr(status));
+			DEBUG(0,(__location__ ": %s\n", *error_string));
 			return LDB_ERR_CONSTRAINT_VIOLATION;
 		}
 
diff --git a/source4/lib/ldb/common/attrib_handlers.c b/source4/lib/ldb/common/attrib_handlers.c
index 53795fd..ba21fca 100644
--- a/source4/lib/ldb/common/attrib_handlers.c
+++ b/source4/lib/ldb/common/attrib_handlers.c
@@ -287,7 +287,7 @@ static int ldb_canonicalise_dn(struct ldb_context *ldb, void *mem_ctx,
 	out->length = 0;
 	out->data = NULL;
 
-	dn = ldb_dn_from_ldb_val(ldb, mem_ctx, in);
+	dn = ldb_dn_from_ldb_val(mem_ctx, ldb, in);
 	if ( ! ldb_dn_validate(dn)) {
 		return LDB_ERR_INVALID_DN_SYNTAX;
 	}
@@ -315,10 +315,10 @@ static int ldb_comparison_dn(struct ldb_context *ldb, void *mem_ctx,
 	struct ldb_dn *dn1 = NULL, *dn2 = NULL;
 	int ret;
 
-	dn1 = ldb_dn_from_ldb_val(ldb, mem_ctx, v1);
+	dn1 = ldb_dn_from_ldb_val(mem_ctx, ldb, v1);
 	if ( ! ldb_dn_validate(dn1)) return -1;
 
-	dn2 = ldb_dn_from_ldb_val(ldb, mem_ctx, v2);
+	dn2 = ldb_dn_from_ldb_val(mem_ctx, ldb, v2);
 	if ( ! ldb_dn_validate(dn2)) {
 		talloc_free(dn1);
 		return -1;
diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c
index 02298c1..e9c9245 100644
--- a/source4/lib/ldb/common/ldb.c
+++ b/source4/lib/ldb/common/ldb.c
@@ -257,6 +257,9 @@ void ldb_set_errstring(struct ldb_context *ldb, const char *err_string)
 		talloc_free(ldb->err_string);
 	}
 	ldb->err_string = talloc_strdup(ldb, err_string);
+	if (ldb->flags & LDB_FLG_ENABLE_TRACING) {
+		ldb_debug(ldb, LDB_DEBUG_TRACE, "ldb_set_errstring: %s", ldb->err_string);
+	}
 }
 
 void ldb_asprintf_errstring(struct ldb_context *ldb, const char *format, ...)
@@ -633,78 +636,83 @@ static void ldb_trace_request(struct ldb_context *ldb, struct ldb_request *req)
 
 	switch (req->operation) {
 	case LDB_SEARCH:
-		ldb_debug(ldb, LDB_DEBUG_TRACE, "ldb_trace_request: SEARCH");
-		ldb_debug(ldb, LDB_DEBUG_TRACE, " dn: %s",
-			  ldb_dn_get_linearized(req->op.search.base));
-		ldb_debug(ldb, LDB_DEBUG_TRACE, " scope: %s", 
+		ldb_debug_add(ldb, "ldb_trace_request: SEARCH\n");
+		ldb_debug_add(ldb, " dn: %s\n",
+			      ldb_dn_is_null(req->op.search.base)?"<rootDSE>":
+			      ldb_dn_get_linearized(req->op.search.base));
+		ldb_debug_add(ldb, " scope: %s\n", 
 			  req->op.search.scope==LDB_SCOPE_BASE?"base":
 			  req->op.search.scope==LDB_SCOPE_ONELEVEL?"one":
 			  req->op.search.scope==LDB_SCOPE_SUBTREE?"sub":"UNKNOWN");
-		ldb_debug(ldb, LDB_DEBUG_TRACE, " expr: %s", 
+		ldb_debug_add(ldb, " expr: %s\n", 
 			  ldb_filter_from_tree(tmp_ctx, req->op.search.tree));
 		if (req->op.search.attrs == NULL) {
-			ldb_debug(ldb, LDB_DEBUG_TRACE, " attr: <ALL>");
+			ldb_debug_add(ldb, " attr: <ALL>\n");
 		} else {
 			for (i=0; req->op.search.attrs[i]; i++) {
-				ldb_debug(ldb, LDB_DEBUG_TRACE, " attr: %s", req->op.search.attrs[i]);
+				ldb_debug_add(ldb, " attr: %s\n", req->op.search.attrs[i]);
 			}
 		}
 		break;
 	case LDB_DELETE:
-		ldb_debug(ldb, LDB_DEBUG_TRACE, "ldb_trace_request: DELETE");
-		ldb_debug(ldb, LDB_DEBUG_TRACE, " dn: %s", 
-			  ldb_dn_get_linearized(req->op.del.dn));
+		ldb_debug_add(ldb, "ldb_trace_request: DELETE\n");
+		ldb_debug_add(ldb, " dn: %s\n", 
+			      ldb_dn_get_linearized(req->op.del.dn));
 		break;
 	case LDB_RENAME:
-		ldb_debug(ldb, LDB_DEBUG_TRACE, "ldb_trace_request: RENAME");
-		ldb_debug(ldb, LDB_DEBUG_TRACE, " olddn: %s", 
-			  ldb_dn_get_linearized(req->op.rename.olddn));
-		ldb_debug(ldb, LDB_DEBUG_TRACE, " newdn: %s", 
-			  ldb_dn_get_linearized(req->op.rename.newdn));
+		ldb_debug_add(ldb, "ldb_trace_request: RENAME\n");
+		ldb_debug_add(ldb, " olddn: %s\n", 
+			      ldb_dn_get_linearized(req->op.rename.olddn));
+		ldb_debug_add(ldb, " newdn: %s\n", 
+			      ldb_dn_get_linearized(req->op.rename.newdn));
 		break;
 	case LDB_EXTENDED:
-		ldb_debug(ldb, LDB_DEBUG_TRACE, "ldb_trace_request: EXTENDED");
-		ldb_debug(ldb, LDB_DEBUG_TRACE, " oid: %s", req->op.extended.oid);
-		ldb_debug(ldb, LDB_DEBUG_TRACE, " data: %s", req->op.extended.data?"yes":"no");
+		ldb_debug_add(ldb, "ldb_trace_request: EXTENDED\n");
+		ldb_debug_add(ldb, " oid: %s\n", req->op.extended.oid);
+		ldb_debug_add(ldb, " data: %s\n", req->op.extended.data?"yes":"no");
 		break;
 	case LDB_ADD:
-		ldb_debug(ldb, LDB_DEBUG_TRACE, "ldb_trace_request: ADD");
-		ldb_debug(req->handle->ldb, LDB_DEBUG_TRACE, "%s", 
-			  ldb_ldif_message_string(req->handle->ldb, tmp_ctx, 
-						  LDB_CHANGETYPE_ADD, req->op.add.message));
+		ldb_debug_add(ldb, "ldb_trace_request: ADD\n");
+		ldb_debug_add(req->handle->ldb, "%s\n", 
+			      ldb_ldif_message_string(req->handle->ldb, tmp_ctx, 
+						      LDB_CHANGETYPE_ADD, 
+						      req->op.add.message));
 		break;
 	case LDB_MODIFY:
-		ldb_debug(ldb, LDB_DEBUG_TRACE, "ldb_trace_request: MODIFY");
-		ldb_debug(req->handle->ldb, LDB_DEBUG_TRACE, "%s", 
-			  ldb_ldif_message_string(req->handle->ldb, tmp_ctx, 
-						  LDB_CHANGETYPE_ADD, req->op.mod.message));
+		ldb_debug_add(ldb, "ldb_trace_request: MODIFY\n");
+		ldb_debug_add(req->handle->ldb, "%s\n", 
+			      ldb_ldif_message_string(req->handle->ldb, tmp_ctx, 
+						      LDB_CHANGETYPE_ADD, 
+						      req->op.mod.message));
 		break;
 	case LDB_REQ_REGISTER_CONTROL:
-		ldb_debug(ldb, LDB_DEBUG_TRACE, "ldb_trace_request: REGISTER_CONTROL");
-		ldb_debug(req->handle->ldb, LDB_DEBUG_TRACE, "%s", 
-			  req->op.reg_control.oid);
+		ldb_debug_add(ldb, "ldb_trace_request: REGISTER_CONTROL\n");
+		ldb_debug_add(req->handle->ldb, "%s\n", 
+			      req->op.reg_control.oid);
 		break;
 	case LDB_REQ_REGISTER_PARTITION:
-		ldb_debug(ldb, LDB_DEBUG_TRACE, "ldb_trace_request: REGISTER_PARTITION");
-		ldb_debug(req->handle->ldb, LDB_DEBUG_TRACE, "%s", 
-			  ldb_dn_get_linearized(req->op.reg_partition.dn));
+		ldb_debug_add(ldb, "ldb_trace_request: REGISTER_PARTITION\n");
+		ldb_debug_add(req->handle->ldb, "%s\n", 
+			      ldb_dn_get_linearized(req->op.reg_partition.dn));
 		break;
 	default:
-		ldb_debug(ldb, LDB_DEBUG_TRACE, "ldb_trace_request: UNKNOWN(%u)", 
-			  req->operation);
+		ldb_debug_add(ldb, "ldb_trace_request: UNKNOWN(%u)\n", 
+			      req->operation);
 		break;
 	}
 
 	if (req->controls == NULL) {
-		ldb_debug(ldb, LDB_DEBUG_TRACE, " control: <NONE>");
+		ldb_debug_add(ldb, " control: <NONE>\n");
 	} else {
 		for (i=0; req->controls && req->controls[i]; i++) {
-			ldb_debug(ldb, LDB_DEBUG_TRACE, " control: %s  crit:%u  data:%s", 
-				  req->controls[i]->oid, 
-				  req->controls[i]->critical, 
-				  req->controls[i]->data?"yes":"no");
+			ldb_debug_add(ldb, " control: %s  crit:%u  data:%s\n", 
+				      req->controls[i]->oid, 
+				      req->controls[i]->critical, 
+				      req->controls[i]->data?"yes":"no");
 		}
 	}
+	
+	ldb_debug_end(ldb, LDB_DEBUG_TRACE);
 
 	talloc_free(tmp_ctx);
 }
@@ -917,6 +925,10 @@ int ldb_build_search_req_ex(struct ldb_request **ret_req,
 		return LDB_ERR_OPERATIONS_ERROR;
 	}
 
+	if (parent) {
+		req->handle->nesting++;
+	}
+
 	*ret_req = req;
 	return LDB_SUCCESS;
 }
@@ -984,6 +996,10 @@ int ldb_build_add_req(struct ldb_request **ret_req,
 		return LDB_ERR_OPERATIONS_ERROR;
 	}
 
+	if (parent) {
+		req->handle->nesting++;
+	}
+
 	*ret_req = req;
 
 	return LDB_SUCCESS;
@@ -1022,6 +1038,10 @@ int ldb_build_mod_req(struct ldb_request **ret_req,
 		return LDB_ERR_OPERATIONS_ERROR;
 	}
 
+	if (parent) {
+		req->handle->nesting++;
+	}
+
 	*ret_req = req;
 
 	return LDB_SUCCESS;
@@ -1060,6 +1080,10 @@ int ldb_build_del_req(struct ldb_request **ret_req,
 		return LDB_ERR_OPERATIONS_ERROR;
 	}
 
+	if (parent) {
+		req->handle->nesting++;
+	}
+
 	*ret_req = req;
 
 	return LDB_SUCCESS;
@@ -1100,6 +1124,10 @@ int ldb_build_rename_req(struct ldb_request **ret_req,
 		return LDB_ERR_OPERATIONS_ERROR;
 	}
 
+	if (parent) {
+		req->handle->nesting++;
+	}
+
 	*ret_req = req;
 
 	return LDB_SUCCESS;
@@ -1169,6 +1197,10 @@ int ldb_build_extended_req(struct ldb_request **ret_req,
 		return LDB_ERR_OPERATIONS_ERROR;
 	}
 
+	if (parent) {
+		req->handle->nesting++;
+	}
+
 	*ret_req = req;
 
 	return LDB_SUCCESS;
diff --git a/source4/lib/ldb/common/ldb_debug.c b/source4/lib/ldb/common/ldb_debug.c
index 4612b01..6aa58cc 100644
--- a/source4/lib/ldb/common/ldb_debug.c
+++ b/source4/lib/ldb/common/ldb_debug.c
@@ -96,6 +96,31 @@ void ldb_debug(struct ldb_context *ldb, enum ldb_debug_level level, const char *
 	va_end(ap);
 }
 
+/*
+  add to an accumulated log message
+ */
+void ldb_debug_add(struct ldb_context *ldb, const char *fmt, ...)
+{
+	va_list ap;
+	va_start(ap, fmt);
+	if (ldb->partial_debug == NULL) {
+		ldb->partial_debug = talloc_vasprintf(ldb, fmt, ap);
+	} else {
+		ldb->partial_debug = talloc_vasprintf_append(ldb->partial_debug, 
+							     fmt, ap);
+	}
+	va_end(ap);
+}
+
+/*
+  send the accumulated log message, and free it
+ */
+void ldb_debug_end(struct ldb_context *ldb, enum ldb_debug_level level)
+{
+	ldb_debug(ldb, level, "%s", ldb->partial_debug);
+	talloc_free(ldb->partial_debug);
+	ldb->partial_debug = NULL;
+}
 
 /*
   log a message, and set the ldb error string to the same message
diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c
index c57d0e4..ea29a09 100644
--- a/source4/lib/ldb/common/ldb_modules.c
+++ b/source4/lib/ldb/common/ldb_modules.c
@@ -1,4 +1,4 @@
-/* 
+/*
    ldb database library
 
    Copyright (C) Simo Sorce  2004-2008
@@ -6,7 +6,7 @@
      ** NOTE! The following LGPL license applies to the ldb
      ** library. This does NOT imply that all of Samba is released
      ** under the LGPL
-   
+
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
@@ -127,7 +127,7 @@ static struct backends_list_entry {
 
 static struct ops_list_entry {
 	const struct ldb_module_ops *ops;
-	struct ops_list_entry *next;	
+	struct ops_list_entry *next;
 } *registered_modules = NULL;
 
 static const struct ldb_builtins {
@@ -264,9 +264,9 @@ static const struct ldb_module_ops *ldb_find_module_ops(const char *name)
 		if (strcmp(builtins[i].module_ops->name, name) == 0)
 			return builtins[i].module_ops;
 	}
- 
+
 	for (e = registered_modules; e; e = e->next) {
- 		if (strcmp(e->ops->name, name) == 0) 
+ 		if (strcmp(e->ops->name, name) == 0)
 			return e->ops;
 	}
 
@@ -301,7 +301,7 @@ static void *ldb_dso_load_symbol(struct ldb_context *ldb, const char *name,
 	if (ldb->modules_dir == NULL)
 		return NULL;
 
-	path = talloc_asprintf(ldb, "%s/%s.%s", ldb->modules_dir, name, 
+	path = talloc_asprintf(ldb, "%s/%s.%s", ldb->modules_dir, name,
 			       SHLIBEXT);
 
 	ldb_debug(ldb, LDB_DEBUG_TRACE, "trying to load %s from %s", name, path);
@@ -328,7 +328,7 @@ int ldb_load_modules_list(struct ldb_context *ldb, const char **module_list, str
 {
 	struct ldb_module *module;
 	int i;
-	
+
 	module = backend;
 
 	for (i = 0; module_list[i] != NULL; i++) {
@@ -338,10 +338,10 @@ int ldb_load_modules_list(struct ldb_context *ldb, const char **module_list, str
 		if (strcmp(module_list[i], "") == 0) {
 			continue;
 		}
-		
+


-- 
Samba Shared Repository


More information about the samba-cvs mailing list