summaryrefslogtreecommitdiff
path: root/source4/rpc_server/dssetup/dcesrv_dssetup.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-01-03 14:45:17 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:08:16 -0500
commit4dd48e95cdd40d0d489253f51363aff7916aed9a (patch)
treebf714131c58d643ed2131349e681799ba647127f /source4/rpc_server/dssetup/dcesrv_dssetup.c
parentfd6aa0ecd394d55fd1f380b20de98991ae1aa74d (diff)
downloadsamba-4dd48e95cdd40d0d489253f51363aff7916aed9a.tar.gz
samba-4dd48e95cdd40d0d489253f51363aff7916aed9a.tar.bz2
samba-4dd48e95cdd40d0d489253f51363aff7916aed9a.zip
r4508: - simplify the code and allocate only in one place
- the ZERO_STRUCT(r->out) is useless and wrong if we would have a [ref,out] parameter also note the r->out is already initialized by the pidl generated code metze (This used to be commit 09727d3d4acdc90165f37ef726ba6f6ef6f77b98)
Diffstat (limited to 'source4/rpc_server/dssetup/dcesrv_dssetup.c')
-rw-r--r--source4/rpc_server/dssetup/dcesrv_dssetup.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/source4/rpc_server/dssetup/dcesrv_dssetup.c b/source4/rpc_server/dssetup/dcesrv_dssetup.c
index e3c33cc553..64f67b28f9 100644
--- a/source4/rpc_server/dssetup/dcesrv_dssetup.c
+++ b/source4/rpc_server/dssetup/dcesrv_dssetup.c
@@ -33,7 +33,10 @@ static WERROR dssetup_DsRoleGetPrimaryDomainInformation(struct dcesrv_call_state
TALLOC_CTX *mem_ctx,
struct dssetup_DsRoleGetPrimaryDomainInformation *r)
{
- ZERO_STRUCT(r->out);
+ union dssetup_DsRoleInfo *info;
+
+ info = talloc_p(mem_ctx, union dssetup_DsRoleInfo);
+ W_ERROR_HAVE_NO_MEMORY(info);
switch (r->in.level) {
case DS_ROLE_BASIC_INFORMATION:
@@ -42,7 +45,6 @@ static WERROR dssetup_DsRoleGetPrimaryDomainInformation(struct dcesrv_call_state
const char * const attrs[] = { "dnsDomain", "nTMixedDomain", "objectGUID", "name", NULL };
int ret;
struct ldb_message **res;
- union dssetup_DsRoleInfo *info;
enum dssetup_DsRole role = DS_ROLE_STANDALONE_SERVER;
uint32 flags = 0;
const char *domain = NULL;
@@ -52,9 +54,6 @@ static WERROR dssetup_DsRoleGetPrimaryDomainInformation(struct dcesrv_call_state
ZERO_STRUCT(domain_guid);
- info = talloc_p(mem_ctx, union dssetup_DsRoleInfo);
- W_ERROR_HAVE_NO_MEMORY(info);
-
switch (lp_server_role()) {
case ROLE_STANDALONE:
role = DS_ROLE_STANDALONE_SERVER;
@@ -120,11 +119,6 @@ static WERROR dssetup_DsRoleGetPrimaryDomainInformation(struct dcesrv_call_state
}
case DS_ROLE_UPGRADE_STATUS:
{
- union dssetup_DsRoleInfo *info;
-
- info = talloc_p(mem_ctx, union dssetup_DsRoleInfo);
- W_ERROR_HAVE_NO_MEMORY(info);
-
info->upgrade.upgrading = DS_ROLE_NOT_UPGRADING;
info->upgrade.previous_role = DS_ROLE_PREVIOUS_UNKNOWN;
@@ -133,11 +127,6 @@ static WERROR dssetup_DsRoleGetPrimaryDomainInformation(struct dcesrv_call_state
}
case DS_ROLE_OP_STATUS:
{
- union dssetup_DsRoleInfo *info;
-
- info = talloc_p(mem_ctx, union dssetup_DsRoleInfo);
- W_ERROR_HAVE_NO_MEMORY(info);
-
info->opstatus.status = DS_ROLE_OP_IDLE;
r->out.info = info;