From bb3bdb3a62b3b895b9e0c013483a6356ecd7a3aa Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 22 Sep 2009 14:26:59 -0700 Subject: [PATCH] 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 --- lib/util/util_ldb.c | 5 +++-- source4/dsdb/repl/replicated_objects.c | 4 ++++ 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/rpc_server/drsuapi/addentry.c | 6 ++++++ 7 files changed, 26 insertions(+), 2 deletions(-) diff --git a/lib/util/util_ldb.c b/lib/util/util_ldb.c index 6aea77691bc..ac1e11566e8 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 5ae622eeaad..5d7ae11a57b 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/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c index a50e5b4a66d..fdb044198be 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 fefaef47551..950f87eb748 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 fa8bd64bf28..39102e5bbe9 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 8bb54f47f4e..b876ab09fc9 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/rpc_server/drsuapi/addentry.c b/source4/rpc_server/drsuapi/addentry.c index 74de772f7ac..c7c95821ab4 100644 --- a/source4/rpc_server/drsuapi/addentry.c +++ b/source4/rpc_server/drsuapi/addentry.c @@ -57,6 +57,9 @@ static WERROR drsuapi_add_SPNs(struct drsuapi_bind_state *b_state, const char *ntds_guid_str; const char *dom_string; + DEBUG(6,(__location__ ": Adding SPNs for %s\n", + ldb_dn_get_linearized(dn))); + ret = ldb_search(b_state->sam_ctx, mem_ctx, &res, dn, LDB_SCOPE_BASE, attrs, "(objectClass=ntDSDSA)"); @@ -72,6 +75,9 @@ static WERROR drsuapi_add_SPNs(struct drsuapi_bind_state *b_state, continue; } + DEBUG(6,(__location__ ": serverReference %s\n", + ldb_dn_get_linearized(ref_dn))); + ntds_guid = samdb_result_guid(res->msgs[0], "objectGUID"); ntds_guid_str = GUID_string(res, &ntds_guid); -- 2.11.4.GIT