diff options
-rw-r--r-- | source4/librpc/idl/srvsvc.idl | 10 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_srvsvc.c | 149 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_srvsvc.h | 10 | ||||
-rw-r--r-- | source4/torture/rpc/srvsvc.c | 2 |
4 files changed, 170 insertions, 1 deletions
diff --git a/source4/librpc/idl/srvsvc.idl b/source4/librpc/idl/srvsvc.idl index 868888f5cc..31399520c0 100644 --- a/source4/librpc/idl/srvsvc.idl +++ b/source4/librpc/idl/srvsvc.idl @@ -310,12 +310,22 @@ [size_is(count)] srvsvc_NetShare502 *array; } srvsvc_NetShareCtr502; + typedef struct { + unistr *comment; + } srvsvc_NetShare1004; + + typedef struct { + uint32 count; + [size_is(count)] srvsvc_NetShare1004 *array; + } srvsvc_NetShareCtr1004; + typedef union { [case(0)] srvsvc_NetShareCtr0 *ctr0; [case(1)] srvsvc_NetShareCtr1 *ctr1; [case(2)] srvsvc_NetShareCtr2 *ctr2; [case(501)] srvsvc_NetShareCtr501 *ctr501; [case(502)] srvsvc_NetShareCtr502 *ctr502; + [case(1004)] srvsvc_NetShareCtr1004 *ctr1004; [default] ; } srvsvc_NetShareCtr; diff --git a/source4/librpc/ndr/ndr_srvsvc.c b/source4/librpc/ndr/ndr_srvsvc.c index 645a5572cc..50aece53a4 100644 --- a/source4/librpc/ndr/ndr_srvsvc.c +++ b/source4/librpc/ndr/ndr_srvsvc.c @@ -877,6 +877,40 @@ done: return NT_STATUS_OK; } +NTSTATUS ndr_push_srvsvc_NetShare1004(struct ndr_push *ndr, int ndr_flags, struct srvsvc_NetShare1004 *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_ptr(ndr, r->comment)); + ndr_push_struct_end(ndr); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; + if (r->comment) { + NDR_CHECK(ndr_push_unistr(ndr, r->comment)); + } +done: + return NT_STATUS_OK; +} + +NTSTATUS ndr_push_srvsvc_NetShareCtr1004(struct ndr_push *ndr, int ndr_flags, struct srvsvc_NetShareCtr1004 *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->count)); + NDR_CHECK(ndr_push_ptr(ndr, r->array)); + ndr_push_struct_end(ndr); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; + if (r->array) { + NDR_CHECK(ndr_push_uint32(ndr, r->count)); + NDR_CHECK(ndr_push_array(ndr, NDR_SCALARS|NDR_BUFFERS, r->array, sizeof(r->array[0]), r->count, (ndr_push_flags_fn_t)ndr_push_srvsvc_NetShare1004)); + } +done: + return NT_STATUS_OK; +} + NTSTATUS ndr_push_srvsvc_NetShareCtr(struct ndr_push *ndr, int ndr_flags, uint16 level, union srvsvc_NetShareCtr *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -902,6 +936,10 @@ NTSTATUS ndr_push_srvsvc_NetShareCtr(struct ndr_push *ndr, int ndr_flags, uint16 NDR_CHECK(ndr_push_ptr(ndr, r->ctr502)); break; + case 1004: + NDR_CHECK(ndr_push_ptr(ndr, r->ctr1004)); + break; + default: break; @@ -940,6 +978,12 @@ buffers: } break; + case 1004: + if (r->ctr1004) { + NDR_CHECK(ndr_push_srvsvc_NetShareCtr1004(ndr, NDR_SCALARS|NDR_BUFFERS, r->ctr1004)); + } + break; + default: break; @@ -2646,6 +2690,59 @@ done: return NT_STATUS_OK; } +NTSTATUS ndr_pull_srvsvc_NetShare1004(struct ndr_pull *ndr, int ndr_flags, struct srvsvc_NetShare1004 *r) +{ + uint32 _ptr_comment; + NDR_CHECK(ndr_pull_struct_start(ndr)); + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_comment)); + if (_ptr_comment) { + NDR_ALLOC(ndr, r->comment); + } else { + r->comment = NULL; + } + ndr_pull_struct_end(ndr); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; + if (r->comment) { + NDR_CHECK(ndr_pull_unistr(ndr, &r->comment)); + } +done: + return NT_STATUS_OK; +} + +NTSTATUS ndr_pull_srvsvc_NetShareCtr1004(struct ndr_pull *ndr, int ndr_flags, struct srvsvc_NetShareCtr1004 *r) +{ + uint32 _ptr_array; + NDR_CHECK(ndr_pull_struct_start(ndr)); + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, &r->count)); + NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_array)); + if (_ptr_array) { + NDR_ALLOC(ndr, r->array); + } else { + r->array = NULL; + } + ndr_pull_struct_end(ndr); +buffers: + if (!(ndr_flags & NDR_BUFFERS)) goto done; + if (r->array) { + { + 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->array, r->count, sizeof(r->array[0])); + NDR_CHECK(ndr_pull_array(ndr, NDR_SCALARS|NDR_BUFFERS, (void **)r->array, sizeof(r->array[0]), r->count, (ndr_pull_flags_fn_t)ndr_pull_srvsvc_NetShare1004)); + } +done: + return NT_STATUS_OK; +} + NTSTATUS ndr_pull_srvsvc_NetShareCtr(struct ndr_pull *ndr, int ndr_flags, uint16 level, union srvsvc_NetShareCtr *r) { if (!(ndr_flags & NDR_SCALARS)) goto buffers; @@ -2701,6 +2798,16 @@ NTSTATUS ndr_pull_srvsvc_NetShareCtr(struct ndr_pull *ndr, int ndr_flags, uint16 } break; } + case 1004: { + uint32 _ptr_ctr1004; + NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_ctr1004)); + if (_ptr_ctr1004) { + NDR_ALLOC(ndr, r->ctr1004); + } else { + r->ctr1004 = NULL; + } + break; } + default: { break; } @@ -2739,6 +2846,12 @@ buffers: } break; + case 1004: + if (r->ctr1004) { + NDR_CHECK(ndr_pull_srvsvc_NetShareCtr1004(ndr, NDR_SCALARS|NDR_BUFFERS, r->ctr1004)); + } + break; + default: break; @@ -4378,6 +4491,33 @@ void ndr_print_srvsvc_NetShareCtr502(struct ndr_print *ndr, const char *name, st ndr->depth--; } +void ndr_print_srvsvc_NetShare1004(struct ndr_print *ndr, const char *name, struct srvsvc_NetShare1004 *r) +{ + ndr_print_struct(ndr, name, "srvsvc_NetShare1004"); + ndr->depth++; + ndr_print_ptr(ndr, "comment", r->comment); + ndr->depth++; + if (r->comment) { + ndr_print_unistr(ndr, "comment", r->comment); + } + ndr->depth--; + 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_NetShareCtr(struct ndr_print *ndr, const char *name, uint16 level, union srvsvc_NetShareCtr *r) { ndr_print_union(ndr, name, level, "srvsvc_NetShareCtr"); @@ -4427,6 +4567,15 @@ void ndr_print_srvsvc_NetShareCtr(struct ndr_print *ndr, const char *name, uint1 ndr->depth--; break; + case 1004: + ndr_print_ptr(ndr, "ctr1004", r->ctr1004); + ndr->depth++; + if (r->ctr1004) { + ndr_print_srvsvc_NetShareCtr1004(ndr, "ctr1004", r->ctr1004); + } + ndr->depth--; + break; + default: break; diff --git a/source4/librpc/ndr/ndr_srvsvc.h b/source4/librpc/ndr/ndr_srvsvc.h index bae4543254..881ed80c01 100644 --- a/source4/librpc/ndr/ndr_srvsvc.h +++ b/source4/librpc/ndr/ndr_srvsvc.h @@ -425,12 +425,22 @@ struct srvsvc_NetShareCtr502 { struct srvsvc_NetShare502 *array; }; +struct srvsvc_NetShare1004 { + const char *comment; +}; + +struct srvsvc_NetShareCtr1004 { + uint32 count; + struct srvsvc_NetShare1004 *array; +}; + union srvsvc_NetShareCtr { /* [case(0)] */ struct srvsvc_NetShareCtr0 *ctr0; /* [case(1)] */ struct srvsvc_NetShareCtr1 *ctr1; /* [case(2)] */ struct srvsvc_NetShareCtr2 *ctr2; /* [case(501)] */ struct srvsvc_NetShareCtr501 *ctr501; /* [case(502)] */ struct srvsvc_NetShareCtr502 *ctr502; +/* [case(1004)] */ struct srvsvc_NetShareCtr1004 *ctr1004; /* [case(default)] */ }; struct srvsvc_NetShareEnumAll { diff --git a/source4/torture/rpc/srvsvc.c b/source4/torture/rpc/srvsvc.c index 45103b8188..7111d59a3d 100644 --- a/source4/torture/rpc/srvsvc.c +++ b/source4/torture/rpc/srvsvc.c @@ -123,7 +123,7 @@ static BOOL test_NetShareEnumAll(struct dcerpc_pipe *p, NTSTATUS status; struct srvsvc_NetShareEnumAll r; struct srvsvc_NetShareCtr0 c0; - uint32 levels[] = {0, 1, 2, 501, 502}; + uint32 levels[] = {0, 1, 2, 501, 502, 1004}; int i; BOOL ret = True; |