summaryrefslogtreecommitdiff
path: root/source4/rpc_server
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-08-14 16:08:47 +1000
committerAndrew Bartlett <abartlet@samba.org>2012-08-14 10:05:14 +0200
commit956678685325a79a315f4ef19c0d834fd1747e4c (patch)
tree62b89848fbf552187a07d1d520702112f3b4ac45 /source4/rpc_server
parent0f2a87b547be43b4764c48350fd03ff22e086806 (diff)
downloadsamba-956678685325a79a315f4ef19c0d834fd1747e4c.tar.gz
samba-956678685325a79a315f4ef19c0d834fd1747e4c.tar.bz2
samba-956678685325a79a315f4ef19c0d834fd1747e4c.zip
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 Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Tue Aug 14 10:05:14 CEST 2012 on sn-devel-104
Diffstat (limited to 'source4/rpc_server')
-rw-r--r--source4/rpc_server/drsuapi/dcesrv_drsuapi.c2
-rw-r--r--source4/rpc_server/drsuapi/getncchanges.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c
index b170ec3e23..1d51ce879a 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 07e64d321d..22ff6142eb 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;