summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/librpc/idl/samr.idl47
-rw-r--r--source4/torture/rpc/samr.c152
2 files changed, 195 insertions, 4 deletions
diff --git a/source4/librpc/idl/samr.idl b/source4/librpc/idl/samr.idl
index 41071a1f9c..01bfc7ed7a 100644
--- a/source4/librpc/idl/samr.idl
+++ b/source4/librpc/idl/samr.idl
@@ -861,19 +861,58 @@
/************************/
/* Function 0x2e */
- NTSTATUS samr_QUERY_INFORMATION_DOMAIN2();
+
+ /*
+ how is this different from QueryDomainInfo ??
+ */
+ NTSTATUS samr_QueryDomainInfo2(
+ [in,ref] policy_handle *handle,
+ [in] uint16 level,
+ [out,switch_is(level)] samr_DomainInfo *info
+ );
/************************/
/* Function 0x2f */
- NTSTATUS samr_QUERY_INFORMATION_USER2();
+
+ /*
+ how is this different from QueryUserInfo ??
+ */
+ NTSTATUS samr_QueryUserInfo2(
+ [in,ref] policy_handle *handle,
+ [in] uint16 level,
+ [out,switch_is(level)] samr_UserInfo *info
+ );
/************************/
/* Function 0x30 */
- NTSTATUS samr_QUERY_DISPINFO2();
+
+ /*
+ how is this different from QueryDisplayInfo??
+ */
+ NTSTATUS samr_QueryDisplayInfo2(
+ [in,ref] policy_handle *handle,
+ [in] uint16 level,
+ [in] uint32 start_idx,
+ [in] uint32 max_entries,
+ [in] uint32 buf_size,
+ [out] uint32 total_size,
+ [out] uint32 returned_size,
+ [out,switch_is(level)] samr_DispInfo info
+ );
/************************/
/* Function 0x31 */
- NTSTATUS samr_GET_DISPLAY_ENUMERATION_INDEX2();
+
+ /*
+ how is this different from GetDisplayEnumerationIndex ??
+ */
+ NTSTATUS samr_GetDisplayEnumerationIndex2(
+ [in,ref] policy_handle *handle,
+ [in] uint16 level,
+ [in] samr_Name name,
+ [out] uint32 idx
+ );
+
/************************/
/* Function 0x32 */
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
index 9465dd135b..a098fbd9ca 100644
--- a/source4/torture/rpc/samr.c
+++ b/source4/torture/rpc/samr.c
@@ -32,6 +32,9 @@
static BOOL test_QueryUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *handle);
+static BOOL test_QueryUserInfo2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle);
+
static BOOL test_QueryAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *handle);
@@ -510,6 +513,10 @@ static BOOL test_user_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
ret = False;
}
+ if (!test_QueryUserInfo2(p, mem_ctx, handle)) {
+ ret = False;
+ }
+
if (!test_SetUserInfo(p, mem_ctx, handle)) {
ret = False;
}
@@ -1034,6 +1041,33 @@ static BOOL test_QueryUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return ret;
}
+static BOOL test_QueryUserInfo2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle)
+{
+ NTSTATUS status;
+ struct samr_QueryUserInfo2 r;
+ uint16 levels[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 16, 17, 20, 21};
+ int i;
+ BOOL ret = True;
+
+ for (i=0;i<ARRAY_SIZE(levels);i++) {
+ printf("Testing QueryUserInfo2 level %u\n", levels[i]);
+
+ r.in.handle = handle;
+ r.in.level = levels[i];
+
+ status = dcerpc_samr_QueryUserInfo2(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("QueryUserInfo2 level %u failed - %s\n",
+ levels[i], nt_errstr(status));
+ ret = False;
+ }
+ }
+
+ return ret;
+}
+
static BOOL test_OpenUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *handle, uint32 rid)
{
@@ -1063,6 +1097,10 @@ static BOOL test_OpenUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
ret = False;
}
+ if (!test_QueryUserInfo2(p, mem_ctx, &acct_handle)) {
+ ret = False;
+ }
+
if (!test_GetUserPwInfo(p, mem_ctx, &acct_handle)) {
ret = False;
}
@@ -1315,6 +1353,51 @@ static BOOL test_GetDisplayEnumerationIndex(struct dcerpc_pipe *p, TALLOC_CTX *m
levels[i], nt_errstr(status));
ret = False;
}
+
+ init_samr_Name(&r.in.name, "zzzzzzzz");
+
+ status = dcerpc_samr_GetDisplayEnumerationIndex(p, mem_ctx, &r);
+ if (!NT_STATUS_EQUAL(NT_STATUS_NO_MORE_ENTRIES, status)) {
+ printf("GetDisplayEnumerationIndex level %u failed - %s\n",
+ levels[i], nt_errstr(status));
+ ret = False;
+ }
+ }
+
+ return ret;
+}
+
+static BOOL test_GetDisplayEnumerationIndex2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle)
+{
+ NTSTATUS status;
+ struct samr_GetDisplayEnumerationIndex2 r;
+ BOOL ret = True;
+ uint16 levels[] = {1, 2, 3, 4, 5};
+ int i;
+
+ for (i=0;i<ARRAY_SIZE(levels);i++) {
+ printf("Testing GetDisplayEnumerationIndex2 level %u\n", levels[i]);
+
+ r.in.handle = handle;
+ r.in.level = levels[i];
+ init_samr_Name(&r.in.name, TEST_USERNAME);
+
+ status = dcerpc_samr_GetDisplayEnumerationIndex2(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("GetDisplayEnumerationIndex2 level %u failed - %s\n",
+ levels[i], nt_errstr(status));
+ ret = False;
+ }
+
+ init_samr_Name(&r.in.name, "zzzzzzzz");
+
+ status = dcerpc_samr_GetDisplayEnumerationIndex2(p, mem_ctx, &r);
+ if (!NT_STATUS_EQUAL(NT_STATUS_NO_MORE_ENTRIES, status)) {
+ printf("GetDisplayEnumerationIndex2 level %u failed - %s\n",
+ levels[i], nt_errstr(status));
+ ret = False;
+ }
}
return ret;
@@ -1349,6 +1432,35 @@ static BOOL test_QueryDisplayInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return ret;
}
+static BOOL test_QueryDisplayInfo2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle)
+{
+ NTSTATUS status;
+ struct samr_QueryDisplayInfo2 r;
+ BOOL ret = True;
+ uint16 levels[] = {1, 2, 3, 4, 5};
+ int i;
+
+ for (i=0;i<ARRAY_SIZE(levels);i++) {
+ printf("Testing QueryDisplayInfo2 level %u\n", levels[i]);
+
+ r.in.handle = handle;
+ r.in.level = levels[i];
+ r.in.start_idx = 0;
+ r.in.max_entries = 1000;
+ r.in.buf_size = (uint32)-1;
+
+ status = dcerpc_samr_QueryDisplayInfo2(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("QueryDisplayInfo2 level %u failed - %s\n",
+ levels[i], nt_errstr(status));
+ ret = False;
+ }
+ }
+
+ return ret;
+}
+
static BOOL test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *handle)
{
@@ -1401,6 +1513,34 @@ static BOOL test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return True;
}
+
+static BOOL test_QueryDomainInfo2(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle)
+{
+ NTSTATUS status;
+ struct samr_QueryDomainInfo2 r;
+ uint16 levels[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13};
+ int i;
+ BOOL ret = True;
+
+ for (i=0;i<ARRAY_SIZE(levels);i++) {
+ printf("Testing QueryDomainInfo2 level %u\n", levels[i]);
+
+ r.in.handle = handle;
+ r.in.level = levels[i];
+
+ status = dcerpc_samr_QueryDomainInfo2(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("QueryDomainInfo2 level %u failed - %s\n",
+ r.in.level, nt_errstr(status));
+ ret = False;
+ continue;
+ }
+ }
+
+ return True;
+}
+
void add_string_to_array(TALLOC_CTX *mem_ctx,
const char *str, const char ***strings, int *num)
{
@@ -1756,6 +1896,10 @@ static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
ret = False;
}
+ if (!test_QueryDomainInfo2(p, mem_ctx, &domain_handle)) {
+ ret = False;
+ }
+
if (!test_EnumDomainUsers(p, mem_ctx, &domain_handle)) {
ret = False;
}
@@ -1772,10 +1916,18 @@ static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
ret = False;
}
+ if (!test_QueryDisplayInfo2(p, mem_ctx, &domain_handle)) {
+ ret = False;
+ }
+
if (!test_GetDisplayEnumerationIndex(p, mem_ctx, &domain_handle)) {
ret = False;
}
+ if (!test_GetDisplayEnumerationIndex2(p, mem_ctx, &domain_handle)) {
+ ret = False;
+ }
+
if (!test_GroupList(p, mem_ctx, &domain_handle)) {
ret = False;
}