summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/librpc/idl/samr.idl11
-rw-r--r--source4/librpc/ndr/ndr_samr.c587
-rw-r--r--source4/librpc/ndr/ndr_samr.h11
-rw-r--r--source4/librpc/ndr/ndr_spoolss.c14
-rw-r--r--source4/librpc/ndr/ndr_srvsvc.c14
-rw-r--r--source4/librpc/ndr/ndr_srvsvc.h5
-rw-r--r--source4/librpc/rpc/rpc_samr.c12
-rw-r--r--source4/torture/rpc/samr.c85
8 files changed, 686 insertions, 53 deletions
diff --git a/source4/librpc/idl/samr.idl b/source4/librpc/idl/samr.idl
index 8092e64d5b..219745513c 100644
--- a/source4/librpc/idl/samr.idl
+++ b/source4/librpc/idl/samr.idl
@@ -499,7 +499,7 @@
samr_Name home_drive;
samr_Name logon_script;
samr_Name profile;
- samr_Name descriptiom;
+ samr_Name description;
samr_Name workstations;
NTTIME last_logon;
NTTIME last_logoff;
@@ -543,7 +543,7 @@
} samr_UserInfo12;
typedef struct {
- samr_Name descriptiom;
+ samr_Name description;
} samr_UserInfo13;
typedef struct {
@@ -627,9 +627,14 @@
[out,switch_is(level)] samr_UserInfo *info
);
+
/************************/
/* Function 0x25 */
- NTSTATUS samr_SET_USERINFO();
+ NTSTATUS samr_SetUserInfo(
+ [in,ref] policy_handle *handle,
+ [in] uint16 level,
+ [in,ref,switch_is(level)] samr_UserInfo *info
+ );
/************************/
/* Function 0x26 */
diff --git a/source4/librpc/ndr/ndr_samr.c b/source4/librpc/ndr/ndr_samr.c
index a39c4a6aa8..42ce47f8db 100644
--- a/source4/librpc/ndr/ndr_samr.c
+++ b/source4/librpc/ndr/ndr_samr.c
@@ -320,6 +320,556 @@ NTSTATUS ndr_push_samr_DeleteUser(struct ndr_push *ndr, struct samr_DeleteUser *
return NT_STATUS_OK;
}
+NTSTATUS ndr_push_samr_UserInfo1(struct ndr_push *ndr, int ndr_flags, struct samr_UserInfo1 *r)
+{
+ 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_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_samr_Name(ndr, NDR_SCALARS, &r->description));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->comment));
+ ndr_push_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->username));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->full_name));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->description));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->comment));
+done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_push_samr_UserInfo2(struct ndr_push *ndr, int ndr_flags, struct samr_UserInfo2 *r)
+{
+ 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_samr_Name(ndr, NDR_SCALARS, &r->comment));
+ NDR_CHECK(ndr_push_uint32(ndr, r->unknown1));
+ NDR_CHECK(ndr_push_uint32(ndr, r->unknown2));
+ NDR_CHECK(ndr_push_uint16(ndr, r->country_code));
+ NDR_CHECK(ndr_push_uint16(ndr, r->code_page));
+ ndr_push_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->comment));
+done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_push_samr_UserInfo3(struct ndr_push *ndr, int ndr_flags, struct samr_UserInfo3 *r)
+{
+ 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_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_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));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->profile));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->workstations));
+ NDR_CHECK(ndr_push_NTTIME(ndr, r->last_logon));
+ NDR_CHECK(ndr_push_NTTIME(ndr, r->last_logoff));
+ NDR_CHECK(ndr_push_NTTIME(ndr, r->last_pwd_change));
+ NDR_CHECK(ndr_push_NTTIME(ndr, r->allow_pwd_change));
+ NDR_CHECK(ndr_push_NTTIME(ndr, r->force_pwd_change));
+ NDR_CHECK(ndr_push_uint32(ndr, r->units_per_week));
+ NDR_CHECK(ndr_push_ptr(ndr, r->logon_hours));
+ NDR_CHECK(ndr_push_uint16(ndr, r->bad_pwd_count));
+ NDR_CHECK(ndr_push_uint16(ndr, r->num_logons));
+ NDR_CHECK(ndr_push_uint32(ndr, r->acct_flags));
+ ndr_push_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->username));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->full_name));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->home_directory));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->home_drive));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->logon_script));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->profile));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->workstations));
+ if (r->logon_hours) {
+ NDR_CHECK(ndr_push_uint32(ndr, 1260));
+ NDR_CHECK(ndr_push_uint32(ndr, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, r->units_per_week/8));
+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS|NDR_BUFFERS, r->logon_hours, r->units_per_week/8));
+ }
+done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_push_samr_UserInfo4(struct ndr_push *ndr, int ndr_flags, struct samr_UserInfo4 *r)
+{
+ 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->units_per_week));
+ NDR_CHECK(ndr_push_ptr(ndr, r->logon_hours));
+ ndr_push_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ if (r->logon_hours) {
+ NDR_CHECK(ndr_push_uint32(ndr, 1260));
+ NDR_CHECK(ndr_push_uint32(ndr, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, r->units_per_week/8));
+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS|NDR_BUFFERS, r->logon_hours, r->units_per_week/8));
+ }
+done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_push_samr_UserInfo5(struct ndr_push *ndr, int ndr_flags, struct samr_UserInfo5 *r)
+{
+ 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_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_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));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->profile));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->description));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->workstations));
+ NDR_CHECK(ndr_push_NTTIME(ndr, r->last_logon));
+ NDR_CHECK(ndr_push_NTTIME(ndr, r->last_logoff));
+ NDR_CHECK(ndr_push_uint32(ndr, r->units_per_week));
+ NDR_CHECK(ndr_push_ptr(ndr, r->logon_hours));
+ NDR_CHECK(ndr_push_uint16(ndr, r->bad_pwd_count));
+ NDR_CHECK(ndr_push_uint16(ndr, r->num_logons));
+ NDR_CHECK(ndr_push_NTTIME(ndr, r->last_pwd_change));
+ NDR_CHECK(ndr_push_NTTIME(ndr, r->acct_expiry));
+ NDR_CHECK(ndr_push_uint32(ndr, r->acct_flags));
+ ndr_push_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->username));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->full_name));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->home_directory));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->home_drive));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->logon_script));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->profile));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->description));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->workstations));
+ if (r->logon_hours) {
+ NDR_CHECK(ndr_push_uint32(ndr, 1260));
+ NDR_CHECK(ndr_push_uint32(ndr, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, r->units_per_week/8));
+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS|NDR_BUFFERS, r->logon_hours, r->units_per_week/8));
+ }
+done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_push_samr_UserInfo6(struct ndr_push *ndr, int ndr_flags, struct samr_UserInfo6 *r)
+{
+ 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_samr_Name(ndr, NDR_SCALARS, &r->username));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->full_name));
+ ndr_push_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->username));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->full_name));
+done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_push_samr_UserInfo7(struct ndr_push *ndr, int ndr_flags, struct samr_UserInfo7 *r)
+{
+ 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_samr_Name(ndr, NDR_SCALARS, &r->username));
+ ndr_push_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->username));
+done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_push_samr_UserInfo8(struct ndr_push *ndr, int ndr_flags, struct samr_UserInfo8 *r)
+{
+ 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_samr_Name(ndr, NDR_SCALARS, &r->full_name));
+ ndr_push_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->full_name));
+done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_push_samr_UserInfo9(struct ndr_push *ndr, int ndr_flags, struct samr_UserInfo9 *r)
+{
+ 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_push_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_push_samr_UserInfo10(struct ndr_push *ndr, int ndr_flags, struct samr_UserInfo10 *r)
+{
+ 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_samr_Name(ndr, NDR_SCALARS, &r->home_dir));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->home_drive));
+ ndr_push_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->home_dir));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->home_drive));
+done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_push_samr_UserInfo11(struct ndr_push *ndr, int ndr_flags, struct samr_UserInfo11 *r)
+{
+ 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_samr_Name(ndr, NDR_SCALARS, &r->logon_script));
+ ndr_push_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->logon_script));
+done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_push_samr_UserInfo12(struct ndr_push *ndr, int ndr_flags, struct samr_UserInfo12 *r)
+{
+ 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_samr_Name(ndr, NDR_SCALARS, &r->profile));
+ ndr_push_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->profile));
+done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_push_samr_UserInfo13(struct ndr_push *ndr, int ndr_flags, struct samr_UserInfo13 *r)
+{
+ 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_samr_Name(ndr, NDR_SCALARS, &r->description));
+ ndr_push_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->description));
+done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_push_samr_UserInfo14(struct ndr_push *ndr, int ndr_flags, struct samr_UserInfo14 *r)
+{
+ 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_samr_Name(ndr, NDR_SCALARS, &r->workstations));
+ ndr_push_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->workstations));
+done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_push_samr_UserInfo16(struct ndr_push *ndr, int ndr_flags, struct samr_UserInfo16 *r)
+{
+ 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->acct_flags));
+ ndr_push_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_push_samr_UserInfo17(struct ndr_push *ndr, int ndr_flags, struct samr_UserInfo17 *r)
+{
+ 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_NTTIME(ndr, r->acct_expiry));
+ ndr_push_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_push_samr_UserInfo20(struct ndr_push *ndr, int ndr_flags, struct samr_UserInfo20 *r)
+{
+ 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_samr_Name(ndr, NDR_SCALARS, &r->callback));
+ ndr_push_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->callback));
+done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_push_samr_UserInfo21(struct ndr_push *ndr, int ndr_flags, struct samr_UserInfo21 *r)
+{
+ 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_NTTIME(ndr, r->last_logon));
+ NDR_CHECK(ndr_push_NTTIME(ndr, r->last_logoff));
+ NDR_CHECK(ndr_push_NTTIME(ndr, r->last_pwd_change));
+ NDR_CHECK(ndr_push_NTTIME(ndr, r->acct_expiry));
+ NDR_CHECK(ndr_push_NTTIME(ndr, r->allow_pwd_change));
+ NDR_CHECK(ndr_push_NTTIME(ndr, r->force_pwd_change));
+ 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_samr_Name(ndr, NDR_SCALARS, &r->home_dir));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->home_drive));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->logon_script));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->profile));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->description));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->workstations));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->comment));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->callback));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->unknown1));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->unknown2));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_SCALARS, &r->unknown3));
+ 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->acct_flags));
+ NDR_CHECK(ndr_push_uint32(ndr, r->fields_present));
+ NDR_CHECK(ndr_push_uint32(ndr, r->units_per_week));
+ NDR_CHECK(ndr_push_ptr(ndr, r->logon_hours));
+ NDR_CHECK(ndr_push_uint16(ndr, r->bad_pwd_count));
+ NDR_CHECK(ndr_push_uint16(ndr, r->num_logons));
+ NDR_CHECK(ndr_push_uint16(ndr, r->country_code));
+ NDR_CHECK(ndr_push_uint16(ndr, r->code_page));
+ NDR_CHECK(ndr_push_uint8(ndr, r->nt_pwd_set));
+ NDR_CHECK(ndr_push_uint8(ndr, r->lm_pwd_set));
+ NDR_CHECK(ndr_push_uint8(ndr, r->expired_flag));
+ NDR_CHECK(ndr_push_uint8(ndr, r->unknown4));
+ ndr_push_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->username));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->full_name));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->home_dir));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->home_drive));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->logon_script));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->profile));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->description));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->workstations));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->comment));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->callback));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->unknown1));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->unknown2));
+ NDR_CHECK(ndr_push_samr_Name(ndr, NDR_BUFFERS, &r->unknown3));
+ if (r->buffer) {
+ NDR_CHECK(ndr_push_uint32(ndr, r->buf_count));
+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS|NDR_BUFFERS, r->buffer, r->buf_count));
+ }
+ if (r->logon_hours) {
+ NDR_CHECK(ndr_push_uint32(ndr, 1260));
+ NDR_CHECK(ndr_push_uint32(ndr, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, r->units_per_week/8));
+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS|NDR_BUFFERS, r->logon_hours, r->units_per_week/8));
+ }
+done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_push_samr_UserInfo(struct ndr_push *ndr, int ndr_flags, uint16 level, union samr_UserInfo *r)
+{
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_push_struct_start(ndr));
+ switch (level) {
+ case 1:
+ NDR_CHECK(ndr_push_samr_UserInfo1(ndr, NDR_SCALARS, &r->info1));
+ break;
+
+ case 2:
+ NDR_CHECK(ndr_push_samr_UserInfo2(ndr, NDR_SCALARS, &r->info2));
+ break;
+
+ case 3:
+ NDR_CHECK(ndr_push_samr_UserInfo3(ndr, NDR_SCALARS, &r->info3));
+ break;
+
+ case 4:
+ NDR_CHECK(ndr_push_samr_UserInfo4(ndr, NDR_SCALARS, &r->info4));
+ break;
+
+ case 5:
+ NDR_CHECK(ndr_push_samr_UserInfo5(ndr, NDR_SCALARS, &r->info5));
+ break;
+
+ case 6:
+ NDR_CHECK(ndr_push_samr_UserInfo6(ndr, NDR_SCALARS, &r->info6));
+ break;
+
+ case 7:
+ NDR_CHECK(ndr_push_samr_UserInfo7(ndr, NDR_SCALARS, &r->info7));
+ break;
+
+ case 8:
+ NDR_CHECK(ndr_push_samr_UserInfo8(ndr, NDR_SCALARS, &r->info8));
+ break;
+
+ case 9:
+ NDR_CHECK(ndr_push_samr_UserInfo9(ndr, NDR_SCALARS, &r->info9));
+ break;
+
+ case 10:
+ NDR_CHECK(ndr_push_samr_UserInfo10(ndr, NDR_SCALARS, &r->info10));
+ break;
+
+ case 11:
+ NDR_CHECK(ndr_push_samr_UserInfo11(ndr, NDR_SCALARS, &r->info11));
+ break;
+
+ case 12:
+ NDR_CHECK(ndr_push_samr_UserInfo12(ndr, NDR_SCALARS, &r->info12));
+ break;
+
+ case 13:
+ NDR_CHECK(ndr_push_samr_UserInfo13(ndr, NDR_SCALARS, &r->info13));
+ break;
+
+ case 14:
+ NDR_CHECK(ndr_push_samr_UserInfo14(ndr, NDR_SCALARS, &r->info14));
+ break;
+
+ case 16:
+ NDR_CHECK(ndr_push_samr_UserInfo16(ndr, NDR_SCALARS, &r->info16));
+ break;
+
+ case 17:
+ NDR_CHECK(ndr_push_samr_UserInfo17(ndr, NDR_SCALARS, &r->info17));
+ break;
+
+ case 20:
+ NDR_CHECK(ndr_push_samr_UserInfo20(ndr, NDR_SCALARS, &r->info20));
+ break;
+
+ case 21:
+ NDR_CHECK(ndr_push_samr_UserInfo21(ndr, NDR_SCALARS, &r->info21));
+ break;
+
+ default:
+ return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ ndr_push_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ switch (level) {
+ case 1:
+ NDR_CHECK(ndr_push_samr_UserInfo1(ndr, NDR_BUFFERS, &r->info1));
+ break;
+
+ case 2:
+ NDR_CHECK(ndr_push_samr_UserInfo2(ndr, NDR_BUFFERS, &r->info2));
+ break;
+
+ case 3:
+ NDR_CHECK(ndr_push_samr_UserInfo3(ndr, NDR_BUFFERS, &r->info3));
+ break;
+
+ case 4:
+ NDR_CHECK(ndr_push_samr_UserInfo4(ndr, NDR_BUFFERS, &r->info4));
+ break;
+
+ case 5:
+ NDR_CHECK(ndr_push_samr_UserInfo5(ndr, NDR_BUFFERS, &r->info5));
+ break;
+
+ case 6:
+ NDR_CHECK(ndr_push_samr_UserInfo6(ndr, NDR_BUFFERS, &r->info6));
+ break;
+
+ case 7:
+ NDR_CHECK(ndr_push_samr_UserInfo7(ndr, NDR_BUFFERS, &r->info7));
+ break;
+
+ case 8:
+ NDR_CHECK(ndr_push_samr_UserInfo8(ndr, NDR_BUFFERS, &r->info8));
+ break;
+
+ case 9:
+ NDR_CHECK(ndr_push_samr_UserInfo9(ndr, NDR_BUFFERS, &r->info9));
+ break;
+
+ case 10:
+ NDR_CHECK(ndr_push_samr_UserInfo10(ndr, NDR_BUFFERS, &r->info10));
+ break;
+
+ case 11:
+ NDR_CHECK(ndr_push_samr_UserInfo11(ndr, NDR_BUFFERS, &r->info11));
+ break;
+
+ case 12:
+ NDR_CHECK(ndr_push_samr_UserInfo12(ndr, NDR_BUFFERS, &r->info12));
+ break;
+
+ case 13:
+ NDR_CHECK(ndr_push_samr_UserInfo13(ndr, NDR_BUFFERS, &r->info13));
+ break;
+
+ case 14:
+ NDR_CHECK(ndr_push_samr_UserInfo14(ndr, NDR_BUFFERS, &r->info14));
+ break;
+
+ case 16:
+ NDR_CHECK(ndr_push_samr_UserInfo16(ndr, NDR_BUFFERS, &r->info16));
+ break;
+
+ case 17:
+ NDR_CHECK(ndr_push_samr_UserInfo17(ndr, NDR_BUFFERS, &r->info17));
+ break;
+
+ case 20:
+ NDR_CHECK(ndr_push_samr_UserInfo20(ndr, NDR_BUFFERS, &r->info20));
+ break;
+
+ case 21:
+ NDR_CHECK(ndr_push_samr_UserInfo21(ndr, NDR_BUFFERS, &r->info21));
+ break;
+
+ default:
+ return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+done:
+ return NT_STATUS_OK;
+}
+
NTSTATUS ndr_push_samr_QueryUserInfo(struct ndr_push *ndr, struct samr_QueryUserInfo *r)
{
NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle));
@@ -328,8 +878,12 @@ NTSTATUS ndr_push_samr_QueryUserInfo(struct ndr_push *ndr, struct samr_QueryUser
return NT_STATUS_OK;
}
-NTSTATUS ndr_push_samr_SET_USERINFO(struct ndr_push *ndr, struct samr_SET_USERINFO *r)
+NTSTATUS ndr_push_samr_SetUserInfo(struct ndr_push *ndr, struct samr_SetUserInfo *r)
{
+ NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle));
+ NDR_CHECK(ndr_push_uint16(ndr, r->in.level));
+ NDR_CHECK(ndr_push_uint16(ndr, r->in.level));
+ NDR_CHECK(ndr_push_samr_UserInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.level, r->in.info));
return NT_STATUS_OK;
}
@@ -1723,7 +2277,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->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->description));
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));
@@ -1748,7 +2302,7 @@ buffers:
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->description));
NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->workstations));
if (r->logon_hours) {
{
@@ -1876,11 +2430,11 @@ NTSTATUS ndr_pull_samr_UserInfo13(struct ndr_pull *ndr, int ndr_flags, struct sa
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_samr_Name(ndr, NDR_SCALARS, &r->descriptiom));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->description));
ndr_pull_struct_end(ndr);
buffers:
if (!(ndr_flags & NDR_BUFFERS)) goto done;
- NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->descriptiom));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->description));
done:
return NT_STATUS_OK;
}
@@ -2223,7 +2777,7 @@ NTSTATUS ndr_pull_samr_QueryUserInfo(struct ndr_pull *ndr, struct samr_QueryUser
return NT_STATUS_OK;
}
-NTSTATUS ndr_pull_samr_SET_USERINFO(struct ndr_pull *ndr, struct samr_SET_USERINFO *r)
+NTSTATUS ndr_pull_samr_SetUserInfo(struct ndr_pull *ndr, struct samr_SetUserInfo *r)
{
NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result));
@@ -3824,7 +4378,7 @@ void ndr_print_samr_UserInfo5(struct ndr_print *ndr, const char *name, struct sa
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, "description", &r->description);
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);
@@ -3905,7 +4459,7 @@ void ndr_print_samr_UserInfo13(struct ndr_print *ndr, const char *name, struct s
{
ndr_print_struct(ndr, name, "samr_UserInfo13");
ndr->depth++;
- ndr_print_samr_Name(ndr, "descriptiom", &r->descriptiom);
+ ndr_print_samr_Name(ndr, "description", &r->description);
ndr->depth--;
}
@@ -4103,17 +4657,26 @@ void ndr_print_samr_QueryUserInfo(struct ndr_print *ndr, const char *name, int f
ndr->depth--;
}
-void ndr_print_samr_SET_USERINFO(struct ndr_print *ndr, const char *name, int flags, struct samr_SET_USERINFO *r)
+void ndr_print_samr_SetUserInfo(struct ndr_print *ndr, const char *name, int flags, struct samr_SetUserInfo *r)
{
- ndr_print_struct(ndr, name, "samr_SET_USERINFO");
+ ndr_print_struct(ndr, name, "samr_SetUserInfo");
ndr->depth++;
if (flags & NDR_IN) {
- ndr_print_struct(ndr, "in", "samr_SET_USERINFO");
+ ndr_print_struct(ndr, "in", "samr_SetUserInfo");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "handle", r->in.handle);
ndr->depth++;
+ ndr_print_policy_handle(ndr, "handle", r->in.handle);
+ ndr->depth--;
+ ndr_print_uint16(ndr, "level", r->in.level);
+ ndr_print_ptr(ndr, "info", r->in.info);
+ ndr->depth++;
+ ndr_print_samr_UserInfo(ndr, "info", r->in.level, r->in.info);
+ ndr->depth--;
ndr->depth--;
}
if (flags & NDR_OUT) {
- ndr_print_struct(ndr, "out", "samr_SET_USERINFO");
+ ndr_print_struct(ndr, "out", "samr_SetUserInfo");
ndr->depth++;
ndr_print_NTSTATUS(ndr, "result", &r->out.result);
ndr->depth--;
diff --git a/source4/librpc/ndr/ndr_samr.h b/source4/librpc/ndr/ndr_samr.h
index 18b1d68042..6b6f92d0d8 100644
--- a/source4/librpc/ndr/ndr_samr.h
+++ b/source4/librpc/ndr/ndr_samr.h
@@ -41,7 +41,7 @@
#define DCERPC_SAMR_OPENUSER 34
#define DCERPC_SAMR_DELETEUSER 35
#define DCERPC_SAMR_QUERYUSERINFO 36
-#define DCERPC_SAMR_SET_USERINFO 37
+#define DCERPC_SAMR_SETUSERINFO 37
#define DCERPC_SAMR_CHANGE_PASSWORD_USER 38
#define DCERPC_SAMR_GET_GROUPS_FOR_USER 39
#define DCERPC_SAMR_QUERY_DISPINFO 40
@@ -745,7 +745,7 @@ struct samr_UserInfo5 {
struct samr_Name home_drive;
struct samr_Name logon_script;
struct samr_Name profile;
- struct samr_Name descriptiom;
+ struct samr_Name description;
struct samr_Name workstations;
NTTIME last_logon;
NTTIME last_logoff;
@@ -789,7 +789,7 @@ struct samr_UserInfo12 {
};
struct samr_UserInfo13 {
- struct samr_Name descriptiom;
+ struct samr_Name description;
};
struct samr_UserInfo14 {
@@ -880,8 +880,11 @@ struct samr_QueryUserInfo {
};
-struct samr_SET_USERINFO {
+struct samr_SetUserInfo {
struct {
+ struct policy_handle *handle;
+ uint16 level;
+ union samr_UserInfo *info;
} in;
struct {
diff --git a/source4/librpc/ndr/ndr_spoolss.c b/source4/librpc/ndr/ndr_spoolss.c
index bed2ce25f5..b102a9292c 100644
--- a/source4/librpc/ndr/ndr_spoolss.c
+++ b/source4/librpc/ndr/ndr_spoolss.c
@@ -241,31 +241,31 @@ buffers:
if (!(ndr_flags & NDR_BUFFERS)) goto done;
switch (level) {
case 1:
- NDR_CHECK(ndr_push_spoolss_PrinterInfo1(ndr, ndr_flags, &r->info1));
+ NDR_CHECK(ndr_push_spoolss_PrinterInfo1(ndr, NDR_BUFFERS, &r->info1));
break;
case 2:
- NDR_CHECK(ndr_push_spoolss_PrinterInfo2(ndr, ndr_flags, &r->info2));
+ NDR_CHECK(ndr_push_spoolss_PrinterInfo2(ndr, NDR_BUFFERS, &r->info2));
break;
case 3:
- NDR_CHECK(ndr_push_spoolss_PrinterInfo3(ndr, ndr_flags, &r->info3));
+ NDR_CHECK(ndr_push_spoolss_PrinterInfo3(ndr, NDR_BUFFERS, &r->info3));
break;
case 4:
- NDR_CHECK(ndr_push_spoolss_PrinterInfo4(ndr, ndr_flags, &r->info4));
+ NDR_CHECK(ndr_push_spoolss_PrinterInfo4(ndr, NDR_BUFFERS, &r->info4));
break;
case 5:
- NDR_CHECK(ndr_push_spoolss_PrinterInfo5(ndr, ndr_flags, &r->info5));
+ NDR_CHECK(ndr_push_spoolss_PrinterInfo5(ndr, NDR_BUFFERS, &r->info5));
break;
case 6:
- NDR_CHECK(ndr_push_spoolss_PrinterInfo6(ndr, ndr_flags, &r->info6));
+ NDR_CHECK(ndr_push_spoolss_PrinterInfo6(ndr, NDR_BUFFERS, &r->info6));
break;
case 7:
- NDR_CHECK(ndr_push_spoolss_PrinterInfo7(ndr, ndr_flags, &r->info7));
+ NDR_CHECK(ndr_push_spoolss_PrinterInfo7(ndr, NDR_BUFFERS, &r->info7));
break;
default:
diff --git a/source4/librpc/ndr/ndr_srvsvc.c b/source4/librpc/ndr/ndr_srvsvc.c
index 64cc7c944c..4937e7e914 100644
--- a/source4/librpc/ndr/ndr_srvsvc.c
+++ b/source4/librpc/ndr/ndr_srvsvc.c
@@ -4391,20 +4391,6 @@ void ndr_print_srvsvc_NetShare1004(struct ndr_print *ndr, const char *name, stru
ndr->depth--;
}
-void ndr_print_srvsvc_NetShareCtr1004(struct ndr_print *ndr, const char *name, struct srvsvc_NetShareCtr1004 *r)
-{
- ndr_print_struct(ndr, name, "srvsvc_NetShareCtr1004");
- ndr->depth++;
- ndr_print_uint32(ndr, "count", r->count);
- ndr_print_ptr(ndr, "array", r->array);
- ndr->depth++;
- if (r->array) {
- ndr_print_array(ndr, "array", r->array, sizeof(r->array[0]), r->count, (ndr_print_fn_t)ndr_print_srvsvc_NetShare1004);
- }
- ndr->depth--;
- ndr->depth--;
-}
-
void ndr_print_srvsvc_NetShareUnion(struct ndr_print *ndr, const char *name, uint16 level, union srvsvc_NetShareUnion *r)
{
ndr_print_union(ndr, name, level, "srvsvc_NetShareUnion");
diff --git a/source4/librpc/ndr/ndr_srvsvc.h b/source4/librpc/ndr/ndr_srvsvc.h
index cae06371c6..b2a35edd16 100644
--- a/source4/librpc/ndr/ndr_srvsvc.h
+++ b/source4/librpc/ndr/ndr_srvsvc.h
@@ -429,11 +429,6 @@ struct srvsvc_NetShare1004 {
const char *comment;
};
-struct srvsvc_NetShareCtr1004 {
- uint32 count;
- struct srvsvc_NetShare1004 *array;
-};
-
union srvsvc_NetShareUnion {
/* [case(0)] */ struct srvsvc_NetShareCtr0 *ctr0;
/* [case(1)] */ struct srvsvc_NetShareCtr1 *ctr1;
diff --git a/source4/librpc/rpc/rpc_samr.c b/source4/librpc/rpc/rpc_samr.c
index a3b06ef81d..76dd26ea05 100644
--- a/source4/librpc/rpc/rpc_samr.c
+++ b/source4/librpc/rpc/rpc_samr.c
@@ -780,21 +780,21 @@ NTSTATUS dcerpc_samr_QueryUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, s
return status;
}
-NTSTATUS dcerpc_samr_SET_USERINFO(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_SET_USERINFO *r)
+NTSTATUS dcerpc_samr_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_SetUserInfo *r)
{
NTSTATUS status;
if (p->flags & DCERPC_DEBUG_PRINT_IN) {
- NDR_PRINT_IN_DEBUG(samr_SET_USERINFO, r);
+ NDR_PRINT_IN_DEBUG(samr_SetUserInfo, r);
}
- status = dcerpc_ndr_request(p, DCERPC_SAMR_SET_USERINFO, mem_ctx,
- (ndr_push_fn_t) ndr_push_samr_SET_USERINFO,
- (ndr_pull_fn_t) ndr_pull_samr_SET_USERINFO,
+ status = dcerpc_ndr_request(p, DCERPC_SAMR_SETUSERINFO, mem_ctx,
+ (ndr_push_fn_t) ndr_push_samr_SetUserInfo,
+ (ndr_pull_fn_t) ndr_pull_samr_SetUserInfo,
r);
if (NT_STATUS_IS_OK(status) && (p->flags & DCERPC_DEBUG_PRINT_OUT)) {
- NDR_PRINT_OUT_DEBUG(samr_SET_USERINFO, r);
+ NDR_PRINT_OUT_DEBUG(samr_SetUserInfo, r);
}
if (NT_STATUS_IS_OK(status)) status = r->out.result;
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
index 4774a62ebd..f0604dbdff 100644
--- a/source4/torture/rpc/samr.c
+++ b/source4/torture/rpc/samr.c
@@ -72,6 +72,34 @@ static BOOL test_QuerySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return True;
}
+
+static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle)
+{
+ NTSTATUS status;
+ struct samr_SetUserInfo r;
+ union samr_UserInfo u;
+ BOOL ret = True;
+
+ r.in.handle = handle;
+ r.in.level = 13;
+ r.in.info = &u;
+
+ printf("Testing SetUserInfo level %u\n", r.in.level);
+
+ init_samr_Name(&u.info13.description, "my description");
+
+ status = dcerpc_samr_SetUserInfo(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("SetUserInfo level %u failed - %s\n",
+ r.in.level, nt_errstr(status));
+ ret = False;
+ }
+
+ return ret;
+}
+
+
static BOOL test_user_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *handle)
{
@@ -85,10 +113,58 @@ static BOOL test_user_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
ret = False;
}
+ if (!test_SetUserInfo(p, mem_ctx, handle)) {
+ ret = False;
+ }
+
return ret;
}
+static BOOL test_DeleteUser_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle, const char *name)
+{
+ NTSTATUS status;
+ struct samr_LookupNames n;
+ struct samr_OpenUser r;
+ struct samr_DeleteUser d;
+ struct policy_handle acct_handle;
+ struct samr_Name sname;
+
+ init_samr_Name(&sname, name);
+
+ n.in.handle = handle;
+ n.in.num_names = 1;
+ n.in.names = &sname;
+ status = dcerpc_samr_LookupNames(p, mem_ctx, &n);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto failed;
+ }
+
+ r.in.handle = handle;
+ r.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED;
+ r.in.rid = n.out.rids.ids[0];
+ r.out.acct_handle = &acct_handle;
+ status = dcerpc_samr_OpenUser(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto failed;
+ }
+
+ d.in.handle = &acct_handle;
+ d.out.handle = &acct_handle;
+ status = dcerpc_samr_DeleteUser(p, mem_ctx, &d);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto failed;
+ }
+
+ return True;
+
+failed:
+ printf("DeleteUser_byname(%s) failed - %s\n", name, nt_errstr(status));
+ return False;
+}
+
+
static BOOL test_CreateUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *handle)
{
@@ -117,8 +193,13 @@ static BOOL test_CreateUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return True;
}
- if (!NT_STATUS_IS_OK(status) &&
- !NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) {
+ if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) {
+ if (!test_DeleteUser_byname(p, mem_ctx, handle, r.in.username->name)) {
+ return False;
+ }
+ status = dcerpc_samr_CreateUser(p, mem_ctx, &r);
+ }
+ if (!NT_STATUS_IS_OK(status)) {
printf("CreateUser failed - %s\n", nt_errstr(status));
return False;
}