The Samba-Bugzilla – Attachment 7765 Details for
Bug 8827
Increasing memory consumption of samba drepl and rpc server
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
My proposed fix (currently under test)
drepl-memory.patch (text/plain), 22.96 KB, created by
Andrew Bartlett
on 2012-08-14 06:35:33 UTC
(
hide
)
Description:
My proposed fix (currently under test)
Filename:
MIME Type:
Creator:
Andrew Bartlett
Created:
2012-08-14 06:35:33 UTC
Size:
22.96 KB
patch
obsolete
>From 545ace77aec87ce86d8444f7f4c835d222152220 Mon Sep 17 00:00:00 2001 >From: Andrew Bartlett <abartlet@samba.org> >Date: Tue, 14 Aug 2012 15:54:26 +1000 >Subject: [PATCH 1/5] s4-dsdb: Add const > >--- > source4/dsdb/common/util.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > >diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c >index e320a41..dca7a44 100644 >--- a/source4/dsdb/common/util.c >+++ b/source4/dsdb/common/util.c >@@ -2255,14 +2255,14 @@ struct ldb_dn *samdb_dns_domain_to_dn(struct ldb_context *ldb, TALLOC_CTX *mem_c > unsigned int i; > TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx); > const char *binary_encoded; >- const char **split_realm; >+ const char * const *split_realm; > struct ldb_dn *dn; > > if (!tmp_ctx) { > return NULL; > } > >- split_realm = (const char **)str_list_make(tmp_ctx, dns_domain, "."); >+ split_realm = (const char * const *)str_list_make(tmp_ctx, dns_domain, "."); > if (!split_realm) { > talloc_free(tmp_ctx); > return NULL; >@@ -3039,11 +3039,11 @@ const char *samdb_cn_to_lDAPDisplayName(TALLOC_CTX *mem_ctx, const char *cn) > > /* "tolower()" and "toupper()" should also work properly on 0x00 */ > tokens[0][0] = tolower(tokens[0][0]); >- for (i = 1; i < str_list_length((const char **)tokens); i++) >+ for (i = 1; i < str_list_length((const char * const *)tokens); i++) > tokens[i][0] = toupper(tokens[i][0]); > > ret = talloc_strdup(mem_ctx, tokens[0]); >- for (i = 1; i < str_list_length((const char **)tokens); i++) >+ for (i = 1; i < str_list_length((const char * const *)tokens); i++) > ret = talloc_asprintf_append_buffer(ret, "%s", tokens[i]); > > talloc_free(tokens); >-- >1.7.11.2 > > >From 56098e5ea77841471416e1e684491cb4f473134b Mon Sep 17 00:00:00 2001 >From: Andrew Bartlett <abartlet@samba.org> >Date: Tue, 14 Aug 2012 15:56:04 +1000 >Subject: [PATCH 2/5] s4-dsdb: Improve memory handling in > kccsrv_find_connections() by adding a tmp_ctx > >--- > source4/dsdb/kcc/kcc_connection.c | 19 +++++++++++++++---- > 1 file changed, 15 insertions(+), 4 deletions(-) > >diff --git a/source4/dsdb/kcc/kcc_connection.c b/source4/dsdb/kcc/kcc_connection.c >index 1c4ebb1..a5894c1 100644 >--- a/source4/dsdb/kcc/kcc_connection.c >+++ b/source4/dsdb/kcc/kcc_connection.c >@@ -184,32 +184,41 @@ struct kcc_connection_list *kccsrv_find_connections(struct kccsrv_service *s, > struct ldb_result *res; > const char *attrs[] = { "objectGUID", "fromServer", NULL }; > struct kcc_connection_list *list; >- >+ TALLOC_CTX *tmp_ctx; > kcctpl_test(s); > >+ tmp_ctx = talloc_new(mem_ctx); >+ if (!tmp_ctx) { >+ DEBUG(0, ("failed to talloc\n")); >+ return NULL; >+ } >+ > base_dn = samdb_ntds_settings_dn(s->samdb); > if (!base_dn) { > DEBUG(0, ("failed to find our own NTDS settings DN\n")); >+ talloc_free(tmp_ctx); > return NULL; > } > >- ret = ldb_search(s->samdb, mem_ctx, &res, base_dn, LDB_SCOPE_ONELEVEL, >+ ret = ldb_search(s->samdb, tmp_ctx, &res, base_dn, LDB_SCOPE_ONELEVEL, > attrs, "objectClass=nTDSConnection"); > if (ret != LDB_SUCCESS) { > DEBUG(0, ("failed nTDSConnection search: %s\n", > ldb_strerror(ret))); >+ talloc_free(tmp_ctx); > return NULL; > } > >- list = talloc(mem_ctx, struct kcc_connection_list); >+ list = talloc(tmp_ctx, struct kcc_connection_list); > if (!list) { > DEBUG(0, ("out of memory")); > return NULL; > } >- list->servers = talloc_array(mem_ctx, struct kcc_connection, >+ list->servers = talloc_array(list, struct kcc_connection, > res->count); > if (!list->servers) { > DEBUG(0, ("out of memory")); >+ talloc_free(tmp_ctx); > return NULL; > } > list->count = 0; >@@ -233,5 +242,7 @@ struct kcc_connection_list *kccsrv_find_connections(struct kccsrv_service *s, > list->count++; > } > DEBUG(4, ("found %d existing nTDSConnection objects\n", list->count)); >+ talloc_steal(mem_ctx, list); >+ talloc_free(tmp_ctx); > return list; > } >-- >1.7.11.2 > > >From d1a83e6011418ab09b0d5250d0b90a47a831f364 Mon Sep 17 00:00:00 2001 >From: Andrew Bartlett <abartlet@samba.org> >Date: Tue, 14 Aug 2012 15:58:59 +1000 >Subject: [PATCH 3/5] s4-dsdb: Improve memory handling in > kccsrv_add_connection() > >--- > source4/dsdb/kcc/kcc_connection.c | 5 +++++ > 1 file changed, 5 insertions(+) > >diff --git a/source4/dsdb/kcc/kcc_connection.c b/source4/dsdb/kcc/kcc_connection.c >index a5894c1..266f753 100644 >--- a/source4/dsdb/kcc/kcc_connection.c >+++ b/source4/dsdb/kcc/kcc_connection.c >@@ -46,6 +46,11 @@ static int kccsrv_add_connection(struct kccsrv_service *s, > bool ok; > > tmp_ctx = talloc_new(s); >+ if (!tmp_ctx) { >+ DEBUG(0, ("failed to talloc\n")); >+ ret = LDB_ERR_OPERATIONS_ERROR; >+ goto done; >+ } > new_dn = samdb_ntds_settings_dn(s->samdb); > if (!new_dn) { > DEBUG(0, ("failed to find NTDS settings\n")); >-- >1.7.11.2 > > >From 857e7a818213936de225c538f04c63d2c0c1cedc Mon Sep 17 00:00:00 2001 >From: Andrew Bartlett <abartlet@samba.org> >Date: Tue, 14 Aug 2012 16:05:53 +1000 >Subject: [PATCH 4/5] s4-dsdb: Improve memory handling in > dsdb_schema_from_ldb_results() by adding a tmp_ctx > >--- > source4/dsdb/schema/schema_init.c | 16 ++++++++++++++-- > 1 file changed, 14 insertions(+), 2 deletions(-) > >diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c >index c0318cf..1771b26 100644 >--- a/source4/dsdb/schema/schema_init.c >+++ b/source4/dsdb/schema/schema_init.c >@@ -843,9 +843,16 @@ int dsdb_schema_from_ldb_results(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, > struct loadparm_context *lp_ctx = NULL; > int ret; > >- schema = dsdb_new_schema(mem_ctx); >+ TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx); >+ if (!tmp_ctx) { >+ dsdb_oom(error_string, mem_ctx); >+ return ldb_operr(ldb); >+ } >+ >+ schema = dsdb_new_schema(tmp_ctx); > if (!schema) { > dsdb_oom(error_string, mem_ctx); >+ talloc_free(tmp_ctx); > return ldb_operr(ldb); > } > >@@ -856,6 +863,7 @@ int dsdb_schema_from_ldb_results(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, > *error_string = talloc_asprintf(mem_ctx, > "schema_fsmo_init: no prefixMap attribute found"); > DEBUG(0,(__location__ ": %s\n", *error_string)); >+ talloc_free(tmp_ctx); > return LDB_ERR_CONSTRAINT_VIOLATION; > } > info_val = ldb_msg_find_ldb_val(schema_res->msgs[0], "schemaInfo"); >@@ -866,6 +874,7 @@ int dsdb_schema_from_ldb_results(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, > "schema_fsmo_init: dsdb_schema_info_blob_new() failed - %s", > win_errstr(status)); > DEBUG(0,(__location__ ": %s\n", *error_string)); >+ talloc_free(tmp_ctx); > return ldb_operr(ldb); > } > info_val = &info_val_default; >@@ -877,11 +886,13 @@ int dsdb_schema_from_ldb_results(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, > "schema_fsmo_init: failed to load oid mappings: %s", > win_errstr(status)); > DEBUG(0,(__location__ ": %s\n", *error_string)); >+ talloc_free(tmp_ctx); > return LDB_ERR_CONSTRAINT_VIOLATION; > } > > ret = dsdb_load_ldb_results_into_schema(mem_ctx, ldb, schema, attrs_class_res, error_string); > if (ret != LDB_SUCCESS) { >+ talloc_free(tmp_ctx); > return ret; > } > >@@ -907,6 +918,7 @@ int dsdb_schema_from_ldb_results(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, > (schema->fsmo.we_are_master?"yes":"no"), > (schema->fsmo.update_allowed?"yes":"no"))); > >- *schema_out = schema; >+ *schema_out = talloc_steal(mem_ctx, schema); >+ talloc_free(tmp_ctx); > return LDB_SUCCESS; > } >-- >1.7.11.2 > > >From 9c50229f12b8b9bbcfdcfa112403ff05766ec69d Mon Sep 17 00:00:00 2001 >From: Andrew Bartlett <abartlet@samba.org> >Date: Tue, 14 Aug 2012 16:08:47 +1000 >Subject: [PATCH 5/5] s4-dsdb: Add mem_ctx argument to samdb_ntds_settings_dn > >As this value is calculated new each time, we need to give it a context to live on. > >If the value is the forced value during provision, a reference is taken. > >This was responsible for the memory leak in the replication process. In the >example I was given, this DN appeared in memory 13596 times! > >Andrew Bartlett >--- > source4/dsdb/common/util.c | 28 ++++++++++++++++++---------- > source4/dsdb/kcc/kcc_connection.c | 4 ++-- > source4/dsdb/kcc/kcc_periodic.c | 2 +- > source4/dsdb/kcc/kcc_topology.c | 2 +- > source4/dsdb/repl/drepl_fsmo.c | 8 +++++++- > source4/dsdb/repl/drepl_partitions.c | 2 +- > source4/dsdb/repl/drepl_ridalloc.c | 4 ++-- > source4/dsdb/samdb/ldb_modules/objectclass.c | 2 +- > source4/dsdb/samdb/ldb_modules/ridalloc.c | 4 ++-- > source4/dsdb/samdb/ldb_modules/rootdse.c | 4 ++-- > source4/dsdb/samdb/ldb_modules/util.c | 7 ++++--- > source4/dsdb/schema/schema_init.c | 2 +- > source4/rpc_server/drsuapi/dcesrv_drsuapi.c | 2 +- > source4/rpc_server/drsuapi/getncchanges.c | 4 ++-- > 14 files changed, 45 insertions(+), 30 deletions(-) > >diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c >index dca7a44..251e177 100644 >--- a/source4/dsdb/common/util.c >+++ b/source4/dsdb/common/util.c >@@ -1241,7 +1241,7 @@ failed: > /* > work out the ntds settings dn for the current open ldb > */ >-struct ldb_dn *samdb_ntds_settings_dn(struct ldb_context *ldb) >+struct ldb_dn *samdb_ntds_settings_dn(struct ldb_context *ldb, TALLOC_CTX *mem_ctx) > { > TALLOC_CTX *tmp_ctx; > const char *root_attrs[] = { "dsServiceName", NULL }; >@@ -1252,10 +1252,10 @@ struct ldb_dn *samdb_ntds_settings_dn(struct ldb_context *ldb) > /* see if we have a cached copy */ > settings_dn = (struct ldb_dn *)ldb_get_opaque(ldb, "forced.ntds_settings_dn"); > if (settings_dn) { >- return settings_dn; >+ return talloc_reference(mem_ctx, settings_dn); > } > >- tmp_ctx = talloc_new(ldb); >+ tmp_ctx = talloc_new(mem_ctx); > if (tmp_ctx == NULL) { > goto failed; > } >@@ -1277,7 +1277,7 @@ struct ldb_dn *samdb_ntds_settings_dn(struct ldb_context *ldb) > * we could not handle server renames at runtime. Only > * provision sets up forced.ntds_settings_dn */ > >- talloc_steal(ldb, settings_dn); >+ talloc_steal(mem_ctx, settings_dn); > talloc_free(tmp_ctx); > > return settings_dn; >@@ -1310,7 +1310,7 @@ const struct GUID *samdb_ntds_invocation_id(struct ldb_context *ldb) > goto failed; > } > >- ret = ldb_search(ldb, tmp_ctx, &res, samdb_ntds_settings_dn(ldb), LDB_SCOPE_BASE, attrs, NULL); >+ ret = ldb_search(ldb, tmp_ctx, &res, samdb_ntds_settings_dn(ldb, tmp_ctx), LDB_SCOPE_BASE, attrs, NULL); > if (ret) { > goto failed; > } >@@ -1403,7 +1403,7 @@ const struct GUID *samdb_ntds_objectGUID(struct ldb_context *ldb) > goto failed; > } > >- ret = ldb_search(ldb, tmp_ctx, &res, samdb_ntds_settings_dn(ldb), LDB_SCOPE_BASE, attrs, NULL); >+ ret = ldb_search(ldb, tmp_ctx, &res, samdb_ntds_settings_dn(ldb, tmp_ctx), LDB_SCOPE_BASE, attrs, NULL); > if (ret) { > goto failed; > } >@@ -1478,7 +1478,15 @@ failed: > */ > struct ldb_dn *samdb_server_dn(struct ldb_context *ldb, TALLOC_CTX *mem_ctx) > { >- return ldb_dn_get_parent(mem_ctx, samdb_ntds_settings_dn(ldb)); >+ TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx); >+ struct ldb_dn *dn; >+ if (!tmp_ctx) { >+ return NULL; >+ } >+ dn = ldb_dn_get_parent(mem_ctx, samdb_ntds_settings_dn(ldb, tmp_ctx)); >+ talloc_free(tmp_ctx); >+ return dn; >+ > } > > /* >@@ -1798,7 +1806,7 @@ bool samdb_is_pdc(struct ldb_context *ldb) > goto failed; > } > >- if (ldb_dn_compare(samdb_ntds_settings_dn(ldb), pdc) == 0) { >+ if (ldb_dn_compare(samdb_ntds_settings_dn(ldb, tmp_ctx), pdc) == 0) { > is_pdc = true; > } else { > is_pdc = false; >@@ -2981,7 +2989,7 @@ int samdb_ntds_options(struct ldb_context *ldb, uint32_t *options) > goto failed; > } > >- ret = ldb_search(ldb, tmp_ctx, &res, samdb_ntds_settings_dn(ldb), LDB_SCOPE_BASE, attrs, NULL); >+ ret = ldb_search(ldb, tmp_ctx, &res, samdb_ntds_settings_dn(ldb, tmp_ctx), LDB_SCOPE_BASE, attrs, NULL); > if (ret != LDB_SUCCESS) { > goto failed; > } >@@ -3008,7 +3016,7 @@ const char* samdb_ntds_object_category(TALLOC_CTX *tmp_ctx, struct ldb_context * > int ret; > struct ldb_result *res; > >- ret = ldb_search(ldb, tmp_ctx, &res, samdb_ntds_settings_dn(ldb), LDB_SCOPE_BASE, attrs, NULL); >+ ret = ldb_search(ldb, tmp_ctx, &res, samdb_ntds_settings_dn(ldb, tmp_ctx), LDB_SCOPE_BASE, attrs, NULL); > if (ret != LDB_SUCCESS) { > goto failed; > } >diff --git a/source4/dsdb/kcc/kcc_connection.c b/source4/dsdb/kcc/kcc_connection.c >index 266f753..ea63833 100644 >--- a/source4/dsdb/kcc/kcc_connection.c >+++ b/source4/dsdb/kcc/kcc_connection.c >@@ -51,7 +51,7 @@ static int kccsrv_add_connection(struct kccsrv_service *s, > ret = LDB_ERR_OPERATIONS_ERROR; > goto done; > } >- new_dn = samdb_ntds_settings_dn(s->samdb); >+ new_dn = samdb_ntds_settings_dn(s->samdb, tmp_ctx); > if (!new_dn) { > DEBUG(0, ("failed to find NTDS settings\n")); > ret = LDB_ERR_OPERATIONS_ERROR; >@@ -198,7 +198,7 @@ struct kcc_connection_list *kccsrv_find_connections(struct kccsrv_service *s, > return NULL; > } > >- base_dn = samdb_ntds_settings_dn(s->samdb); >+ base_dn = samdb_ntds_settings_dn(s->samdb, tmp_ctx); > if (!base_dn) { > DEBUG(0, ("failed to find our own NTDS settings DN\n")); > talloc_free(tmp_ctx); >diff --git a/source4/dsdb/kcc/kcc_periodic.c b/source4/dsdb/kcc/kcc_periodic.c >index e379230..f96347f 100644 >--- a/source4/dsdb/kcc/kcc_periodic.c >+++ b/source4/dsdb/kcc/kcc_periodic.c >@@ -392,7 +392,7 @@ static int kccsrv_gc_update(struct kccsrv_service *s, struct ldb_result *res) > } > > /* get a list of what NCs we are already replicating */ >- ret = dsdb_search_dn(s->samdb, tmp_ctx, &res2, samdb_ntds_settings_dn(s->samdb), attrs2, 0); >+ ret = dsdb_search_dn(s->samdb, tmp_ctx, &res2, samdb_ntds_settings_dn(s->samdb, tmp_ctx), attrs2, 0); > if (ret != LDB_SUCCESS) { > DEBUG(1,("Failed to get our NC list attributes for GC update - %s\n", ldb_errstring(s->samdb))); > talloc_free(tmp_ctx); >diff --git a/source4/dsdb/kcc/kcc_topology.c b/source4/dsdb/kcc/kcc_topology.c >index 9697ec1..2a9f2dd 100644 >--- a/source4/dsdb/kcc/kcc_topology.c >+++ b/source4/dsdb/kcc/kcc_topology.c >@@ -1007,7 +1007,7 @@ static NTSTATUS kcctpl_bridgehead_dc_failed(struct ldb_context *ldb, > tmp_ctx = talloc_new(ldb); > NT_STATUS_HAVE_NO_MEMORY(tmp_ctx); > >- settings_dn = samdb_ntds_settings_dn(ldb); >+ settings_dn = samdb_ntds_settings_dn(ldb, tmp_ctx); > if (!settings_dn) { > DEBUG(1, (__location__ ": failed to find our own NTDS Settings " > "DN\n")); >diff --git a/source4/dsdb/repl/drepl_fsmo.c b/source4/dsdb/repl/drepl_fsmo.c >index db63853..4a1d08a 100644 >--- a/source4/dsdb/repl/drepl_fsmo.c >+++ b/source4/dsdb/repl/drepl_fsmo.c >@@ -77,8 +77,9 @@ NTSTATUS drepl_take_FSMO_role(struct irpc_message *msg, > enum drepl_role_master role = r->in.role; > struct fsmo_role_state *fsmo; > >- ntds_dn = samdb_ntds_settings_dn(service->samdb); >+ ntds_dn = samdb_ntds_settings_dn(service->samdb, tmp_ctx); > if (!ntds_dn) { >+ talloc_free(tmp_ctx); > r->out.result = WERR_DS_DRA_INTERNAL_ERROR; > return NT_STATUS_OK; > } >@@ -86,6 +87,7 @@ NTSTATUS drepl_take_FSMO_role(struct irpc_message *msg, > werr = dsdb_get_fsmo_role_info(tmp_ctx, service->samdb, role, > &fsmo_role_dn, &role_owner_dn); > if (!W_ERROR_IS_OK(werr)) { >+ talloc_free(tmp_ctx); > r->out.result = werr; > return NT_STATUS_OK; > } >@@ -106,6 +108,7 @@ NTSTATUS drepl_take_FSMO_role(struct irpc_message *msg, > DEBUG(2,("Unknown role %u in role transfer\n", > (unsigned)role)); > r->out.result = WERR_DS_DRA_INTERNAL_ERROR; >+ talloc_free(tmp_ctx); > return NT_STATUS_OK; > } > >@@ -115,6 +118,7 @@ NTSTATUS drepl_take_FSMO_role(struct irpc_message *msg, > ldb_dn_get_linearized(fsmo_role_dn), > ldb_dn_get_linearized(role_owner_dn))); > r->out.result = WERR_OK; >+ talloc_free(tmp_ctx); > return NT_STATUS_OK; > } > >@@ -134,11 +138,13 @@ NTSTATUS drepl_take_FSMO_role(struct irpc_message *msg, > fsmo); > if (!W_ERROR_IS_OK(werr)) { > r->out.result = werr; >+ talloc_free(tmp_ctx); > return NT_STATUS_OK; > } > > /* mark this message to be answered later */ > msg->defer_reply = true; > dreplsrv_run_pending_ops(service); >+ talloc_free(tmp_ctx); > return NT_STATUS_OK; > } >diff --git a/source4/dsdb/repl/drepl_partitions.c b/source4/dsdb/repl/drepl_partitions.c >index 3aa715a..7464dc1 100644 >--- a/source4/dsdb/repl/drepl_partitions.c >+++ b/source4/dsdb/repl/drepl_partitions.c >@@ -52,7 +52,7 @@ WERROR dreplsrv_load_partitions(struct dreplsrv_service *s) > tmp_ctx = talloc_new(s); > W_ERROR_HAVE_NO_MEMORY(tmp_ctx); > >- ntds_dn = samdb_ntds_settings_dn(s->samdb); >+ ntds_dn = samdb_ntds_settings_dn(s->samdb, tmp_ctx); > if (!ntds_dn) { > DEBUG(1,(__location__ ": Unable to find ntds_dn: %s\n", ldb_errstring(s->samdb))); > talloc_free(tmp_ctx); >diff --git a/source4/dsdb/repl/drepl_ridalloc.c b/source4/dsdb/repl/drepl_ridalloc.c >index 6dcd9ef..c817c31 100644 >--- a/source4/dsdb/repl/drepl_ridalloc.c >+++ b/source4/dsdb/repl/drepl_ridalloc.c >@@ -95,7 +95,7 @@ static int drepl_ridalloc_pool_exhausted(struct ldb_context *ldb, > *exhausted = false; > *_alloc_pool = UINT64_MAX; > >- server_dn = ldb_dn_get_parent(tmp_ctx, samdb_ntds_settings_dn(ldb)); >+ server_dn = ldb_dn_get_parent(tmp_ctx, samdb_ntds_settings_dn(ldb, tmp_ctx)); > if (!server_dn) { > talloc_free(tmp_ctx); > return ldb_operr(ldb); >@@ -208,7 +208,7 @@ WERROR dreplsrv_ridalloc_check_rid_pool(struct dreplsrv_service *service) > return WERR_DS_DRA_INTERNAL_ERROR; > } > >- if (ldb_dn_compare(samdb_ntds_settings_dn(ldb), fsmo_role_dn) == 0) { >+ if (ldb_dn_compare(samdb_ntds_settings_dn(ldb, tmp_ctx), fsmo_role_dn) == 0) { > /* we are the RID Manager - no need to do a > DRSUAPI_EXOP_FSMO_RID_ALLOC */ > talloc_free(tmp_ctx); >diff --git a/source4/dsdb/samdb/ldb_modules/objectclass.c b/source4/dsdb/samdb/ldb_modules/objectclass.c >index d431367..7d34b4e 100644 >--- a/source4/dsdb/samdb/ldb_modules/objectclass.c >+++ b/source4/dsdb/samdb/ldb_modules/objectclass.c >@@ -1298,7 +1298,7 @@ static int objectclass_do_delete(struct oc_context *ac) > } > > /* DC's ntDSDSA object */ >- if (ldb_dn_compare(ac->req->op.del.dn, samdb_ntds_settings_dn(ldb)) == 0) { >+ if (ldb_dn_compare(ac->req->op.del.dn, samdb_ntds_settings_dn(ldb, ac)) == 0) { > ldb_asprintf_errstring(ldb, "objectclass: Cannot delete %s, it's the DC's ntDSDSA object!", > ldb_dn_get_linearized(ac->req->op.del.dn)); > return LDB_ERR_UNWILLING_TO_PERFORM; >diff --git a/source4/dsdb/samdb/ldb_modules/ridalloc.c b/source4/dsdb/samdb/ldb_modules/ridalloc.c >index 2cef1c4..915248c 100644 >--- a/source4/dsdb/samdb/ldb_modules/ridalloc.c >+++ b/source4/dsdb/samdb/ldb_modules/ridalloc.c >@@ -407,7 +407,7 @@ static int ridalloc_create_own_rid_set(struct ldb_module *module, TALLOC_CTX *me > return ret; > } > >- if (ldb_dn_compare(samdb_ntds_settings_dn(ldb), fsmo_role_dn) != 0) { >+ if (ldb_dn_compare(samdb_ntds_settings_dn(ldb, tmp_ctx), fsmo_role_dn) != 0) { > ridalloc_poke_rid_manager(module); > ldb_asprintf_errstring(ldb, "Remote RID Set allocation needs refresh"); > talloc_free(tmp_ctx); >@@ -448,7 +448,7 @@ static int ridalloc_new_own_pool(struct ldb_module *module, uint64_t *new_pool, > return ret; > } > >- if (ldb_dn_compare(samdb_ntds_settings_dn(ldb), fsmo_role_dn) != 0) { >+ if (ldb_dn_compare(samdb_ntds_settings_dn(ldb, tmp_ctx), fsmo_role_dn) != 0) { > ridalloc_poke_rid_manager(module); > ldb_asprintf_errstring(ldb, "Remote RID Set allocation needs refresh"); > talloc_free(tmp_ctx); >diff --git a/source4/dsdb/samdb/ldb_modules/rootdse.c b/source4/dsdb/samdb/ldb_modules/rootdse.c >index 6859d04..9ae5b20 100644 >--- a/source4/dsdb/samdb/ldb_modules/rootdse.c >+++ b/source4/dsdb/samdb/ldb_modules/rootdse.c >@@ -197,7 +197,7 @@ static int dsdb_module_we_are_master(struct ldb_module *module, struct ldb_dn *d > return LDB_SUCCESS; > } > >- *master = (ldb_dn_compare(owner_dn, samdb_ntds_settings_dn(ldb_module_get_ctx(module))) == 0); >+ *master = (ldb_dn_compare(owner_dn, samdb_ntds_settings_dn(ldb_module_get_ctx(module), tmp_ctx)) == 0); > talloc_free(tmp_ctx); > return LDB_SUCCESS; > } >@@ -1073,7 +1073,7 @@ static int rootdse_enable_recycle_bin(struct ldb_module *module,struct ldb_conte > } > > tmp_ctx = talloc_new(mem_ctx); >- ntds_settings_dn = samdb_ntds_settings_dn(ldb); >+ ntds_settings_dn = samdb_ntds_settings_dn(ldb, tmp_ctx); > if (!ntds_settings_dn) { > talloc_free(tmp_ctx); > return ldb_error(ldb, LDB_ERR_OPERATIONS_ERROR, "Failed to find NTDS settings DN"); >diff --git a/source4/dsdb/samdb/ldb_modules/util.c b/source4/dsdb/samdb/ldb_modules/util.c >index 0f1a612..253d5c1 100644 >--- a/source4/dsdb/samdb/ldb_modules/util.c >+++ b/source4/dsdb/samdb/ldb_modules/util.c >@@ -691,15 +691,16 @@ int dsdb_check_optional_feature(struct ldb_module *module, struct GUID op_featur > struct ldb_message_element *el; > struct ldb_dn *feature_dn; > >- feature_dn = samdb_ntds_settings_dn(ldb_module_get_ctx(module)); >+ tmp_ctx = talloc_new(ldb); >+ >+ feature_dn = samdb_ntds_settings_dn(ldb_module_get_ctx(module), tmp_ctx); > if (feature_dn == NULL) { >+ talloc_free(tmp_ctx); > return ldb_operr(ldb_module_get_ctx(module)); > } > > *feature_enabled = false; > >- tmp_ctx = talloc_new(ldb); >- > ret = dsdb_module_search_dn(module, tmp_ctx, &res, feature_dn, attrs, DSDB_FLAG_NEXT_MODULE, NULL); > if (ret != LDB_SUCCESS) { > ldb_asprintf_errstring(ldb, >diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c >index 1771b26..8385ac2 100644 >--- a/source4/dsdb/schema/schema_init.c >+++ b/source4/dsdb/schema/schema_init.c >@@ -897,7 +897,7 @@ int dsdb_schema_from_ldb_results(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, > } > > schema->fsmo.master_dn = ldb_msg_find_attr_as_dn(ldb, schema, schema_res->msgs[0], "fSMORoleOwner"); >- if (ldb_dn_compare(samdb_ntds_settings_dn(ldb), schema->fsmo.master_dn) == 0) { >+ if (ldb_dn_compare(samdb_ntds_settings_dn(ldb, tmp_ctx), schema->fsmo.master_dn) == 0) { > schema->fsmo.we_are_master = true; > } else { > schema->fsmo.we_are_master = false; >diff --git a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c >index b170ec3..1d51ce8 100644 >--- a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c >+++ b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c >@@ -124,7 +124,7 @@ static WERROR dcesrv_drsuapi_DsBind(struct dcesrv_call_state *dce_call, TALLOC_C > /* > * lookup the local servers Replication Epoch > */ >- ntds_dn = samdb_ntds_settings_dn(b_state->sam_ctx); >+ ntds_dn = samdb_ntds_settings_dn(b_state->sam_ctx, mem_ctx); > W_ERROR_HAVE_NO_MEMORY(ntds_dn); > > ret = ldb_search(b_state->sam_ctx, mem_ctx, &ntds_res, >diff --git a/source4/rpc_server/drsuapi/getncchanges.c b/source4/rpc_server/drsuapi/getncchanges.c >index 07e64d3..22ff614 100644 >--- a/source4/rpc_server/drsuapi/getncchanges.c >+++ b/source4/rpc_server/drsuapi/getncchanges.c >@@ -723,7 +723,7 @@ static WERROR getncchanges_rid_alloc(struct drsuapi_bind_state *b_state, > return WERR_DS_DRA_INTERNAL_ERROR; > } > >- if (ldb_dn_compare(samdb_ntds_settings_dn(ldb), fsmo_role_dn) != 0) { >+ if (ldb_dn_compare(samdb_ntds_settings_dn(ldb, mem_ctx), fsmo_role_dn) != 0) { > /* we're not the RID Manager - go away */ > DEBUG(0,(__location__ ": RID Alloc request when not RID Manager\n")); > ctr6->extended_ret = DRSUAPI_EXOP_ERR_FSMO_NOT_OWNER; >@@ -1064,7 +1064,7 @@ static WERROR getncchanges_change_master(struct drsuapi_bind_state *b_state, > return WERR_DS_DRA_INTERNAL_ERROR; > } > >- if (ldb_dn_compare(samdb_ntds_settings_dn(ldb), fsmo_role_dn) != 0) { >+ if (ldb_dn_compare(samdb_ntds_settings_dn(ldb, mem_ctx), fsmo_role_dn) != 0) { > /* we're not the current owner - go away */ > DEBUG(0,(__location__ ": FSMO transfer request when not owner\n")); > ctr6->extended_ret = DRSUAPI_EXOP_ERR_FSMO_NOT_OWNER; >-- >1.7.11.2 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 8827
:
7406
|
7446
|
7551
|
7552
| 7765