From 1325dea8ec34bb77780f5cb9a0437ee17631b575 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 22 Apr 2004 07:28:18 +0000 Subject: r326: tweaks to the RPC-SAMR test code to allow win2003 to pass the test (for example, not filling in extra fields in level21 setuserinfo) (This used to be commit d06ed158f9aef94159bfc09065ca5ad0c4c99de3) --- source4/librpc/idl/samr.idl | 4 +-- source4/torture/rpc/samr.c | 68 +++++++++++++++++++++++++++++++++++++++------ 2 files changed, 61 insertions(+), 11 deletions(-) diff --git a/source4/librpc/idl/samr.idl b/source4/librpc/idl/samr.idl index a5461705ec..8f8a96a819 100644 --- a/source4/librpc/idl/samr.idl +++ b/source4/librpc/idl/samr.idl @@ -824,7 +824,7 @@ /* Function 0x2a */ /* - w2k3 return NT_STATUS_NOT_IMPLEMENTED for this + w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this */ NTSTATUS samr_TestPrivateFunctionsDomain( [in,ref] policy_handle *handle @@ -835,7 +835,7 @@ /* Function 0x2b */ /* - w2k3 return NT_STATUS_NOT_IMPLEMENTED for this + w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this */ NTSTATUS samr_TestPrivateFunctionsUser( [in,ref] policy_handle *handle diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c index 13c57a6430..95d21e20e4 100644 --- a/source4/torture/rpc/samr.c +++ b/source4/torture/rpc/samr.c @@ -151,10 +151,11 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, s.in.level = lvl1; \ s2.in.level = lvl1; \ u = *q.out.info; \ - init_samr_Name(&u.info ## lvl1.field1, value); \ if (lvl1 == 21) { \ + ZERO_STRUCT(u.info21); \ u.info21.fields_present = fpval; \ } \ + init_samr_Name(&u.info ## lvl1.field1, value); \ TESTCALL(SetUserInfo, s) \ TESTCALL(SetUserInfo2, s2) \ init_samr_Name(&u.info ## lvl1.field1, ""); \ @@ -174,10 +175,16 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, s.in.level = lvl1; \ s2.in.level = lvl1; \ u = *q.out.info; \ - u.info ## lvl1.field1 = value; \ if (lvl1 == 21) { \ + uint8 *bitmap = u.info21.logon_hours.bitmap; \ + ZERO_STRUCT(u.info21); \ + if (fpval == 0x00002000) { \ + u.info21.logon_hours.units_per_week = 168; \ + u.info21.logon_hours.bitmap = bitmap; \ + } \ u.info21.fields_present = fpval; \ } \ + u.info ## lvl1.field1 = value; \ TESTCALL(SetUserInfo, s) \ TESTCALL(SetUserInfo2, s2) \ u.info ## lvl1.field1 = 0; \ @@ -502,11 +509,11 @@ static BOOL test_ChangePasswordUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, r.in.hash6 = &hash3; status = dcerpc_samr_ChangePasswordUser(p, mem_ctx, &r); - if (!NT_STATUS_IS_OK(status)) { + /* because we don't yet have the right code above, we expect + WRONG_PASSWORD back */ + if (!NT_STATUS_EQUAL(NT_STATUS_WRONG_PASSWORD, status)) { printf("ChangePasswordUser failed - %s\n", nt_errstr(status)); ret = False; - } else { - *password = newpass; } if (!test_Close(p, mem_ctx, &user_handle)) { @@ -1310,6 +1317,33 @@ static BOOL test_QueryAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, static BOOL test_QueryGroupInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) +{ + NTSTATUS status; + struct samr_QueryGroupInfo r; + uint16 levels[] = {1, 2, 3, 4}; + int i; + BOOL ret = True; + + for (i=0;idescription, "test description"); + } + status = dcerpc_samr_SetGroupInfo(p, mem_ctx, &s); if (set_ok[i]) { if (!NT_STATUS_IS_OK(status)) { @@ -1683,6 +1721,7 @@ static BOOL test_GetDisplayEnumerationIndex(struct dcerpc_pipe *p, TALLOC_CTX *m struct samr_GetDisplayEnumerationIndex r; BOOL ret = True; uint16 levels[] = {1, 2, 3, 4, 5}; + uint16 ok_lvl[] = {1, 1, 1, 0, 0}; int i; for (i=0;i