summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_server/srv_samr_nt.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c
index ad5beefc04..8111ee2d85 100644
--- a/source3/rpc_server/srv_samr_nt.c
+++ b/source3/rpc_server/srv_samr_nt.c
@@ -939,6 +939,12 @@ NTSTATUS _samr_EnumDomainUsers(pipes_struct *p,
return status;
}
+ samr_array = TALLOC_ZERO_P(p->mem_ctx, struct samr_SamArray);
+ if (!samr_array) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ *r->out.sam = samr_array;
+
if (sid_check_is_builtin(&dinfo->sid)) {
/* No users in builtin. */
*r->out.resume_handle = *r->in.resume_handle;
@@ -946,12 +952,6 @@ NTSTATUS _samr_EnumDomainUsers(pipes_struct *p,
return status;
}
- samr_array = TALLOC_ZERO_P(p->mem_ctx, struct samr_SamArray);
- if (!samr_array) {
- return NT_STATUS_NO_MEMORY;
- }
- *r->out.sam = samr_array;
-
become_root();
/* AS ROOT !!!! */
@@ -1074,6 +1074,12 @@ NTSTATUS _samr_EnumDomainGroups(pipes_struct *p,
DEBUG(5,("_samr_EnumDomainGroups: %d\n", __LINE__));
+ samr_array = TALLOC_ZERO_P(p->mem_ctx, struct samr_SamArray);
+ if (!samr_array) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ *r->out.sam = samr_array;
+
if (sid_check_is_builtin(&dinfo->sid)) {
/* No groups in builtin. */
*r->out.resume_handle = *r->in.resume_handle;
@@ -1081,11 +1087,6 @@ NTSTATUS _samr_EnumDomainGroups(pipes_struct *p,
return status;
}
- samr_array = TALLOC_ZERO_P(p->mem_ctx, struct samr_SamArray);
- if (!samr_array) {
- return NT_STATUS_NO_MEMORY;
- }
-
/* the domain group array is being allocated in the function below */
become_root();
@@ -1119,7 +1120,6 @@ NTSTATUS _samr_EnumDomainGroups(pipes_struct *p,
samr_array->count = num_groups;
samr_array->entries = samr_entries;
- *r->out.sam = samr_array;
*r->out.num_entries = num_groups;
*r->out.resume_handle = num_groups + *r->in.resume_handle;