summaryrefslogtreecommitdiffstats
path: root/source3/rpc_server/srv_samr_nt.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-06-07 00:40:46 +0200
committerGünther Deschner <gd@samba.org>2009-06-07 00:55:06 +0200
commit6544264ac139ea4d661e88737cd00b6af7db0599 (patch)
tree876d379df8b5595ba9cc5421348e13015b1ead62 /source3/rpc_server/srv_samr_nt.c
parent0845db66e06a70d5cfd9adc476bc1a773b3fcc5f (diff)
downloadsamba-6544264ac139ea4d661e88737cd00b6af7db0599.tar.gz
samba-6544264ac139ea4d661e88737cd00b6af7db0599.tar.xz
samba-6544264ac139ea4d661e88737cd00b6af7db0599.zip
s3-samr: _samr_EnumDomain{Users,Groups} need to return an emtpy array even for builtin domain.
Found by RPC-SAMR torture test. Guenther
Diffstat (limited to 'source3/rpc_server/srv_samr_nt.c')
-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 ad5beefc046..8111ee2d857 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;