summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/librpc/idl/samr.idl17
-rw-r--r--source4/librpc/ndr/ndr_samr.c59
-rw-r--r--source4/librpc/ndr/ndr_samr.h26
-rw-r--r--source4/librpc/rpc/rpc_samr.c16
-rw-r--r--source4/torture/rpc/samr.c59
5 files changed, 140 insertions, 37 deletions
diff --git a/source4/librpc/idl/samr.idl b/source4/librpc/idl/samr.idl
index 17a6b62687..ee910361e9 100644
--- a/source4/librpc/idl/samr.idl
+++ b/source4/librpc/idl/samr.idl
@@ -194,7 +194,13 @@
/************************/
/* Function 0x0b */
- NTSTATUS samr_ENUM_DOM_GROUPS();
+ NTSTATUS samr_EnumDomainGroups(
+ [in,ref] policy_handle *handle,
+ [in,out,ref] uint32 *resume_handle,
+ [in] uint32 max_size,
+ [out] samr_SamArray *sam,
+ [out,ref] uint32 num_entries
+ );
/************************/
/* Function 0x0c */
@@ -202,7 +208,14 @@
/************************/
/* Function 0x0d */
- NTSTATUS samr_ENUM_DOM_USERS();
+ NTSTATUS samr_EnumDomainUsers(
+ [in,ref] policy_handle *handle,
+ [in,out,ref] uint32 *resume_handle,
+ [in] uint32 acct_flags,
+ [in] uint32 max_size,
+ [out] samr_SamArray *sam,
+ [out,ref] uint32 num_entries
+ );
/************************/
/* Function 0x0e */
diff --git a/source4/librpc/ndr/ndr_samr.c b/source4/librpc/ndr/ndr_samr.c
index fb6f19d3e6..b7a515d62c 100644
--- a/source4/librpc/ndr/ndr_samr.c
+++ b/source4/librpc/ndr/ndr_samr.c
@@ -99,8 +99,11 @@ NTSTATUS ndr_push_samr_CREATE_DOM_GROUP(struct ndr_push *ndr, struct samr_CREATE
return NT_STATUS_OK;
}
-NTSTATUS ndr_push_samr_ENUM_DOM_GROUPS(struct ndr_push *ndr, struct samr_ENUM_DOM_GROUPS *r)
+NTSTATUS ndr_push_samr_EnumDomainGroups(struct ndr_push *ndr, struct samr_EnumDomainGroups *r)
{
+ NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle));
+ NDR_CHECK(ndr_push_uint32(ndr, *r->in.resume_handle));
+ NDR_CHECK(ndr_push_uint32(ndr, r->in.max_size));
return NT_STATUS_OK;
}
@@ -111,8 +114,12 @@ NTSTATUS ndr_push_samr_CREATE_USER_IN_DOMAIN(struct ndr_push *ndr, struct samr_C
return NT_STATUS_OK;
}
-NTSTATUS ndr_push_samr_ENUM_DOM_USERS(struct ndr_push *ndr, struct samr_ENUM_DOM_USERS *r)
+NTSTATUS ndr_push_samr_EnumDomainUsers(struct ndr_push *ndr, struct samr_EnumDomainUsers *r)
{
+ NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle));
+ NDR_CHECK(ndr_push_uint32(ndr, *r->in.resume_handle));
+ NDR_CHECK(ndr_push_uint32(ndr, r->in.acct_flags));
+ NDR_CHECK(ndr_push_uint32(ndr, r->in.max_size));
return NT_STATUS_OK;
}
@@ -693,7 +700,7 @@ static NTSTATUS ndr_pull_samr_DomInfo8(struct ndr_pull *ndr, int ndr_flags, stru
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
NDR_CHECK(ndr_pull_align(ndr, 8));
NDR_CHECK(ndr_pull_HYPER_T(ndr, &r->sequence_num));
- NDR_CHECK(ndr_pull_NTTIME(ndr, &r->last_modify_time));
+ NDR_CHECK(ndr_pull_NTTIME(ndr, &r->last_xxx_time));
buffers:
if (!(ndr_flags & NDR_BUFFERS)) goto done;
done:
@@ -756,7 +763,7 @@ static NTSTATUS ndr_pull_samr_DomInfo13(struct ndr_pull *ndr, int ndr_flags, str
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
NDR_CHECK(ndr_pull_align(ndr, 8));
NDR_CHECK(ndr_pull_HYPER_T(ndr, &r->sequence_num));
- NDR_CHECK(ndr_pull_NTTIME(ndr, &r->last_modify_time));
+ NDR_CHECK(ndr_pull_NTTIME(ndr, &r->last_xxx_time));
NDR_CHECK(ndr_pull_uint32(ndr, &r->foo7));
NDR_CHECK(ndr_pull_uint32(ndr, &r->foo8));
buffers:
@@ -806,10 +813,6 @@ static NTSTATUS ndr_pull_samr_DomainInfo(struct ndr_pull *ndr, int ndr_flags, ui
NDR_CHECK(ndr_pull_samr_DomInfo9(ndr, NDR_SCALARS, &r->info9));
break; }
- case 10: {
- NDR_CHECK(ndr_pull_samr_DomInfo1(ndr, NDR_SCALARS, &r->info10));
- break; }
-
case 11: {
NDR_CHECK(ndr_pull_samr_DomInfo11(ndr, NDR_SCALARS, &r->info11));
break; }
@@ -864,10 +867,6 @@ buffers:
NDR_CHECK(ndr_pull_samr_DomInfo9(ndr, NDR_BUFFERS, &r->info9));
break;
- case 10:
- NDR_CHECK(ndr_pull_samr_DomInfo1(ndr, NDR_BUFFERS, &r->info10));
- break;
-
case 11:
NDR_CHECK(ndr_pull_samr_DomInfo11(ndr, NDR_BUFFERS, &r->info11));
break;
@@ -921,8 +920,20 @@ NTSTATUS ndr_pull_samr_CREATE_DOM_GROUP(struct ndr_pull *ndr, struct samr_CREATE
return NT_STATUS_OK;
}
-NTSTATUS ndr_pull_samr_ENUM_DOM_GROUPS(struct ndr_pull *ndr, struct samr_ENUM_DOM_GROUPS *r)
+NTSTATUS ndr_pull_samr_EnumDomainGroups(struct ndr_pull *ndr, struct samr_EnumDomainGroups *r)
{
+ uint32 _ptr_sam;
+ NDR_CHECK(ndr_pull_uint32(ndr, r->out.resume_handle));
+ NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_sam));
+ if (_ptr_sam) {
+ NDR_ALLOC(ndr, r->out.sam);
+ } else {
+ r->out.sam = NULL;
+ }
+ if (r->out.sam) {
+ NDR_CHECK(ndr_pull_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam));
+ }
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->out.num_entries));
NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result));
return NT_STATUS_OK;
@@ -935,8 +946,20 @@ NTSTATUS ndr_pull_samr_CREATE_USER_IN_DOMAIN(struct ndr_pull *ndr, struct samr_C
return NT_STATUS_OK;
}
-NTSTATUS ndr_pull_samr_ENUM_DOM_USERS(struct ndr_pull *ndr, struct samr_ENUM_DOM_USERS *r)
+NTSTATUS ndr_pull_samr_EnumDomainUsers(struct ndr_pull *ndr, struct samr_EnumDomainUsers *r)
{
+ uint32 _ptr_sam;
+ NDR_CHECK(ndr_pull_uint32(ndr, r->out.resume_handle));
+ NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_sam));
+ if (_ptr_sam) {
+ NDR_ALLOC(ndr, r->out.sam);
+ } else {
+ r->out.sam = NULL;
+ }
+ if (r->out.sam) {
+ NDR_CHECK(ndr_pull_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam));
+ }
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->out.num_entries));
NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result));
return NT_STATUS_OK;
@@ -1434,7 +1457,7 @@ void ndr_print_samr_DomInfo8(struct ndr_print *ndr, const char *name, struct sam
ndr_print_struct(ndr, name, "samr_DomInfo8");
ndr->depth++;
ndr_print_HYPER_T(ndr, "sequence_num", r->sequence_num);
- ndr_print_NTTIME(ndr, "last_modify_time", r->last_modify_time);
+ ndr_print_NTTIME(ndr, "last_xxx_time", r->last_xxx_time);
ndr->depth--;
}
@@ -1482,7 +1505,7 @@ void ndr_print_samr_DomInfo13(struct ndr_print *ndr, const char *name, struct sa
ndr_print_struct(ndr, name, "samr_DomInfo13");
ndr->depth++;
ndr_print_HYPER_T(ndr, "sequence_num", r->sequence_num);
- ndr_print_NTTIME(ndr, "last_modify_time", r->last_modify_time);
+ ndr_print_NTTIME(ndr, "last_xxx_time", r->last_xxx_time);
ndr_print_uint32(ndr, "foo7", r->foo7);
ndr_print_uint32(ndr, "foo8", r->foo8);
ndr->depth--;
@@ -1528,10 +1551,6 @@ void ndr_print_samr_DomainInfo(struct ndr_print *ndr, const char *name, uint16 l
ndr_print_samr_DomInfo9(ndr, "info9", &r->info9);
break;
- case 10:
- ndr_print_samr_DomInfo1(ndr, "info10", &r->info10);
- break;
-
case 11:
ndr_print_samr_DomInfo11(ndr, "info11", &r->info11);
break;
diff --git a/source4/librpc/ndr/ndr_samr.h b/source4/librpc/ndr/ndr_samr.h
index 8b68da5caa..bd2feac860 100644
--- a/source4/librpc/ndr/ndr_samr.h
+++ b/source4/librpc/ndr/ndr_samr.h
@@ -156,7 +156,7 @@ struct samr_DomInfo7 {
struct samr_DomInfo8 {
HYPER_T sequence_num;
- NTTIME last_modify_time;
+ NTTIME last_xxx_time;
};
struct samr_DomInfo9 {
@@ -188,7 +188,7 @@ struct samr_DomInfo12 {
struct samr_DomInfo13 {
HYPER_T sequence_num;
- NTTIME last_modify_time;
+ NTTIME last_xxx_time;
uint32 foo7;
uint32 foo8;
};
@@ -203,7 +203,6 @@ union samr_DomainInfo {
/* [case(7)] */ struct samr_DomInfo7 info7;
/* [case(8)] */ struct samr_DomInfo8 info8;
/* [case(9)] */ struct samr_DomInfo9 info9;
-/* [case(10)] */ struct samr_DomInfo1 info10;
/* [case(11)] */ struct samr_DomInfo11 info11;
/* [case(12)] */ struct samr_DomInfo12 info12;
/* [case(13)] */ struct samr_DomInfo13 info13;
@@ -242,11 +241,17 @@ struct samr_CREATE_DOM_GROUP {
};
-struct samr_ENUM_DOM_GROUPS {
+struct samr_EnumDomainGroups {
struct {
+ struct policy_handle *handle;
+ uint32 *resume_handle;
+ uint32 max_size;
} in;
struct {
+ uint32 *resume_handle;
+ struct samr_SamArray *sam;
+ uint32 num_entries;
NTSTATUS result;
} out;
@@ -262,11 +267,18 @@ struct samr_CREATE_USER_IN_DOMAIN {
};
-struct samr_ENUM_DOM_USERS {
+struct samr_EnumDomainUsers {
struct {
+ struct policy_handle *handle;
+ uint32 *resume_handle;
+ uint32 acct_flags;
+ uint32 max_size;
} in;
struct {
+ uint32 *resume_handle;
+ struct samr_SamArray *sam;
+ uint32 num_entries;
NTSTATUS result;
} out;
@@ -827,9 +839,9 @@ struct samr_VALIDATE_PASSWORD {
#define DCERPC_SAMR_QUERYDOMAININFO 8
#define DCERPC_SAMR_SET_DOMAIN_INFO 9
#define DCERPC_SAMR_CREATE_DOM_GROUP 10
-#define DCERPC_SAMR_ENUM_DOM_GROUPS 11
+#define DCERPC_SAMR_ENUMDOMAINGROUPS 11
#define DCERPC_SAMR_CREATE_USER_IN_DOMAIN 12
-#define DCERPC_SAMR_ENUM_DOM_USERS 13
+#define DCERPC_SAMR_ENUMDOMAINUSERS 13
#define DCERPC_SAMR_CREATE_DOM_ALIAS 14
#define DCERPC_SAMR_ENUM_DOM_ALIASES 15
#define DCERPC_SAMR_GET_ALIAS_MEMBERSHIP 16
diff --git a/source4/librpc/rpc/rpc_samr.c b/source4/librpc/rpc/rpc_samr.c
index 98b294d044..e361de23b5 100644
--- a/source4/librpc/rpc/rpc_samr.c
+++ b/source4/librpc/rpc/rpc_samr.c
@@ -157,12 +157,12 @@ NTSTATUS dcerpc_samr_CREATE_DOM_GROUP(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx
return r->out.result;
}
-NTSTATUS dcerpc_samr_ENUM_DOM_GROUPS(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_ENUM_DOM_GROUPS *r)
+NTSTATUS dcerpc_samr_EnumDomainGroups(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_EnumDomainGroups *r)
{
NTSTATUS status;
- status = dcerpc_ndr_request(p, DCERPC_SAMR_ENUM_DOM_GROUPS, mem_ctx,
- (ndr_push_fn_t) ndr_push_samr_ENUM_DOM_GROUPS,
- (ndr_pull_fn_t) ndr_pull_samr_ENUM_DOM_GROUPS,
+ status = dcerpc_ndr_request(p, DCERPC_SAMR_ENUMDOMAINGROUPS, mem_ctx,
+ (ndr_push_fn_t) ndr_push_samr_EnumDomainGroups,
+ (ndr_pull_fn_t) ndr_pull_samr_EnumDomainGroups,
r);
if (!NT_STATUS_IS_OK(status)) {
return status;
@@ -185,12 +185,12 @@ NTSTATUS dcerpc_samr_CREATE_USER_IN_DOMAIN(struct dcerpc_pipe *p, TALLOC_CTX *me
return r->out.result;
}
-NTSTATUS dcerpc_samr_ENUM_DOM_USERS(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_ENUM_DOM_USERS *r)
+NTSTATUS dcerpc_samr_EnumDomainUsers(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_EnumDomainUsers *r)
{
NTSTATUS status;
- status = dcerpc_ndr_request(p, DCERPC_SAMR_ENUM_DOM_USERS, mem_ctx,
- (ndr_push_fn_t) ndr_push_samr_ENUM_DOM_USERS,
- (ndr_pull_fn_t) ndr_pull_samr_ENUM_DOM_USERS,
+ status = dcerpc_ndr_request(p, DCERPC_SAMR_ENUMDOMAINUSERS, mem_ctx,
+ (ndr_push_fn_t) ndr_push_samr_EnumDomainUsers,
+ (ndr_pull_fn_t) ndr_pull_samr_EnumDomainUsers,
r);
if (!NT_STATUS_IS_OK(status)) {
return status;
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
index b66e86815a..d4827e2504 100644
--- a/source4/torture/rpc/samr.c
+++ b/source4/torture/rpc/samr.c
@@ -21,6 +21,57 @@
#include "includes.h"
+static BOOL test_EnumDomainUsers(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle)
+{
+ NTSTATUS status;
+ struct samr_EnumDomainUsers r;
+ uint32 resume_handle=0;
+
+ printf("Testing EnumDomainUsers\n");
+
+ r.in.handle = handle;
+ r.in.resume_handle = &resume_handle;
+ r.in.acct_flags = 0;
+ r.in.max_size = (uint32)-1;
+ r.out.resume_handle = &resume_handle;
+
+ status = dcerpc_samr_EnumDomainUsers(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("EnumDomainUsers failed - %s\n", nt_errstr(status));
+ return False;
+ }
+
+ NDR_PRINT_DEBUG(samr_SamArray, r.out.sam);
+
+ return True;
+}
+
+static BOOL test_EnumDomainGroups(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle)
+{
+ NTSTATUS status;
+ struct samr_EnumDomainGroups r;
+ uint32 resume_handle=0;
+
+ printf("Testing EnumDomainGroups\n");
+
+ r.in.handle = handle;
+ r.in.resume_handle = &resume_handle;
+ r.in.max_size = (uint32)-1;
+ r.out.resume_handle = &resume_handle;
+
+ status = dcerpc_samr_EnumDomainGroups(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("EnumDomainGroups failed - %s\n", nt_errstr(status));
+ return False;
+ }
+
+ NDR_PRINT_DEBUG(samr_SamArray, r.out.sam);
+
+ return True;
+}
+
static BOOL test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *handle)
{
@@ -74,6 +125,14 @@ static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return False;
}
+ if (!test_EnumDomainGroups(p, mem_ctx, &domain_handle)) {
+ return False;
+ }
+
+ if (!test_EnumDomainUsers(p, mem_ctx, &domain_handle)) {
+ return False;
+ }
+
return True;
}