summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-06-12 11:03:15 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:18:02 -0500
commit694488d29c29e858df7638952282225300ceb5b6 (patch)
treeec0bd55959b8c5c63ad35980d7fa16e57e7b710e /source4
parent72ac7767829257a6fb9c1b7243f399370f4af5c3 (diff)
downloadsamba-694488d29c29e858df7638952282225300ceb5b6.tar.gz
samba-694488d29c29e858df7638952282225300ceb5b6.tar.bz2
samba-694488d29c29e858df7638952282225300ceb5b6.zip
r7507: fixed the problem with users being shown too many times in acl
editors, and added a test for it. (This used to be commit 9e428881f6fc0a422ac9011d847e8f692284397a)
Diffstat (limited to 'source4')
-rw-r--r--source4/rpc_server/samr/dcesrv_samr.c6
-rw-r--r--source4/torture/rpc/samr.c45
2 files changed, 48 insertions, 3 deletions
diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c
index 9934a502de..b40028b880 100644
--- a/source4/rpc_server/samr/dcesrv_samr.c
+++ b/source4/rpc_server/samr/dcesrv_samr.c
@@ -2965,7 +2965,7 @@ static NTSTATUS samr_QueryDisplayInfo(struct dcesrv_call_state *dce_call, TALLOC
switch(r->in.level) {
case 1:
- entriesGeneral[count].idx = count;
+ entriesGeneral[count].idx = count + 1;
entriesGeneral[count].rid =
objectsid->sub_auths[objectsid->num_auths-1];
entriesGeneral[count].acct_flags =
@@ -2981,7 +2981,7 @@ static NTSTATUS samr_QueryDisplayInfo(struct dcesrv_call_state *dce_call, TALLOC
break;
case 2:
case 3:
- entriesFull[count].idx = count;
+ entriesFull[count].idx = count + 1;
entriesFull[count].rid =
objectsid->sub_auths[objectsid->num_auths-1];
entriesFull[count].acct_flags =
@@ -2999,7 +2999,7 @@ static NTSTATUS samr_QueryDisplayInfo(struct dcesrv_call_state *dce_call, TALLOC
break;
case 4:
case 5:
- entriesAscii[count].idx = count;
+ entriesAscii[count].idx = count + 1;
entriesAscii[count].account_name.string =
samdb_result_string(res[i], "sAMAccountName",
"");
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
index 3f2519c239..83c5db4a42 100644
--- a/source4/torture/rpc/samr.c
+++ b/source4/torture/rpc/samr.c
@@ -2479,6 +2479,50 @@ static BOOL test_QueryDisplayInfo3(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return ret;
}
+
+static BOOL test_QueryDisplayInfo_continue(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle)
+{
+ NTSTATUS status;
+ struct samr_QueryDisplayInfo r;
+ BOOL ret = True;
+ uint16_t levels[] = {1, 2, 3, 4, 5};
+ int i;
+
+ printf("Testing QueryDisplayInfo continuation\n");
+
+ r.in.domain_handle = handle;
+ r.in.level = 1;
+ r.in.start_idx = 0;
+ r.in.max_entries = 1;
+ r.in.buf_size = (uint32_t)-1;
+
+ do {
+ status = dcerpc_samr_QueryDisplayInfo(p, mem_ctx, &r);
+ if (NT_STATUS_IS_OK(status) && r.out.returned_size != 0) {
+ if (r.out.info.info1.entries[0].idx != r.in.start_idx + 1) {
+ printf("failed: expected idx %d but got %d\n",
+ r.in.start_idx + 1,
+ r.out.info.info1.entries[0].idx);
+ ret = False;
+ break;
+ }
+ }
+ if (!NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES) &&
+ !NT_STATUS_IS_OK(status)) {
+ printf("QueryDisplayInfo level %u failed - %s\n",
+ r.in.level, nt_errstr(status));
+ ret = False;
+ break;
+ }
+ r.in.start_idx++;
+ } while (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES) ||
+ NT_STATUS_IS_OK(status) &&
+ r.out.returned_size != 0);
+
+ return ret;
+}
+
static BOOL test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *handle)
{
@@ -2958,6 +3002,7 @@ static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
ret &= test_QueryDisplayInfo(p, mem_ctx, &domain_handle);
ret &= test_QueryDisplayInfo2(p, mem_ctx, &domain_handle);
ret &= test_QueryDisplayInfo3(p, mem_ctx, &domain_handle);
+ ret &= test_QueryDisplayInfo_continue(p, mem_ctx, &domain_handle);
ret &= test_GetDisplayEnumerationIndex(p, mem_ctx, &domain_handle);
ret &= test_GetDisplayEnumerationIndex2(p, mem_ctx, &domain_handle);
ret &= test_GroupList(p, mem_ctx, &domain_handle);