diff options
Diffstat (limited to 'source4')
-rw-r--r-- | source4/librpc/idl/samr.idl | 10 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_samr.c | 30 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_samr.h | 10 | ||||
-rw-r--r-- | source4/torture/rpc/samr.c | 44 |
4 files changed, 59 insertions, 35 deletions
diff --git a/source4/librpc/idl/samr.idl b/source4/librpc/idl/samr.idl index 55c377dbcc..8604f311cf 100644 --- a/source4/librpc/idl/samr.idl +++ b/source4/librpc/idl/samr.idl @@ -450,7 +450,7 @@ typedef struct { samr_Name username; samr_Name full_name; - uint32 primary_group_rid; + uint32 primary_gid; samr_Name description; samr_Name comment; } samr_UserInfo1; @@ -466,7 +466,7 @@ samr_Name username; samr_Name full_name; uint32 Rid; - uint32 primary_group_rid; + uint32 primary_gid; samr_Name home_directory; samr_Name home_drive; samr_Name logon_script; @@ -493,7 +493,7 @@ samr_Name username; samr_Name full_name; uint32 rid; - uint32 primary_group_rid; + uint32 primary_gid; samr_Name home_directory; samr_Name home_drive; samr_Name logon_script; @@ -525,7 +525,7 @@ } samr_UserInfo8; typedef struct { - uint32 PrimaryGroupRid; + uint32 primary_gid; } samr_UserInfo9; typedef struct { @@ -584,7 +584,7 @@ uint32 buf_count; [size_is(buf_count)] uint8 *buffer; uint32 rid; - uint32 primary_group_rid; + uint32 primary_gid; uint32 acct_flags; uint32 fields_present; uint32 units_per_week; diff --git a/source4/librpc/ndr/ndr_samr.c b/source4/librpc/ndr/ndr_samr.c index f2dcfb9124..7d8bebeab4 100644 --- a/source4/librpc/ndr/ndr_samr.c +++ b/source4/librpc/ndr/ndr_samr.c @@ -327,7 +327,7 @@ NTSTATUS ndr_push_samr_UserInfo1(struct ndr_push *ndr, int ndr_flags, struct sam NDR_CHECK(ndr_push_align(ndr, 4)); NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->username)); NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->full_name)); - NDR_CHECK(ndr_push_uint32(ndr, r->primary_group_rid)); + NDR_CHECK(ndr_push_uint32(ndr, r->primary_gid)); NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->description)); NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->comment)); ndr_push_struct_end(ndr); @@ -367,7 +367,7 @@ NTSTATUS ndr_push_samr_UserInfo3(struct ndr_push *ndr, int ndr_flags, struct sam NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->username)); NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->full_name)); NDR_CHECK(ndr_push_uint32(ndr, r->Rid)); - NDR_CHECK(ndr_push_uint32(ndr, r->primary_group_rid)); + NDR_CHECK(ndr_push_uint32(ndr, r->primary_gid)); NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->home_directory)); NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->home_drive)); NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->logon_script)); @@ -431,7 +431,7 @@ NTSTATUS ndr_push_samr_UserInfo5(struct ndr_push *ndr, int ndr_flags, struct sam NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->username)); NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->full_name)); NDR_CHECK(ndr_push_uint32(ndr, r->rid)); - NDR_CHECK(ndr_push_uint32(ndr, r->primary_group_rid)); + NDR_CHECK(ndr_push_uint32(ndr, r->primary_gid)); NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->home_directory)); NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->home_drive)); NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->logon_script)); @@ -517,7 +517,7 @@ NTSTATUS ndr_push_samr_UserInfo9(struct ndr_push *ndr, int ndr_flags, struct sam if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_push_struct_start(ndr)); NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_uint32(ndr, r->PrimaryGroupRid)); + NDR_CHECK(ndr_push_uint32(ndr, r->primary_gid)); ndr_push_struct_end(ndr); buffers: if (!(ndr_flags & NDR_BUFFERS)) goto done; @@ -664,7 +664,7 @@ NTSTATUS ndr_push_samr_UserInfo21(struct ndr_push *ndr, int ndr_flags, struct sa NDR_CHECK(ndr_push_uint32(ndr, r->buf_count)); NDR_CHECK(ndr_push_ptr(ndr, r->buffer)); NDR_CHECK(ndr_push_uint32(ndr, r->rid)); - NDR_CHECK(ndr_push_uint32(ndr, r->primary_group_rid)); + NDR_CHECK(ndr_push_uint32(ndr, r->primary_gid)); NDR_CHECK(ndr_push_uint32(ndr, r->acct_flags)); NDR_CHECK(ndr_push_uint32(ndr, r->fields_present)); NDR_CHECK(ndr_push_uint32(ndr, r->units_per_week)); @@ -2141,7 +2141,7 @@ NTSTATUS ndr_pull_samr_UserInfo1(struct ndr_pull *ndr, int ndr_flags, struct sam NDR_CHECK(ndr_pull_align(ndr, 4)); NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->username)); NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->full_name)); - NDR_CHECK(ndr_pull_uint32(ndr, &r->primary_group_rid)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->primary_gid)); NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->description)); NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->comment)); ndr_pull_struct_end(ndr); @@ -2182,7 +2182,7 @@ NTSTATUS ndr_pull_samr_UserInfo3(struct ndr_pull *ndr, int ndr_flags, struct sam NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->username)); NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->full_name)); NDR_CHECK(ndr_pull_uint32(ndr, &r->Rid)); - NDR_CHECK(ndr_pull_uint32(ndr, &r->primary_group_rid)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->primary_gid)); NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->home_directory)); NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->home_drive)); NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->logon_script)); @@ -2284,7 +2284,7 @@ NTSTATUS ndr_pull_samr_UserInfo5(struct ndr_pull *ndr, int ndr_flags, struct sam NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->username)); NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->full_name)); NDR_CHECK(ndr_pull_uint32(ndr, &r->rid)); - NDR_CHECK(ndr_pull_uint32(ndr, &r->primary_group_rid)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->primary_gid)); NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->home_directory)); NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->home_drive)); NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->logon_script)); @@ -2388,7 +2388,7 @@ NTSTATUS ndr_pull_samr_UserInfo9(struct ndr_pull *ndr, int ndr_flags, struct sam NDR_CHECK(ndr_pull_struct_start(ndr)); if (!(ndr_flags & NDR_SCALARS)) goto buffers; NDR_CHECK(ndr_pull_align(ndr, 4)); - NDR_CHECK(ndr_pull_uint32(ndr, &r->PrimaryGroupRid)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->primary_gid)); ndr_pull_struct_end(ndr); buffers: if (!(ndr_flags & NDR_BUFFERS)) goto done; @@ -2542,7 +2542,7 @@ NTSTATUS ndr_pull_samr_UserInfo21(struct ndr_pull *ndr, int ndr_flags, struct sa r->buffer = NULL; } NDR_CHECK(ndr_pull_uint32(ndr, &r->rid)); - NDR_CHECK(ndr_pull_uint32(ndr, &r->primary_group_rid)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->primary_gid)); NDR_CHECK(ndr_pull_uint32(ndr, &r->acct_flags)); NDR_CHECK(ndr_pull_uint32(ndr, &r->fields_present)); NDR_CHECK(ndr_pull_uint32(ndr, &r->units_per_week)); @@ -4323,7 +4323,7 @@ void ndr_print_samr_UserInfo1(struct ndr_print *ndr, const char *name, struct sa ndr->depth++; ndr_print_samr_Name(ndr, "username", &r->username); ndr_print_samr_Name(ndr, "full_name", &r->full_name); - ndr_print_uint32(ndr, "primary_group_rid", r->primary_group_rid); + ndr_print_uint32(ndr, "primary_gid", r->primary_gid); ndr_print_samr_Name(ndr, "description", &r->description); ndr_print_samr_Name(ndr, "comment", &r->comment); ndr->depth--; @@ -4347,7 +4347,7 @@ void ndr_print_samr_UserInfo3(struct ndr_print *ndr, const char *name, struct sa ndr_print_samr_Name(ndr, "username", &r->username); ndr_print_samr_Name(ndr, "full_name", &r->full_name); ndr_print_uint32(ndr, "Rid", r->Rid); - ndr_print_uint32(ndr, "primary_group_rid", r->primary_group_rid); + ndr_print_uint32(ndr, "primary_gid", r->primary_gid); ndr_print_samr_Name(ndr, "home_directory", &r->home_directory); ndr_print_samr_Name(ndr, "home_drive", &r->home_drive); ndr_print_samr_Name(ndr, "logon_script", &r->logon_script); @@ -4392,7 +4392,7 @@ void ndr_print_samr_UserInfo5(struct ndr_print *ndr, const char *name, struct sa ndr_print_samr_Name(ndr, "username", &r->username); ndr_print_samr_Name(ndr, "full_name", &r->full_name); ndr_print_uint32(ndr, "rid", r->rid); - ndr_print_uint32(ndr, "primary_group_rid", r->primary_group_rid); + ndr_print_uint32(ndr, "primary_gid", r->primary_gid); ndr_print_samr_Name(ndr, "home_directory", &r->home_directory); ndr_print_samr_Name(ndr, "home_drive", &r->home_drive); ndr_print_samr_Name(ndr, "logon_script", &r->logon_script); @@ -4445,7 +4445,7 @@ void ndr_print_samr_UserInfo9(struct ndr_print *ndr, const char *name, struct sa { ndr_print_struct(ndr, name, "samr_UserInfo9"); ndr->depth++; - ndr_print_uint32(ndr, "PrimaryGroupRid", r->PrimaryGroupRid); + ndr_print_uint32(ndr, "primary_gid", r->primary_gid); ndr->depth--; } @@ -4545,7 +4545,7 @@ void ndr_print_samr_UserInfo21(struct ndr_print *ndr, const char *name, struct s } ndr->depth--; ndr_print_uint32(ndr, "rid", r->rid); - ndr_print_uint32(ndr, "primary_group_rid", r->primary_group_rid); + ndr_print_uint32(ndr, "primary_gid", r->primary_gid); ndr_print_uint32(ndr, "acct_flags", r->acct_flags); ndr_print_uint32(ndr, "fields_present", r->fields_present); ndr_print_uint32(ndr, "units_per_week", r->units_per_week); diff --git a/source4/librpc/ndr/ndr_samr.h b/source4/librpc/ndr/ndr_samr.h index e148c9b90d..75e7b10401 100644 --- a/source4/librpc/ndr/ndr_samr.h +++ b/source4/librpc/ndr/ndr_samr.h @@ -696,7 +696,7 @@ struct samr_DeleteUser { struct samr_UserInfo1 { struct samr_Name username; struct samr_Name full_name; - uint32 primary_group_rid; + uint32 primary_gid; struct samr_Name description; struct samr_Name comment; }; @@ -712,7 +712,7 @@ struct samr_UserInfo3 { struct samr_Name username; struct samr_Name full_name; uint32 Rid; - uint32 primary_group_rid; + uint32 primary_gid; struct samr_Name home_directory; struct samr_Name home_drive; struct samr_Name logon_script; @@ -739,7 +739,7 @@ struct samr_UserInfo5 { struct samr_Name username; struct samr_Name full_name; uint32 rid; - uint32 primary_group_rid; + uint32 primary_gid; struct samr_Name home_directory; struct samr_Name home_drive; struct samr_Name logon_script; @@ -771,7 +771,7 @@ struct samr_UserInfo8 { }; struct samr_UserInfo9 { - uint32 PrimaryGroupRid; + uint32 primary_gid; }; struct samr_UserInfo10 { @@ -830,7 +830,7 @@ struct samr_UserInfo21 { uint32 buf_count; uint8 *buffer; uint32 rid; - uint32 primary_group_rid; + uint32 primary_gid; uint32 acct_flags; uint32 fields_present; uint32 units_per_week; diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c index 349b78d9cd..49984aeea0 100644 --- a/source4/torture/rpc/samr.c +++ b/source4/torture/rpc/samr.c @@ -83,6 +83,7 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, NTSTATUS status; struct samr_SetUserInfo s; struct samr_QueryUserInfo q; + struct samr_QueryUserInfo q0; union samr_UserInfo u; BOOL ret = True; @@ -90,6 +91,7 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, s.in.info = &u; q.in.handle = handle; q.out.info = &u; + q0 = q; #define TESTCALL(call, r) \ status = dcerpc_samr_ ##call(p, mem_ctx, &r); \ @@ -134,24 +136,26 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, STRING_EQUAL(u.info ## lvl2.field2.name, value, field2); \ } while (0) -#define TEST_USERINFO_INT(lvl1, field1, lvl2, field2) do { \ +#define TEST_USERINFO_INT(lvl1, field1, lvl2, field2, value) do { \ printf("field test %d/%s vs %d/%s\n", lvl1, #field1, lvl2, #field2); \ q.in.level = lvl1; \ TESTCALL(QueryUserInfo, q) \ s.in.level = lvl1; \ u = *q.out.info; \ - u.info ## lvl1.field1 = __LINE__; \ + u.info ## lvl1.field1 = value; \ TESTCALL(SetUserInfo, s) \ u.info ## lvl1.field1 = 0; \ TESTCALL(QueryUserInfo, q); \ u = *q.out.info; \ - INT_EQUAL(u.info ## lvl1.field1, __LINE__, field1); \ + INT_EQUAL(u.info ## lvl1.field1, value, field1); \ q.in.level = lvl2; \ TESTCALL(QueryUserInfo, q) \ u = *q.out.info; \ - INT_EQUAL(u.info ## lvl2.field2, __LINE__, field1); \ + INT_EQUAL(u.info ## lvl2.field2, value, field1); \ } while (0) - + + q0.in.level = 12; + do { TESTCALL(QueryUserInfo, q0) } while (0); TEST_USERINFO_NAME(2, comment, 1, comment, "xx2-1 comment"); TEST_USERINFO_NAME(2, comment, 21, comment, "xx2-21 comment"); @@ -164,16 +168,36 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, TEST_USERINFO_NAME(6, full_name, 21, full_name, "xx6-21 full_name"); TEST_USERINFO_NAME(8, full_name, 21, full_name, "xx7-21 full_name"); + TEST_USERINFO_NAME(11, logon_script, 3, logon_script, "xx11-3 logon_script"); + TEST_USERINFO_NAME(11, logon_script, 5, logon_script, "xx11-5 logon_script"); TEST_USERINFO_NAME(11, logon_script, 21, logon_script, "xx11-21 logon_script"); + + TEST_USERINFO_NAME(12, profile, 3, profile, "xx12-3 profile"); + TEST_USERINFO_NAME(12, profile, 5, profile, "xx12-5 profile"); TEST_USERINFO_NAME(12, profile, 21, profile, "xx12-21 profile"); + + TEST_USERINFO_NAME(13, description, 1, description, "xx13-1 description"); + TEST_USERINFO_NAME(13, description, 5, description, "xx13-5 description"); TEST_USERINFO_NAME(13, description, 21, description, "xx13-21 description"); - TEST_USERINFO_NAME(14, workstations, 21, workstations, "testworkstation"); + + TEST_USERINFO_NAME(14, workstations, 3, workstations, "testworkstation3"); + TEST_USERINFO_NAME(14, workstations, 5, workstations, "testworkstation5"); + TEST_USERINFO_NAME(14, workstations, 21, workstations, "testworkstation21"); + TEST_USERINFO_NAME(20, callback, 21, callback, "xx20-21 callback"); - TEST_USERINFO_INT(2, country_code, 21, country_code); - TEST_USERINFO_INT(2, code_page, 21, code_page); - TEST_USERINFO_INT(4, logon_hours[3], 5, logon_hours[3]); - + TEST_USERINFO_INT(2, country_code, 21, country_code, __LINE__); + TEST_USERINFO_INT(2, code_page, 21, code_page, __LINE__); + + TEST_USERINFO_INT(4, logon_hours[3], 3, logon_hours[3], __LINE__); + TEST_USERINFO_INT(4, logon_hours[3], 5, logon_hours[3], __LINE__); + TEST_USERINFO_INT(4, logon_hours[3], 21, logon_hours[3], __LINE__); + + TEST_USERINFO_INT(9, primary_gid, 1, primary_gid, 513); + TEST_USERINFO_INT(9, primary_gid, 3, primary_gid, 513); + TEST_USERINFO_INT(9, primary_gid, 5, primary_gid, 513); + TEST_USERINFO_INT(9, primary_gid, 21, primary_gid, 513); + return ret; } |