summaryrefslogtreecommitdiff
path: root/source4/rpc_server
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-08-25 07:32:18 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:16:45 -0500
commitb21b119cbcff175453173d7061e3be3888dc8ec3 (patch)
treea83ace4202a076adc4cdbcf772c4da2ba82fdcf5 /source4/rpc_server
parent0fd98079425cff37c45be824ffa2695458ff12f3 (diff)
downloadsamba-b21b119cbcff175453173d7061e3be3888dc8ec3.tar.gz
samba-b21b119cbcff175453173d7061e3be3888dc8ec3.tar.bz2
samba-b21b119cbcff175453173d7061e3be3888dc8ec3.zip
r17824: add a wrapper for the common partitions_basedn calculation
(This used to be commit 09007b0907662a0d147e8eb21d5bdfc90dbffefc)
Diffstat (limited to 'source4/rpc_server')
-rw-r--r--source4/rpc_server/dssetup/dcesrv_dssetup.c2
-rw-r--r--source4/rpc_server/lsa/dcesrv_lsa.c6
-rw-r--r--source4/rpc_server/netlogon/dcerpc_netlogon.c4
-rw-r--r--source4/rpc_server/samr/dcesrv_samr.c12
4 files changed, 16 insertions, 8 deletions
diff --git a/source4/rpc_server/dssetup/dcesrv_dssetup.c b/source4/rpc_server/dssetup/dcesrv_dssetup.c
index 5d627c60fd..582b1f6071 100644
--- a/source4/rpc_server/dssetup/dcesrv_dssetup.c
+++ b/source4/rpc_server/dssetup/dcesrv_dssetup.c
@@ -101,7 +101,7 @@ static WERROR dssetup_DsRoleGetPrimaryDomainInformation(struct dcesrv_call_state
domain = samdb_search_string(sam_ctx, mem_ctx, NULL, "nETBIOSName",
"(&(objectclass=crossRef)(ncName=%s))",
- ldb_dn_linearize(mem_ctx, samdb_base_dn(mem_ctx)));
+ ldb_dn_linearize(mem_ctx, samdb_base_dn(sam_ctx)));
dns_domain = samdb_result_string(res[0], "dnsDomain", NULL);
forest = samdb_result_string(res[0], "dnsDomain", NULL);
diff --git a/source4/rpc_server/lsa/dcesrv_lsa.c b/source4/rpc_server/lsa/dcesrv_lsa.c
index 7949ee2a93..43bc91b149 100644
--- a/source4/rpc_server/lsa/dcesrv_lsa.c
+++ b/source4/rpc_server/lsa/dcesrv_lsa.c
@@ -267,7 +267,7 @@ static NTSTATUS lsa_get_policy_state(struct dcesrv_call_state *dce_call, TALLOC_
struct lsa_policy_state **_state)
{
struct lsa_policy_state *state;
- const struct ldb_dn *partitions_basedn = ldb_dn_string_compose(mem_ctx, samdb_base_dn(mem_ctx), "CN=Partitions,CN=Configuration");
+ const struct ldb_dn *partitions_basedn;
state = talloc(mem_ctx, struct lsa_policy_state);
if (!state) {
@@ -280,6 +280,8 @@ static NTSTATUS lsa_get_policy_state(struct dcesrv_call_state *dce_call, TALLOC_
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
+ partitions_basedn = samdb_partitions_dn(state->sam_ldb, mem_ctx);
+
state->sidmap = sidmap_open(state);
if (state->sidmap == NULL) {
return NT_STATUS_INVALID_SYSTEM_SERVICE;
@@ -287,7 +289,7 @@ static NTSTATUS lsa_get_policy_state(struct dcesrv_call_state *dce_call, TALLOC_
/* work out the domain_dn - useful for so many calls its worth
fetching here */
- state->domain_dn = samdb_base_dn(state);
+ state->domain_dn = samdb_base_dn(state->sam_ldb);
if (!state->domain_dn) {
return NT_STATUS_NO_MEMORY;
}
diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c
index 74a70e8bcf..dd6bdf3f6a 100644
--- a/source4/rpc_server/netlogon/dcerpc_netlogon.c
+++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c
@@ -889,7 +889,7 @@ static NTSTATUS netr_LogonGetDomainInfo(struct dcesrv_call_state *dce_call, TALL
struct netr_DomainInfo1 *info1;
int ret, ret1, ret2, i;
NTSTATUS status;
- const struct ldb_dn *partitions_basedn = ldb_dn_string_compose(mem_ctx, samdb_base_dn(mem_ctx), "CN=Partitions,CN=Configuration");
+ const struct ldb_dn *partitions_basedn = samdb_partitions_dn(sam_ctx, mem_ctx);
const char *local_domain;
@@ -1143,7 +1143,7 @@ static WERROR netr_DsrEnumerateDomainTrusts(struct dcesrv_call_state *dce_call,
struct ldb_message **dom_res, **ref_res;
const char * const dom_attrs[] = { "dnsDomain", "objectSid", "objectGUID", NULL };
const char * const ref_attrs[] = { "nETBIOSName", NULL };
- const struct ldb_dn *partitions_basedn = ldb_dn_string_compose(mem_ctx, samdb_base_dn(mem_ctx), "CN=Partitions,CN=Configuration");
+ const struct ldb_dn *partitions_basedn = samdb_partitions_dn(sam_ctx, mem_ctx);
ZERO_STRUCT(r->out);
diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c
index 65a1491a1d..abbcb4818c 100644
--- a/source4/rpc_server/samr/dcesrv_samr.c
+++ b/source4/rpc_server/samr/dcesrv_samr.c
@@ -225,7 +225,7 @@ static NTSTATUS samr_LookupDomain(struct dcesrv_call_state *dce_call, TALLOC_CTX
struct ldb_message **dom_msgs;
struct ldb_message **ref_msgs;
int ret;
- const struct ldb_dn *partitions_basedn = ldb_dn_string_compose(mem_ctx, samdb_base_dn(mem_ctx), "CN=Partitions,CN=Configuration");
+ const struct ldb_dn *partitions_basedn;
r->out.sid = NULL;
@@ -237,6 +237,8 @@ static NTSTATUS samr_LookupDomain(struct dcesrv_call_state *dce_call, TALLOC_CTX
return NT_STATUS_INVALID_PARAMETER;
}
+ partitions_basedn = samdb_partitions_dn(c_state->sam_ctx, mem_ctx);
+
if (strcasecmp(r->in.domain_name->string, "BUILTIN") == 0) {
ret = gendb_search(c_state->sam_ctx,
mem_ctx, NULL, &dom_msgs, dom_attrs,
@@ -289,7 +291,7 @@ static NTSTATUS samr_EnumDomains(struct dcesrv_call_state *dce_call, TALLOC_CTX
const char * const ref_attrs[] = { "nETBIOSName", NULL};
struct ldb_message **dom_msgs;
struct ldb_message **ref_msgs;
- const struct ldb_dn *partitions_basedn = ldb_dn_string_compose(mem_ctx, samdb_base_dn(mem_ctx), "CN=Partitions,CN=Configuration");
+ const struct ldb_dn *partitions_basedn;
*r->out.resume_handle = 0;
r->out.sam = NULL;
@@ -299,6 +301,8 @@ static NTSTATUS samr_EnumDomains(struct dcesrv_call_state *dce_call, TALLOC_CTX
c_state = h->data;
+ partitions_basedn = samdb_partitions_dn(c_state->sam_ctx, mem_ctx);
+
count = gendb_search(c_state->sam_ctx,
mem_ctx, NULL, &dom_msgs, dom_attrs,
"(objectClass=domain)");
@@ -367,7 +371,7 @@ static NTSTATUS samr_OpenDomain(struct dcesrv_call_state *dce_call, TALLOC_CTX *
struct ldb_message **dom_msgs;
struct ldb_message **ref_msgs;
int ret;
- const struct ldb_dn *partitions_basedn = ldb_dn_string_compose(mem_ctx, samdb_base_dn(mem_ctx), "CN=Partitions,CN=Configuration");
+ const struct ldb_dn *partitions_basedn;
ZERO_STRUCTP(r->out.domain_handle);
@@ -379,6 +383,8 @@ static NTSTATUS samr_OpenDomain(struct dcesrv_call_state *dce_call, TALLOC_CTX *
return NT_STATUS_INVALID_PARAMETER;
}
+ partitions_basedn = samdb_partitions_dn(c_state->sam_ctx, mem_ctx);
+
ret = gendb_search(c_state->sam_ctx,
mem_ctx, NULL, &dom_msgs, dom_attrs,
"(&(objectSid=%s)(&(objectclass=domain)))",