summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/librpc/idl/dfs.idl38
-rw-r--r--source4/librpc/ndr/ndr_basic.c7
-rw-r--r--source4/librpc/ndr/ndr_dfs.c489
-rw-r--r--source4/librpc/ndr/ndr_dfs.h37
-rw-r--r--source4/librpc/ndr/ndr_sec.c4
-rw-r--r--source4/librpc/rpc/dcerpc.c4
-rw-r--r--source4/torture/rpc/dfs.c31
7 files changed, 594 insertions, 16 deletions
diff --git a/source4/librpc/idl/dfs.idl b/source4/librpc/idl/dfs.idl
index 27efc5b221..95349b9000 100644
--- a/source4/librpc/idl/dfs.idl
+++ b/source4/librpc/idl/dfs.idl
@@ -88,10 +88,48 @@
[size_is(count)] dfs_Info3 *s;
} dfs_EnumArray3;
+ typedef struct {
+ unistr *path;
+ unistr *comment;
+ uint32 state;
+ uint32 timeout;
+ GUID guid;
+ uint32 num_stores;
+ [size_is(num_stores)] dfs_StorageInfo *stores;
+ } dfs_Info4;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] dfs_Info4 *s;
+ } dfs_EnumArray4;
+
+ typedef struct {
+ unistr *dom_root;
+ } dfs_Info200;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] dfs_Info200 *s;
+ } dfs_EnumArray200;
+
+ typedef struct {
+ uint32 flags;
+ unistr *dom_root;
+ } dfs_Info300;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] dfs_Info300 *s;
+ } dfs_EnumArray300;
+
+
typedef union {
case(1) dfs_EnumArray1 *info1;
case(2) dfs_EnumArray2 *info2;
case(3) dfs_EnumArray3 *info3;
+ case(4) dfs_EnumArray4 *info4;
+ case(200) dfs_EnumArray200 *info200;
+ case(300) dfs_EnumArray300 *info300;
} dfs_EnumInfo;
typedef struct {
diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c
index 6208943d94..b50b614b92 100644
--- a/source4/librpc/ndr/ndr_basic.c
+++ b/source4/librpc/ndr/ndr_basic.c
@@ -397,9 +397,12 @@ NTSTATUS ndr_push_offset_ptr(struct ndr_push *ndr,
/*
push a GUID
*/
-NTSTATUS ndr_push_GUID(struct ndr_push *ndr, GUID *guid)
+NTSTATUS ndr_push_GUID(struct ndr_push *ndr, int ndr_flags, GUID *guid)
{
- return ndr_push_bytes(ndr, guid->info, GUID_SIZE);
+ if (ndr_flags & NDR_SCALARS) {
+ return ndr_push_bytes(ndr, guid->info, GUID_SIZE);
+ }
+ return NT_STATUS_OK;
}
/*
diff --git a/source4/librpc/ndr/ndr_dfs.c b/source4/librpc/ndr/ndr_dfs.c
index 58d96a8d9f..c032908547 100644
--- a/source4/librpc/ndr/ndr_dfs.c
+++ b/source4/librpc/ndr/ndr_dfs.c
@@ -194,6 +194,111 @@ done:
return NT_STATUS_OK;
}
+static NTSTATUS ndr_push_dfs_Info4(struct ndr_push *ndr, int ndr_flags, struct dfs_Info4 *r)
+{
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_push_ptr(ndr, r->path));
+ NDR_CHECK(ndr_push_ptr(ndr, r->comment));
+ NDR_CHECK(ndr_push_uint32(ndr, r->state));
+ NDR_CHECK(ndr_push_uint32(ndr, r->timeout));
+ NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->guid));
+ NDR_CHECK(ndr_push_uint32(ndr, r->num_stores));
+ NDR_CHECK(ndr_push_ptr(ndr, r->stores));
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ if (r->path) {
+ NDR_CHECK(ndr_push_unistr(ndr, r->path));
+ }
+ if (r->comment) {
+ NDR_CHECK(ndr_push_unistr(ndr, r->comment));
+ }
+ NDR_CHECK(ndr_push_GUID(ndr, ndr_flags, &r->guid));
+ if (r->stores) {
+ NDR_CHECK(ndr_push_uint32(ndr, r->num_stores));
+ NDR_CHECK(ndr_push_array(ndr, ndr_flags, r->stores, sizeof(r->stores[0]), r->num_stores, (ndr_push_flags_fn_t)ndr_push_dfs_StorageInfo));
+ }
+done:
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS ndr_push_dfs_EnumArray4(struct ndr_push *ndr, int ndr_flags, struct dfs_EnumArray4 *r)
+{
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_push_uint32(ndr, r->count));
+ NDR_CHECK(ndr_push_ptr(ndr, r->s));
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ if (r->s) {
+ NDR_CHECK(ndr_push_uint32(ndr, r->count));
+ NDR_CHECK(ndr_push_array(ndr, ndr_flags, r->s, sizeof(r->s[0]), r->count, (ndr_push_flags_fn_t)ndr_push_dfs_Info4));
+ }
+done:
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS ndr_push_dfs_Info200(struct ndr_push *ndr, int ndr_flags, struct dfs_Info200 *r)
+{
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_push_ptr(ndr, r->dom_root));
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ if (r->dom_root) {
+ NDR_CHECK(ndr_push_unistr(ndr, r->dom_root));
+ }
+done:
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS ndr_push_dfs_EnumArray200(struct ndr_push *ndr, int ndr_flags, struct dfs_EnumArray200 *r)
+{
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_push_uint32(ndr, r->count));
+ NDR_CHECK(ndr_push_ptr(ndr, r->s));
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ if (r->s) {
+ NDR_CHECK(ndr_push_uint32(ndr, r->count));
+ NDR_CHECK(ndr_push_array(ndr, ndr_flags, r->s, sizeof(r->s[0]), r->count, (ndr_push_flags_fn_t)ndr_push_dfs_Info200));
+ }
+done:
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS ndr_push_dfs_Info300(struct ndr_push *ndr, int ndr_flags, struct dfs_Info300 *r)
+{
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_push_uint32(ndr, r->flags));
+ NDR_CHECK(ndr_push_ptr(ndr, r->dom_root));
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ if (r->dom_root) {
+ NDR_CHECK(ndr_push_unistr(ndr, r->dom_root));
+ }
+done:
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS ndr_push_dfs_EnumArray300(struct ndr_push *ndr, int ndr_flags, struct dfs_EnumArray300 *r)
+{
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_push_uint32(ndr, r->count));
+ NDR_CHECK(ndr_push_ptr(ndr, r->s));
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ if (r->s) {
+ NDR_CHECK(ndr_push_uint32(ndr, r->count));
+ NDR_CHECK(ndr_push_array(ndr, ndr_flags, r->s, sizeof(r->s[0]), r->count, (ndr_push_flags_fn_t)ndr_push_dfs_Info300));
+ }
+done:
+ return NT_STATUS_OK;
+}
+
static NTSTATUS ndr_push_dfs_EnumInfo(struct ndr_push *ndr, int ndr_flags, uint16 level, union dfs_EnumInfo *r)
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
@@ -211,6 +316,18 @@ static NTSTATUS ndr_push_dfs_EnumInfo(struct ndr_push *ndr, int ndr_flags, uint1
NDR_CHECK(ndr_push_ptr(ndr, r->info3));
break;
+ case 4:
+ NDR_CHECK(ndr_push_ptr(ndr, r->info4));
+ break;
+
+ case 200:
+ NDR_CHECK(ndr_push_ptr(ndr, r->info200));
+ break;
+
+ case 300:
+ NDR_CHECK(ndr_push_ptr(ndr, r->info300));
+ break;
+
default:
return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
@@ -235,6 +352,24 @@ buffers:
}
break;
+ case 4:
+ if (r->info4) {
+ NDR_CHECK(ndr_push_dfs_EnumArray4(ndr, ndr_flags, r->info4));
+ }
+ break;
+
+ case 200:
+ if (r->info200) {
+ NDR_CHECK(ndr_push_dfs_EnumArray200(ndr, ndr_flags, r->info200));
+ }
+ break;
+
+ case 300:
+ if (r->info300) {
+ NDR_CHECK(ndr_push_dfs_EnumArray300(ndr, ndr_flags, r->info300));
+ }
+ break;
+
default:
return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
@@ -530,6 +665,187 @@ done:
return NT_STATUS_OK;
}
+static NTSTATUS ndr_pull_dfs_Info4(struct ndr_pull *ndr, int ndr_flags, struct dfs_Info4 *r)
+{
+ uint32 _ptr_path;
+ uint32 _ptr_comment;
+ uint32 _ptr_stores;
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_path));
+ if (_ptr_path) {
+ NDR_ALLOC(ndr, r->path);
+ } else {
+ r->path = NULL;
+ }
+ NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_comment));
+ if (_ptr_comment) {
+ NDR_ALLOC(ndr, r->comment);
+ } else {
+ r->comment = NULL;
+ }
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->state));
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->timeout));
+ NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->guid));
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->num_stores));
+ NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_stores));
+ if (_ptr_stores) {
+ NDR_ALLOC(ndr, r->stores);
+ } else {
+ r->stores = NULL;
+ }
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ if (r->path) {
+ NDR_CHECK(ndr_pull_unistr(ndr, &r->path));
+ }
+ if (r->comment) {
+ NDR_CHECK(ndr_pull_unistr(ndr, &r->comment));
+ }
+ NDR_CHECK(ndr_pull_GUID(ndr, ndr_flags, &r->guid));
+ if (r->stores) {
+ {
+ uint32 _array_size;
+ NDR_CHECK(ndr_pull_uint32(ndr, &_array_size));
+ if (r->num_stores > _array_size) {
+ return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should be %u", _array_size, r->num_stores);
+ }
+ }
+ NDR_ALLOC_N_SIZE(ndr, r->stores, r->num_stores, sizeof(r->stores[0]));
+ NDR_CHECK(ndr_pull_array(ndr, NDR_SCALARS|NDR_BUFFERS, (void **)r->stores, sizeof(r->stores[0]), r->num_stores, (ndr_pull_flags_fn_t)ndr_pull_dfs_StorageInfo));
+ }
+done:
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS ndr_pull_dfs_EnumArray4(struct ndr_pull *ndr, int ndr_flags, struct dfs_EnumArray4 *r)
+{
+ uint32 _ptr_s;
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->count));
+ NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_s));
+ if (_ptr_s) {
+ NDR_ALLOC(ndr, r->s);
+ } else {
+ r->s = NULL;
+ }
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ if (r->s) {
+ {
+ uint32 _array_size;
+ NDR_CHECK(ndr_pull_uint32(ndr, &_array_size));
+ if (r->count > _array_size) {
+ return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should be %u", _array_size, r->count);
+ }
+ }
+ NDR_ALLOC_N_SIZE(ndr, r->s, r->count, sizeof(r->s[0]));
+ NDR_CHECK(ndr_pull_array(ndr, NDR_SCALARS|NDR_BUFFERS, (void **)r->s, sizeof(r->s[0]), r->count, (ndr_pull_flags_fn_t)ndr_pull_dfs_Info4));
+ }
+done:
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS ndr_pull_dfs_Info200(struct ndr_pull *ndr, int ndr_flags, struct dfs_Info200 *r)
+{
+ uint32 _ptr_dom_root;
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_dom_root));
+ if (_ptr_dom_root) {
+ NDR_ALLOC(ndr, r->dom_root);
+ } else {
+ r->dom_root = NULL;
+ }
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ if (r->dom_root) {
+ NDR_CHECK(ndr_pull_unistr(ndr, &r->dom_root));
+ }
+done:
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS ndr_pull_dfs_EnumArray200(struct ndr_pull *ndr, int ndr_flags, struct dfs_EnumArray200 *r)
+{
+ uint32 _ptr_s;
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->count));
+ NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_s));
+ if (_ptr_s) {
+ NDR_ALLOC(ndr, r->s);
+ } else {
+ r->s = NULL;
+ }
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ if (r->s) {
+ {
+ uint32 _array_size;
+ NDR_CHECK(ndr_pull_uint32(ndr, &_array_size));
+ if (r->count > _array_size) {
+ return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should be %u", _array_size, r->count);
+ }
+ }
+ NDR_ALLOC_N_SIZE(ndr, r->s, r->count, sizeof(r->s[0]));
+ NDR_CHECK(ndr_pull_array(ndr, NDR_SCALARS|NDR_BUFFERS, (void **)r->s, sizeof(r->s[0]), r->count, (ndr_pull_flags_fn_t)ndr_pull_dfs_Info200));
+ }
+done:
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS ndr_pull_dfs_Info300(struct ndr_pull *ndr, int ndr_flags, struct dfs_Info300 *r)
+{
+ uint32 _ptr_dom_root;
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->flags));
+ NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_dom_root));
+ if (_ptr_dom_root) {
+ NDR_ALLOC(ndr, r->dom_root);
+ } else {
+ r->dom_root = NULL;
+ }
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ if (r->dom_root) {
+ NDR_CHECK(ndr_pull_unistr(ndr, &r->dom_root));
+ }
+done:
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS ndr_pull_dfs_EnumArray300(struct ndr_pull *ndr, int ndr_flags, struct dfs_EnumArray300 *r)
+{
+ uint32 _ptr_s;
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->count));
+ NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_s));
+ if (_ptr_s) {
+ NDR_ALLOC(ndr, r->s);
+ } else {
+ r->s = NULL;
+ }
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ if (r->s) {
+ {
+ uint32 _array_size;
+ NDR_CHECK(ndr_pull_uint32(ndr, &_array_size));
+ if (r->count > _array_size) {
+ return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should be %u", _array_size, r->count);
+ }
+ }
+ NDR_ALLOC_N_SIZE(ndr, r->s, r->count, sizeof(r->s[0]));
+ NDR_CHECK(ndr_pull_array(ndr, NDR_SCALARS|NDR_BUFFERS, (void **)r->s, sizeof(r->s[0]), r->count, (ndr_pull_flags_fn_t)ndr_pull_dfs_Info300));
+ }
+done:
+ return NT_STATUS_OK;
+}
+
static NTSTATUS ndr_pull_dfs_EnumInfo(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union dfs_EnumInfo *r)
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
@@ -565,6 +881,36 @@ static NTSTATUS ndr_pull_dfs_EnumInfo(struct ndr_pull *ndr, int ndr_flags, uint1
}
break; }
+ case 4: {
+ uint32 _ptr_info4;
+ NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_info4));
+ if (_ptr_info4) {
+ NDR_ALLOC(ndr, r->info4);
+ } else {
+ r->info4 = NULL;
+ }
+ break; }
+
+ case 200: {
+ uint32 _ptr_info200;
+ NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_info200));
+ if (_ptr_info200) {
+ NDR_ALLOC(ndr, r->info200);
+ } else {
+ r->info200 = NULL;
+ }
+ break; }
+
+ case 300: {
+ uint32 _ptr_info300;
+ NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_info300));
+ if (_ptr_info300) {
+ NDR_ALLOC(ndr, r->info300);
+ } else {
+ r->info300 = NULL;
+ }
+ break; }
+
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
}
@@ -589,6 +935,24 @@ buffers:
}
break;
+ case 4:
+ if (r->info4) {
+ NDR_CHECK(ndr_pull_dfs_EnumArray4(ndr, NDR_SCALARS|NDR_BUFFERS, r->info4));
+ }
+ break;
+
+ case 200:
+ if (r->info200) {
+ NDR_CHECK(ndr_pull_dfs_EnumArray200(ndr, NDR_SCALARS|NDR_BUFFERS, r->info200));
+ }
+ break;
+
+ case 300:
+ if (r->info300) {
+ NDR_CHECK(ndr_pull_dfs_EnumArray300(ndr, NDR_SCALARS|NDR_BUFFERS, r->info300));
+ }
+ break;
+
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
}
@@ -765,6 +1129,104 @@ void ndr_print_dfs_EnumArray3(struct ndr_print *ndr, const char *name, struct df
ndr->depth--;
}
+void ndr_print_dfs_Info4(struct ndr_print *ndr, const char *name, struct dfs_Info4 *r)
+{
+ ndr_print_struct(ndr, name, "dfs_Info4");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "path", r->path);
+ ndr->depth++;
+ if (r->path) {
+ ndr_print_unistr(ndr, "path", r->path);
+ }
+ ndr->depth--;
+ ndr_print_ptr(ndr, "comment", r->comment);
+ ndr->depth++;
+ if (r->comment) {
+ ndr_print_unistr(ndr, "comment", r->comment);
+ }
+ ndr->depth--;
+ ndr_print_uint32(ndr, "state", r->state);
+ ndr_print_uint32(ndr, "timeout", r->timeout);
+ ndr_print_GUID(ndr, "guid", &r->guid);
+ ndr_print_uint32(ndr, "num_stores", r->num_stores);
+ ndr_print_ptr(ndr, "stores", r->stores);
+ ndr->depth++;
+ if (r->stores) {
+ ndr_print_array(ndr, "stores", r->stores, sizeof(r->stores[0]), r->num_stores, (ndr_print_fn_t)ndr_print_dfs_StorageInfo);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
+void ndr_print_dfs_EnumArray4(struct ndr_print *ndr, const char *name, struct dfs_EnumArray4 *r)
+{
+ ndr_print_struct(ndr, name, "dfs_EnumArray4");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "count", r->count);
+ ndr_print_ptr(ndr, "s", r->s);
+ ndr->depth++;
+ if (r->s) {
+ ndr_print_array(ndr, "s", r->s, sizeof(r->s[0]), r->count, (ndr_print_fn_t)ndr_print_dfs_Info4);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
+void ndr_print_dfs_Info200(struct ndr_print *ndr, const char *name, struct dfs_Info200 *r)
+{
+ ndr_print_struct(ndr, name, "dfs_Info200");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "dom_root", r->dom_root);
+ ndr->depth++;
+ if (r->dom_root) {
+ ndr_print_unistr(ndr, "dom_root", r->dom_root);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
+void ndr_print_dfs_EnumArray200(struct ndr_print *ndr, const char *name, struct dfs_EnumArray200 *r)
+{
+ ndr_print_struct(ndr, name, "dfs_EnumArray200");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "count", r->count);
+ ndr_print_ptr(ndr, "s", r->s);
+ ndr->depth++;
+ if (r->s) {
+ ndr_print_array(ndr, "s", r->s, sizeof(r->s[0]), r->count, (ndr_print_fn_t)ndr_print_dfs_Info200);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
+void ndr_print_dfs_Info300(struct ndr_print *ndr, const char *name, struct dfs_Info300 *r)
+{
+ ndr_print_struct(ndr, name, "dfs_Info300");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "flags", r->flags);
+ ndr_print_ptr(ndr, "dom_root", r->dom_root);
+ ndr->depth++;
+ if (r->dom_root) {
+ ndr_print_unistr(ndr, "dom_root", r->dom_root);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
+void ndr_print_dfs_EnumArray300(struct ndr_print *ndr, const char *name, struct dfs_EnumArray300 *r)
+{
+ ndr_print_struct(ndr, name, "dfs_EnumArray300");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "count", r->count);
+ ndr_print_ptr(ndr, "s", r->s);
+ ndr->depth++;
+ if (r->s) {
+ ndr_print_array(ndr, "s", r->s, sizeof(r->s[0]), r->count, (ndr_print_fn_t)ndr_print_dfs_Info300);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
void ndr_print_dfs_EnumInfo(struct ndr_print *ndr, const char *name, uint16 level, union dfs_EnumInfo *r)
{
ndr_print_union(ndr, name, level, "dfs_EnumInfo");
@@ -796,6 +1258,33 @@ void ndr_print_dfs_EnumInfo(struct ndr_print *ndr, const char *name, uint16 leve
ndr->depth--;
break;
+ case 4:
+ ndr_print_ptr(ndr, "info4", r->info4);
+ ndr->depth++;
+ if (r->info4) {
+ ndr_print_dfs_EnumArray4(ndr, "info4", r->info4);
+ }
+ ndr->depth--;
+ break;
+
+ case 200:
+ ndr_print_ptr(ndr, "info200", r->info200);
+ ndr->depth++;
+ if (r->info200) {
+ ndr_print_dfs_EnumArray200(ndr, "info200", r->info200);
+ }
+ ndr->depth--;
+ break;
+
+ case 300:
+ ndr_print_ptr(ndr, "info300", r->info300);
+ ndr->depth++;
+ if (r->info300) {
+ ndr_print_dfs_EnumArray300(ndr, "info300", r->info300);
+ }
+ ndr->depth--;
+ break;
+
default:
ndr_print_bad_level(ndr, name, level);
}
diff --git a/source4/librpc/ndr/ndr_dfs.h b/source4/librpc/ndr/ndr_dfs.h
index 2f010c8ad1..23c84e5b53 100644
--- a/source4/librpc/ndr/ndr_dfs.h
+++ b/source4/librpc/ndr/ndr_dfs.h
@@ -102,10 +102,47 @@ struct dfs_EnumArray3 {
struct dfs_Info3 *s;
};
+struct dfs_Info4 {
+ const char *path;
+ const char *comment;
+ uint32 state;
+ uint32 timeout;
+ struct GUID guid;
+ uint32 num_stores;
+ struct dfs_StorageInfo *stores;
+};
+
+struct dfs_EnumArray4 {
+ uint32 count;
+ struct dfs_Info4 *s;
+};
+
+struct dfs_Info200 {
+ const char *dom_root;
+};
+
+struct dfs_EnumArray200 {
+ uint32 count;
+ struct dfs_Info200 *s;
+};
+
+struct dfs_Info300 {
+ uint32 flags;
+ const char *dom_root;
+};
+
+struct dfs_EnumArray300 {
+ uint32 count;
+ struct dfs_Info300 *s;
+};
+
union dfs_EnumInfo {
/* [case(1)] */ struct dfs_EnumArray1 *info1;
/* [case(2)] */ struct dfs_EnumArray2 *info2;
/* [case(3)] */ struct dfs_EnumArray3 *info3;
+/* [case(4)] */ struct dfs_EnumArray4 *info4;
+/* [case(200)] */ struct dfs_EnumArray200 *info200;
+/* [case(300)] */ struct dfs_EnumArray300 *info300;
};
struct dfs_EnumStruct {
diff --git a/source4/librpc/ndr/ndr_sec.c b/source4/librpc/ndr/ndr_sec.c
index 989de5b658..0341d92951 100644
--- a/source4/librpc/ndr/ndr_sec.c
+++ b/source4/librpc/ndr/ndr_sec.c
@@ -203,10 +203,10 @@ NTSTATUS ndr_push_security_ace(struct ndr_push *ndr, struct security_ace *ace)
if (sec_ace_object(ace->type)) {
NDR_CHECK(ndr_push_uint32(ndr, ace->obj->flags));
if (ace->obj->flags & SEC_ACE_OBJECT_PRESENT) {
- NDR_CHECK(ndr_push_GUID(ndr, &ace->obj->object_guid));
+ NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &ace->obj->object_guid));
}
if (ace->obj->flags & SEC_ACE_OBJECT_INHERITED_PRESENT) {
- NDR_CHECK(ndr_push_GUID(ndr, &ace->obj->inherit_guid));
+ NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &ace->obj->inherit_guid));
}
}
diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c
index f72e7b1a88..6e6436887b 100644
--- a/source4/librpc/rpc/dcerpc.c
+++ b/source4/librpc/rpc/dcerpc.c
@@ -331,7 +331,7 @@ NTSTATUS dcerpc_pull(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, struct dcerpc_packet
break;
default:
- return NT_STATUS_INVALID_LEVEL;
+ return NT_STATUS_NET_WRITE_FAULT;
}
return status;
@@ -478,7 +478,7 @@ NTSTATUS dcerpc_push(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, struct dcerpc_packet
break;
default:
- status = NT_STATUS_INVALID_LEVEL;
+ status = NT_STATUS_NET_WRITE_FAULT;
}
return status;
diff --git a/source4/torture/rpc/dfs.c b/source4/torture/rpc/dfs.c
index 5c1b2f2b4e..ad496bc742 100644
--- a/source4/torture/rpc/dfs.c
+++ b/source4/torture/rpc/dfs.c
@@ -41,28 +41,26 @@ static BOOL test_Exist(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
return True;
}
-static BOOL test_Enum(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
+static BOOL test_EnumLevel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint16 level)
{
NTSTATUS status;
struct dfs_Enum r;
uint32 total=0;
struct dfs_EnumStruct e;
- uint32 i = 0;
struct dfs_Info1 s;
- struct dfs_EnumArray1 e2;
-
- r.in.level = 3;
+ struct dfs_EnumArray1 e1;
+
+ r.in.level = level;
r.in.bufsize = (uint32)-1;
r.in.total = &total;
- r.in.unknown = NULL;
+ r.in.unknown = &total;
r.in.info = &e;
e.level = r.in.level;
- e.e.info1 = &e2;
+ e.e.info1 = &e1;
e.e.info1->count = 0;
e.e.info1->s = &s;
s.path = NULL;
-
status = dcerpc_dfs_Enum(p, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
@@ -70,13 +68,26 @@ static BOOL test_Enum(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
return False;
}
- NDR_PRINT_DEBUG(dfs_EnumStruct, r.out.info);
+ printf("Received %d records\n", r.out.total?*r.out.total:-1);
- printf("total=%d\n", r.out.total?*r.out.total:-1);
+ NDR_PRINT_DEBUG(dfs_EnumStruct, r.out.info);
return True;
}
+static BOOL test_Enum(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
+{
+ BOOL ret = True;
+ uint16 levels[] = {1, 2, 3, 4, 200, 300};
+ int i;
+ for (i=0;i<ARRAY_SIZE(levels);i++) {
+ if (!test_EnumLevel(p, mem_ctx, levels[i])) {
+ ret = False;
+ }
+ }
+ return ret;
+}
+
BOOL torture_rpc_dfs(int dummy)
{
NTSTATUS status;