diff options
-rw-r--r-- | source4/librpc/idl/samr.idl | 98 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_samr.c | 551 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_samr.h | 92 | ||||
-rw-r--r-- | source4/torture/rpc/samr.c | 3 |
4 files changed, 736 insertions, 8 deletions
diff --git a/source4/librpc/idl/samr.idl b/source4/librpc/idl/samr.idl index eed1f342a6..894b438a0d 100644 --- a/source4/librpc/idl/samr.idl +++ b/source4/librpc/idl/samr.idl @@ -159,8 +159,8 @@ typedef struct { HYPER_T sequence_num; NTTIME last_xxx_time; - uint32 foo7; - uint32 foo8; + uint32 unknown1; + uint32 unknown2; } samr_DomInfo13; typedef union { @@ -328,8 +328,8 @@ typedef struct { samr_Name comment; - uint32 foo1; - uint32 foo2; + uint32 unknown1; + uint32 unknown2; uint16 country_code; uint16 code_page; } samr_UserInfo2; @@ -356,10 +356,100 @@ uint32 acct_flags; } samr_UserInfo3; + typedef struct { + uint32 units_per_week; + [size_is(1260), length_is(units_per_week/8)] uint8 *logon_hours; + } samr_UserInfo4; + + typedef struct { + samr_Name username; + samr_Name full_name; + uint32 rid; + uint32 primary_group_rid; + samr_Name home_directory; + samr_Name home_drive; + samr_Name logon_script; + samr_Name profile; + samr_Name descriptiom; + samr_Name workstations; + NTTIME last_logon; + NTTIME last_logoff; + uint32 units_per_week; + [size_is(1260), length_is(units_per_week/8)] uint8 *logon_hours; + uint32 unknown; + NTTIME last_pwd_change; + NTTIME acct_expiry; + uint32 acct_flags; + } samr_UserInfo5; + + typedef struct { + samr_Name username; + samr_Name full_name; + } samr_UserInfo6; + + typedef struct { + samr_Name username; + } samr_UserInfo7; + + typedef struct { + samr_Name full_name; + } samr_UserInfo8; + + typedef struct { + uint32 PrimaryGroupRid; + } samr_UserInfo9; + + typedef struct { + samr_Name home_dir; + samr_Name home_drive; + } samr_UserInfo10; + + typedef struct { + samr_Name logon_script; + } samr_UserInfo11; + + typedef struct { + samr_Name profile; + } samr_UserInfo12; + + typedef struct { + samr_Name descriptiom; + } samr_UserInfo13; + + typedef struct { + samr_Name workstations; + } samr_UserInfo14; + + typedef struct { + uint32 acct_flags; + } samr_UserInfo16; + + typedef struct { + NTTIME acct_expiry; + } samr_UserInfo17; + + typedef struct { + samr_Name callback; + } samr_UserInfo20; + typedef union { case(1) samr_UserInfo1 info1; case(2) samr_UserInfo2 info2; case(3) samr_UserInfo3 info3; + case(4) samr_UserInfo4 info4; + case(5) samr_UserInfo5 info5; + case(6) samr_UserInfo6 info6; + case(7) samr_UserInfo7 info7; + case(8) samr_UserInfo8 info8; + case(9) samr_UserInfo9 info9; + case(10) samr_UserInfo10 info10; + case(11) samr_UserInfo11 info11; + case(12) samr_UserInfo12 info12; + case(13) samr_UserInfo13 info13; + case(14) samr_UserInfo14 info14; + case(16) samr_UserInfo16 info16; + case(17) samr_UserInfo17 info17; + case(20) samr_UserInfo20 info20; } samr_UserInfo; NTSTATUS samr_QueryUserInfo( diff --git a/source4/librpc/ndr/ndr_samr.c b/source4/librpc/ndr/ndr_samr.c index e592a65de1..650f76aac9 100644 --- a/source4/librpc/ndr/ndr_samr.c +++ b/source4/librpc/ndr/ndr_samr.c @@ -1193,7 +1193,7 @@ static NTSTATUS ndr_pull_samr_UserInfo3(struct ndr_pull *ndr, int ndr_flags, str NDR_CHECK(ndr_pull_NTTIME(ndr, &r->last_logoff)); NDR_CHECK(ndr_pull_NTTIME(ndr, &r->last_pwd_change)); NDR_CHECK(ndr_pull_NTTIME(ndr, &r->allow_pwd_change)); - NDR_CHECK(ndr_pull_NTTIME(ndr, &r->max_storage)); + NDR_CHECK(ndr_pull_NTTIME(ndr, &r->force_pwd_change)); NDR_CHECK(ndr_pull_uint32(ndr, &r->units_per_week)); NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_logon_hours)); if (_ptr_logon_hours) { @@ -1233,6 +1233,243 @@ done: return NT_STATUS_OK; } +static NTSTATUS ndr_pull_samr_UserInfo4(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo4 *r) +{ + uint32 _ptr_logon_hours; + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->units_per_week)); + NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_logon_hours)); + if (_ptr_logon_hours) { + NDR_ALLOC(ndr, r->logon_hours); + } else { + r->logon_hours = NULL; + } +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; + if (r->logon_hours) { + { + uint32 _array_size; + NDR_CHECK(ndr_pull_uint32(ndr, &_array_size)); + if (1260 > _array_size) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should be %u", _array_size, 1260); + } + } + NDR_ALLOC_N_SIZE(ndr, r->logon_hours, 1260, sizeof(r->logon_hours[0])); + uint32 _offset, _length; + NDR_CHECK(ndr_pull_uint32(ndr, &_offset)); + NDR_CHECK(ndr_pull_uint32(ndr, &_length)); + if (_offset != 0) return ndr_pull_error(ndr, NDR_ERR_OFFSET, "Bad array offset 0x%08x", _offset); + if (_length > 1260 || _length != r->units_per_week/8) return ndr_pull_error(ndr, NDR_ERR_LENGTH, "Bad array length 0x%08x > size 0x%08x", _offset, 1260); + NDR_CHECK(ndr_pull_array_uint8(ndr, r->logon_hours, _length)); + } +done: + return NT_STATUS_OK; +} + +static NTSTATUS ndr_pull_samr_UserInfo5(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo5 *r) +{ + uint32 _ptr_logon_hours; + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + 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->rid)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->primary_group_rid)); + 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)); + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->profile)); + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->descriptiom)); + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->workstations)); + NDR_CHECK(ndr_pull_NTTIME(ndr, &r->last_logon)); + NDR_CHECK(ndr_pull_NTTIME(ndr, &r->last_logoff)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->units_per_week)); + NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_logon_hours)); + if (_ptr_logon_hours) { + NDR_ALLOC(ndr, r->logon_hours); + } else { + r->logon_hours = NULL; + } + NDR_CHECK(ndr_pull_uint32(ndr, &r->foo)); + NDR_CHECK(ndr_pull_NTTIME(ndr, &r->last_pwd_change)); + NDR_CHECK(ndr_pull_NTTIME(ndr, &r->acct_expiry)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->acct_flags)); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->username)); + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->full_name)); + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->home_directory)); + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->home_drive)); + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->logon_script)); + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->profile)); + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->descriptiom)); + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->workstations)); + if (r->logon_hours) { + { + uint32 _array_size; + NDR_CHECK(ndr_pull_uint32(ndr, &_array_size)); + if (1260 > _array_size) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should be %u", _array_size, 1260); + } + } + NDR_ALLOC_N_SIZE(ndr, r->logon_hours, 1260, sizeof(r->logon_hours[0])); + uint32 _offset, _length; + NDR_CHECK(ndr_pull_uint32(ndr, &_offset)); + NDR_CHECK(ndr_pull_uint32(ndr, &_length)); + if (_offset != 0) return ndr_pull_error(ndr, NDR_ERR_OFFSET, "Bad array offset 0x%08x", _offset); + if (_length > 1260 || _length != r->units_per_week/8) return ndr_pull_error(ndr, NDR_ERR_LENGTH, "Bad array length 0x%08x > size 0x%08x", _offset, 1260); + NDR_CHECK(ndr_pull_array_uint8(ndr, r->logon_hours, _length)); + } +done: + return NT_STATUS_OK; +} + +static NTSTATUS ndr_pull_samr_UserInfo6(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo6 *r) +{ + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->userid)); + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->full_name)); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->userid)); + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->full_name)); +done: + return NT_STATUS_OK; +} + +static NTSTATUS ndr_pull_samr_UserInfo7(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo7 *r) +{ + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->userid)); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->userid)); +done: + return NT_STATUS_OK; +} + +static NTSTATUS ndr_pull_samr_UserInfo8(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo8 *r) +{ + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->full_name)); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->full_name)); +done: + return NT_STATUS_OK; +} + +static NTSTATUS ndr_pull_samr_UserInfo9(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo9 *r) +{ + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->PrimaryGroupRid)); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; +done: + return NT_STATUS_OK; +} + +static NTSTATUS ndr_pull_samr_UserInfo10(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo10 *r) +{ + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->home_dir)); + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->home_drive)); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->home_dir)); + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->home_drive)); +done: + return NT_STATUS_OK; +} + +static NTSTATUS ndr_pull_samr_UserInfo11(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo11 *r) +{ + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->logon_script)); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->logon_script)); +done: + return NT_STATUS_OK; +} + +static NTSTATUS ndr_pull_samr_UserInfo12(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo12 *r) +{ + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->profile)); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->profile)); +done: + return NT_STATUS_OK; +} + +static NTSTATUS ndr_pull_samr_UserInfo13(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo13 *r) +{ + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->descriptiom)); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->descriptiom)); +done: + return NT_STATUS_OK; +} + +static NTSTATUS ndr_pull_samr_UserInfo14(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo14 *r) +{ + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->workstations)); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->workstations)); +done: + return NT_STATUS_OK; +} + +static NTSTATUS ndr_pull_samr_UserInfo16(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo16 *r) +{ + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->acct_flags)); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; +done: + return NT_STATUS_OK; +} + +static NTSTATUS ndr_pull_samr_UserInfo17(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo17 *r) +{ + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_NTTIME(ndr, &r->acct_expiry)); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; +done: + return NT_STATUS_OK; +} + +static NTSTATUS ndr_pull_samr_UserInfo20(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo20 *r) +{ + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->callback)); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; + NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->callback)); +done: + return NT_STATUS_OK; +} + static NTSTATUS ndr_pull_samr_UserInfo(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union samr_UserInfo *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -1250,6 +1487,62 @@ static NTSTATUS ndr_pull_samr_UserInfo(struct ndr_pull *ndr, int ndr_flags, uint NDR_CHECK(ndr_pull_samr_UserInfo3(ndr, NDR_SCALARS, &r->info3)); break; } + case 4: { + NDR_CHECK(ndr_pull_samr_UserInfo4(ndr, NDR_SCALARS, &r->info4)); + break; } + + case 5: { + NDR_CHECK(ndr_pull_samr_UserInfo5(ndr, NDR_SCALARS, &r->info5)); + break; } + + case 6: { + NDR_CHECK(ndr_pull_samr_UserInfo6(ndr, NDR_SCALARS, &r->info6)); + break; } + + case 7: { + NDR_CHECK(ndr_pull_samr_UserInfo7(ndr, NDR_SCALARS, &r->info7)); + break; } + + case 8: { + NDR_CHECK(ndr_pull_samr_UserInfo8(ndr, NDR_SCALARS, &r->info8)); + break; } + + case 9: { + NDR_CHECK(ndr_pull_samr_UserInfo9(ndr, NDR_SCALARS, &r->info9)); + break; } + + case 10: { + NDR_CHECK(ndr_pull_samr_UserInfo10(ndr, NDR_SCALARS, &r->info10)); + break; } + + case 11: { + NDR_CHECK(ndr_pull_samr_UserInfo11(ndr, NDR_SCALARS, &r->info11)); + break; } + + case 12: { + NDR_CHECK(ndr_pull_samr_UserInfo12(ndr, NDR_SCALARS, &r->info12)); + break; } + + case 13: { + NDR_CHECK(ndr_pull_samr_UserInfo13(ndr, NDR_SCALARS, &r->info13)); + break; } + + case 14: { + NDR_CHECK(ndr_pull_samr_UserInfo14(ndr, NDR_SCALARS, &r->info14)); + break; } + + case 16: { + NDR_CHECK(ndr_pull_samr_UserInfo16(ndr, NDR_SCALARS, &r->info16)); + break; } + + case 17: { + NDR_CHECK(ndr_pull_samr_UserInfo17(ndr, NDR_SCALARS, &r->info17)); + break; } + + case 20: { + NDR_CHECK(ndr_pull_samr_UserInfo20(ndr, NDR_SCALARS, &r->info20)); + break; } + default: return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level); } @@ -1268,6 +1561,62 @@ buffers: NDR_CHECK(ndr_pull_samr_UserInfo3(ndr, NDR_BUFFERS, &r->info3)); break; + case 4: + NDR_CHECK(ndr_pull_samr_UserInfo4(ndr, NDR_BUFFERS, &r->info4)); + break; + + case 5: + NDR_CHECK(ndr_pull_samr_UserInfo5(ndr, NDR_BUFFERS, &r->info5)); + break; + + case 6: + NDR_CHECK(ndr_pull_samr_UserInfo6(ndr, NDR_BUFFERS, &r->info6)); + break; + + case 7: + NDR_CHECK(ndr_pull_samr_UserInfo7(ndr, NDR_BUFFERS, &r->info7)); + break; + + case 8: + NDR_CHECK(ndr_pull_samr_UserInfo8(ndr, NDR_BUFFERS, &r->info8)); + break; + + case 9: + NDR_CHECK(ndr_pull_samr_UserInfo9(ndr, NDR_BUFFERS, &r->info9)); + break; + + case 10: + NDR_CHECK(ndr_pull_samr_UserInfo10(ndr, NDR_BUFFERS, &r->info10)); + break; + + case 11: + NDR_CHECK(ndr_pull_samr_UserInfo11(ndr, NDR_BUFFERS, &r->info11)); + break; + + case 12: + NDR_CHECK(ndr_pull_samr_UserInfo12(ndr, NDR_BUFFERS, &r->info12)); + break; + + case 13: + NDR_CHECK(ndr_pull_samr_UserInfo13(ndr, NDR_BUFFERS, &r->info13)); + break; + + case 14: + NDR_CHECK(ndr_pull_samr_UserInfo14(ndr, NDR_BUFFERS, &r->info14)); + break; + + case 16: + NDR_CHECK(ndr_pull_samr_UserInfo16(ndr, NDR_BUFFERS, &r->info16)); + break; + + case 17: + NDR_CHECK(ndr_pull_samr_UserInfo17(ndr, NDR_BUFFERS, &r->info17)); + break; + + case 20: + NDR_CHECK(ndr_pull_samr_UserInfo20(ndr, NDR_BUFFERS, &r->info20)); + break; + default: return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level); } @@ -1778,7 +2127,7 @@ void ndr_print_samr_UserInfo3(struct ndr_print *ndr, const char *name, struct sa ndr_print_NTTIME(ndr, "last_logoff", r->last_logoff); ndr_print_NTTIME(ndr, "last_pwd_change", r->last_pwd_change); ndr_print_NTTIME(ndr, "allow_pwd_change", r->allow_pwd_change); - ndr_print_NTTIME(ndr, "max_storage", r->max_storage); + ndr_print_NTTIME(ndr, "force_pwd_change", r->force_pwd_change); ndr_print_uint32(ndr, "units_per_week", r->units_per_week); ndr_print_ptr(ndr, "logon_hours", r->logon_hours); ndr->depth++; @@ -1792,6 +2141,148 @@ void ndr_print_samr_UserInfo3(struct ndr_print *ndr, const char *name, struct sa ndr->depth--; } +void ndr_print_samr_UserInfo4(struct ndr_print *ndr, const char *name, struct samr_UserInfo4 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo4"); + ndr->depth++; + ndr_print_uint32(ndr, "units_per_week", r->units_per_week); + ndr_print_ptr(ndr, "logon_hours", r->logon_hours); + ndr->depth++; + if (r->logon_hours) { + ndr_print_array_uint8(ndr, "logon_hours", r->logon_hours, r->units_per_week/8); + } + ndr->depth--; + ndr->depth--; +} + +void ndr_print_samr_UserInfo5(struct ndr_print *ndr, const char *name, struct samr_UserInfo5 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo5"); + ndr->depth++; + 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_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); + ndr_print_samr_Name(ndr, "profile", &r->profile); + ndr_print_samr_Name(ndr, "descriptiom", &r->descriptiom); + ndr_print_samr_Name(ndr, "workstations", &r->workstations); + ndr_print_NTTIME(ndr, "last_logon", r->last_logon); + ndr_print_NTTIME(ndr, "last_logoff", r->last_logoff); + ndr_print_uint32(ndr, "units_per_week", r->units_per_week); + ndr_print_ptr(ndr, "logon_hours", r->logon_hours); + ndr->depth++; + if (r->logon_hours) { + ndr_print_array_uint8(ndr, "logon_hours", r->logon_hours, r->units_per_week/8); + } + ndr->depth--; + ndr_print_uint32(ndr, "foo", r->foo); + ndr_print_NTTIME(ndr, "last_pwd_change", r->last_pwd_change); + ndr_print_NTTIME(ndr, "acct_expiry", r->acct_expiry); + ndr_print_uint32(ndr, "acct_flags", r->acct_flags); + ndr->depth--; +} + +void ndr_print_samr_UserInfo6(struct ndr_print *ndr, const char *name, struct samr_UserInfo6 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo6"); + ndr->depth++; + ndr_print_samr_Name(ndr, "userid", &r->userid); + ndr_print_samr_Name(ndr, "full_name", &r->full_name); + ndr->depth--; +} + +void ndr_print_samr_UserInfo7(struct ndr_print *ndr, const char *name, struct samr_UserInfo7 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo7"); + ndr->depth++; + ndr_print_samr_Name(ndr, "userid", &r->userid); + ndr->depth--; +} + +void ndr_print_samr_UserInfo8(struct ndr_print *ndr, const char *name, struct samr_UserInfo8 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo8"); + ndr->depth++; + ndr_print_samr_Name(ndr, "full_name", &r->full_name); + ndr->depth--; +} + +void ndr_print_samr_UserInfo9(struct ndr_print *ndr, const char *name, struct samr_UserInfo9 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo9"); + ndr->depth++; + ndr_print_uint32(ndr, "PrimaryGroupRid", r->PrimaryGroupRid); + ndr->depth--; +} + +void ndr_print_samr_UserInfo10(struct ndr_print *ndr, const char *name, struct samr_UserInfo10 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo10"); + ndr->depth++; + ndr_print_samr_Name(ndr, "home_dir", &r->home_dir); + ndr_print_samr_Name(ndr, "home_drive", &r->home_drive); + ndr->depth--; +} + +void ndr_print_samr_UserInfo11(struct ndr_print *ndr, const char *name, struct samr_UserInfo11 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo11"); + ndr->depth++; + ndr_print_samr_Name(ndr, "logon_script", &r->logon_script); + ndr->depth--; +} + +void ndr_print_samr_UserInfo12(struct ndr_print *ndr, const char *name, struct samr_UserInfo12 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo12"); + ndr->depth++; + ndr_print_samr_Name(ndr, "profile", &r->profile); + ndr->depth--; +} + +void ndr_print_samr_UserInfo13(struct ndr_print *ndr, const char *name, struct samr_UserInfo13 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo13"); + ndr->depth++; + ndr_print_samr_Name(ndr, "descriptiom", &r->descriptiom); + ndr->depth--; +} + +void ndr_print_samr_UserInfo14(struct ndr_print *ndr, const char *name, struct samr_UserInfo14 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo14"); + ndr->depth++; + ndr_print_samr_Name(ndr, "workstations", &r->workstations); + ndr->depth--; +} + +void ndr_print_samr_UserInfo16(struct ndr_print *ndr, const char *name, struct samr_UserInfo16 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo16"); + ndr->depth++; + ndr_print_uint32(ndr, "acct_flags", r->acct_flags); + ndr->depth--; +} + +void ndr_print_samr_UserInfo17(struct ndr_print *ndr, const char *name, struct samr_UserInfo17 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo17"); + ndr->depth++; + ndr_print_NTTIME(ndr, "acct_expiry", r->acct_expiry); + ndr->depth--; +} + +void ndr_print_samr_UserInfo20(struct ndr_print *ndr, const char *name, struct samr_UserInfo20 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo20"); + ndr->depth++; + ndr_print_samr_Name(ndr, "callback", &r->callback); + ndr->depth--; +} + void ndr_print_samr_UserInfo(struct ndr_print *ndr, const char *name, uint16 level, union samr_UserInfo *r) { ndr_print_union(ndr, name, level, "samr_UserInfo"); @@ -1808,6 +2299,62 @@ void ndr_print_samr_UserInfo(struct ndr_print *ndr, const char *name, uint16 lev ndr_print_samr_UserInfo3(ndr, "info3", &r->info3); break; + case 4: + ndr_print_samr_UserInfo4(ndr, "info4", &r->info4); + break; + + case 5: + ndr_print_samr_UserInfo5(ndr, "info5", &r->info5); + break; + + case 6: + ndr_print_samr_UserInfo6(ndr, "info6", &r->info6); + break; + + case 7: + ndr_print_samr_UserInfo7(ndr, "info7", &r->info7); + break; + + case 8: + ndr_print_samr_UserInfo8(ndr, "info8", &r->info8); + break; + + case 9: + ndr_print_samr_UserInfo9(ndr, "info9", &r->info9); + break; + + case 10: + ndr_print_samr_UserInfo10(ndr, "info10", &r->info10); + break; + + case 11: + ndr_print_samr_UserInfo11(ndr, "info11", &r->info11); + break; + + case 12: + ndr_print_samr_UserInfo12(ndr, "info12", &r->info12); + break; + + case 13: + ndr_print_samr_UserInfo13(ndr, "info13", &r->info13); + break; + + case 14: + ndr_print_samr_UserInfo14(ndr, "info14", &r->info14); + break; + + case 16: + ndr_print_samr_UserInfo16(ndr, "info16", &r->info16); + break; + + case 17: + ndr_print_samr_UserInfo17(ndr, "info17", &r->info17); + break; + + case 20: + ndr_print_samr_UserInfo20(ndr, "info20", &r->info20); + break; + default: ndr_print_bad_level(ndr, name, level); } diff --git a/source4/librpc/ndr/ndr_samr.h b/source4/librpc/ndr/ndr_samr.h index 49103078fe..76fe643ccb 100644 --- a/source4/librpc/ndr/ndr_samr.h +++ b/source4/librpc/ndr/ndr_samr.h @@ -544,7 +544,7 @@ struct samr_UserInfo3 { NTTIME last_logoff; NTTIME last_pwd_change; NTTIME allow_pwd_change; - NTTIME max_storage; + NTTIME force_pwd_change; uint32 units_per_week; uint8 *logon_hours; uint16 bad_pwd_count; @@ -552,10 +552,100 @@ struct samr_UserInfo3 { uint32 acct_flags; }; +struct samr_UserInfo4 { + uint32 units_per_week; + uint8 *logon_hours; +}; + +struct samr_UserInfo5 { + struct samr_Name username; + struct samr_Name full_name; + uint32 rid; + uint32 primary_group_rid; + struct samr_Name home_directory; + struct samr_Name home_drive; + struct samr_Name logon_script; + struct samr_Name profile; + struct samr_Name descriptiom; + struct samr_Name workstations; + NTTIME last_logon; + NTTIME last_logoff; + uint32 units_per_week; + uint8 *logon_hours; + uint32 foo; + NTTIME last_pwd_change; + NTTIME acct_expiry; + uint32 acct_flags; +}; + +struct samr_UserInfo6 { + struct samr_Name userid; + struct samr_Name full_name; +}; + +struct samr_UserInfo7 { + struct samr_Name userid; +}; + +struct samr_UserInfo8 { + struct samr_Name full_name; +}; + +struct samr_UserInfo9 { + uint32 PrimaryGroupRid; +}; + +struct samr_UserInfo10 { + struct samr_Name home_dir; + struct samr_Name home_drive; +}; + +struct samr_UserInfo11 { + struct samr_Name logon_script; +}; + +struct samr_UserInfo12 { + struct samr_Name profile; +}; + +struct samr_UserInfo13 { + struct samr_Name descriptiom; +}; + +struct samr_UserInfo14 { + struct samr_Name workstations; +}; + +struct samr_UserInfo16 { + uint32 acct_flags; +}; + +struct samr_UserInfo17 { + NTTIME acct_expiry; +}; + +struct samr_UserInfo20 { + struct samr_Name callback; +}; + union samr_UserInfo { /* [case(1)] */ struct samr_UserInfo1 info1; /* [case(2)] */ struct samr_UserInfo2 info2; /* [case(3)] */ struct samr_UserInfo3 info3; +/* [case(4)] */ struct samr_UserInfo4 info4; +/* [case(5)] */ struct samr_UserInfo5 info5; +/* [case(6)] */ struct samr_UserInfo6 info6; +/* [case(7)] */ struct samr_UserInfo7 info7; +/* [case(8)] */ struct samr_UserInfo8 info8; +/* [case(9)] */ struct samr_UserInfo9 info9; +/* [case(10)] */ struct samr_UserInfo10 info10; +/* [case(11)] */ struct samr_UserInfo11 info11; +/* [case(12)] */ struct samr_UserInfo12 info12; +/* [case(13)] */ struct samr_UserInfo13 info13; +/* [case(14)] */ struct samr_UserInfo14 info14; +/* [case(16)] */ struct samr_UserInfo16 info16; +/* [case(17)] */ struct samr_UserInfo17 info17; +/* [case(20)] */ struct samr_UserInfo20 info20; }; struct samr_QueryUserInfo { diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c index 8cafb4a2f5..98eba59c72 100644 --- a/source4/torture/rpc/samr.c +++ b/source4/torture/rpc/samr.c @@ -26,7 +26,8 @@ static BOOL test_QueryUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, { NTSTATUS status; struct samr_QueryUserInfo r; - uint16 levels[] = {1, 2, 3}; + uint16 levels[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 16, 17, 20}; int i; BOOL ret = True; |