diff options
-rw-r--r-- | source3/librpc/gen_ndr/ndr_dfs.c | 87 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ndr_echo.c | 100 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ndr_lsa.c | 108 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ndr_netlogon.c | 294 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ndr_samr.c | 147 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ndr_svcctl.c | 264 | ||||
-rw-r--r-- | source3/librpc/gen_ndr/ndr_wkssvc.c | 257 |
7 files changed, 799 insertions, 458 deletions
diff --git a/source3/librpc/gen_ndr/ndr_dfs.c b/source3/librpc/gen_ndr/ndr_dfs.c index dee32485be..c373a4364c 100644 --- a/source3/librpc/gen_ndr/ndr_dfs.c +++ b/source3/librpc/gen_ndr/ndr_dfs.c @@ -4974,14 +4974,13 @@ static enum ndr_err_code ndr_push_dfs_GetDcAddress(struct ndr_push *ndr, int fla if (r->in.server_fullname == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->in.server_fullname == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->in.server_fullname)); + if (*r->in.server_fullname) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->in.server_fullname, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->in.server_fullname, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->in.server_fullname, ndr_charset_length(*r->in.server_fullname, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->in.server_fullname, CH_UTF16))); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->in.server_fullname, CH_UTF16))); - NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->in.server_fullname, ndr_charset_length(*r->in.server_fullname, CH_UTF16), sizeof(uint16_t), CH_UTF16)); if (r->in.is_root == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } @@ -4995,14 +4994,13 @@ static enum ndr_err_code ndr_push_dfs_GetDcAddress(struct ndr_push *ndr, int fla if (r->out.server_fullname == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.server_fullname == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.server_fullname)); + if (*r->out.server_fullname) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.server_fullname, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.server_fullname, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.server_fullname, ndr_charset_length(*r->out.server_fullname, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.server_fullname, CH_UTF16))); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.server_fullname, CH_UTF16))); - NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.server_fullname, ndr_charset_length(*r->out.server_fullname, CH_UTF16), sizeof(uint16_t), CH_UTF16)); if (r->out.is_root == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } @@ -5020,6 +5018,7 @@ static enum ndr_err_code ndr_pull_dfs_GetDcAddress(struct ndr_pull *ndr, int fla { uint32_t _ptr_server_fullname; TALLOC_CTX *_mem_save_server_fullname_0; + TALLOC_CTX *_mem_save_server_fullname_1; TALLOC_CTX *_mem_save_is_root_0; TALLOC_CTX *_mem_save_ttl_0; if (flags & NDR_IN) { @@ -5037,14 +5036,24 @@ static enum ndr_err_code ndr_pull_dfs_GetDcAddress(struct ndr_pull *ndr, int fla } _mem_save_server_fullname_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->in.server_fullname, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_server_fullname)); - NDR_CHECK(ndr_pull_array_size(ndr, r->in.server_fullname)); - NDR_CHECK(ndr_pull_array_length(ndr, r->in.server_fullname)); - if (ndr_get_array_length(ndr, r->in.server_fullname) > ndr_get_array_size(ndr, r->in.server_fullname)) { - return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->in.server_fullname), ndr_get_array_length(ndr, r->in.server_fullname)); - } - NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->in.server_fullname), sizeof(uint16_t))); - NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->in.server_fullname, ndr_get_array_length(ndr, r->in.server_fullname), sizeof(uint16_t), CH_UTF16)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_fullname)); + if (_ptr_server_fullname) { + NDR_PULL_ALLOC(ndr, *r->in.server_fullname); + } else { + *r->in.server_fullname = NULL; + } + if (*r->in.server_fullname) { + _mem_save_server_fullname_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->in.server_fullname, 0); + NDR_CHECK(ndr_pull_array_size(ndr, r->in.server_fullname)); + NDR_CHECK(ndr_pull_array_length(ndr, r->in.server_fullname)); + if (ndr_get_array_length(ndr, r->in.server_fullname) > ndr_get_array_size(ndr, r->in.server_fullname)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->in.server_fullname), ndr_get_array_length(ndr, r->in.server_fullname)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->in.server_fullname), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->in.server_fullname, ndr_get_array_length(ndr, r->in.server_fullname), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_fullname_1, 0); + } NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_fullname_0, LIBNDR_FLAG_REF_ALLOC); if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->in.is_root); @@ -5073,14 +5082,24 @@ static enum ndr_err_code ndr_pull_dfs_GetDcAddress(struct ndr_pull *ndr, int fla } _mem_save_server_fullname_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.server_fullname, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_server_fullname)); - NDR_CHECK(ndr_pull_array_size(ndr, r->out.server_fullname)); - NDR_CHECK(ndr_pull_array_length(ndr, r->out.server_fullname)); - if (ndr_get_array_length(ndr, r->out.server_fullname) > ndr_get_array_size(ndr, r->out.server_fullname)) { - return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.server_fullname), ndr_get_array_length(ndr, r->out.server_fullname)); - } - NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.server_fullname), sizeof(uint16_t))); - NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.server_fullname, ndr_get_array_length(ndr, r->out.server_fullname), sizeof(uint16_t), CH_UTF16)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_fullname)); + if (_ptr_server_fullname) { + NDR_PULL_ALLOC(ndr, *r->out.server_fullname); + } else { + *r->out.server_fullname = NULL; + } + if (*r->out.server_fullname) { + _mem_save_server_fullname_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.server_fullname, 0); + NDR_CHECK(ndr_pull_array_size(ndr, r->out.server_fullname)); + NDR_CHECK(ndr_pull_array_length(ndr, r->out.server_fullname)); + if (ndr_get_array_length(ndr, r->out.server_fullname) > ndr_get_array_size(ndr, r->out.server_fullname)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.server_fullname), ndr_get_array_length(ndr, r->out.server_fullname)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.server_fullname), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.server_fullname, ndr_get_array_length(ndr, r->out.server_fullname), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_fullname_1, 0); + } NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_fullname_0, LIBNDR_FLAG_REF_ALLOC); if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.is_root); @@ -5116,7 +5135,9 @@ _PUBLIC_ void ndr_print_dfs_GetDcAddress(struct ndr_print *ndr, const char *name ndr->depth++; ndr_print_ptr(ndr, "server_fullname", *r->in.server_fullname); ndr->depth++; - ndr_print_string(ndr, "server_fullname", *r->in.server_fullname); + if (*r->in.server_fullname) { + ndr_print_string(ndr, "server_fullname", *r->in.server_fullname); + } ndr->depth--; ndr->depth--; ndr_print_ptr(ndr, "is_root", r->in.is_root); @@ -5136,7 +5157,9 @@ _PUBLIC_ void ndr_print_dfs_GetDcAddress(struct ndr_print *ndr, const char *name ndr->depth++; ndr_print_ptr(ndr, "server_fullname", *r->out.server_fullname); ndr->depth++; - ndr_print_string(ndr, "server_fullname", *r->out.server_fullname); + if (*r->out.server_fullname) { + ndr_print_string(ndr, "server_fullname", *r->out.server_fullname); + } ndr->depth--; ndr->depth--; ndr_print_ptr(ndr, "is_root", r->out.is_root); diff --git a/source3/librpc/gen_ndr/ndr_echo.c b/source3/librpc/gen_ndr/ndr_echo.c index 29a10220e5..dda9813e23 100644 --- a/source3/librpc/gen_ndr/ndr_echo.c +++ b/source3/librpc/gen_ndr/ndr_echo.c @@ -876,14 +876,13 @@ static enum ndr_err_code ndr_push_echo_TestCall(struct ndr_push *ndr, int flags, if (r->out.s2 == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.s2 == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.s2)); + if (*r->out.s2) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.s2, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.s2, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.s2, ndr_charset_length(*r->out.s2, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.s2, CH_UTF16))); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.s2, CH_UTF16))); - NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.s2, ndr_charset_length(*r->out.s2, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } return NDR_ERR_SUCCESS; } @@ -892,6 +891,7 @@ static enum ndr_err_code ndr_pull_echo_TestCall(struct ndr_pull *ndr, int flags, { uint32_t _ptr_s2; TALLOC_CTX *_mem_save_s2_0; + TALLOC_CTX *_mem_save_s2_1; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -911,14 +911,24 @@ static enum ndr_err_code ndr_pull_echo_TestCall(struct ndr_pull *ndr, int flags, } _mem_save_s2_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.s2, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_s2)); - NDR_CHECK(ndr_pull_array_size(ndr, r->out.s2)); - NDR_CHECK(ndr_pull_array_length(ndr, r->out.s2)); - if (ndr_get_array_length(ndr, r->out.s2) > ndr_get_array_size(ndr, r->out.s2)) { - return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.s2), ndr_get_array_length(ndr, r->out.s2)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_s2)); + if (_ptr_s2) { + NDR_PULL_ALLOC(ndr, *r->out.s2); + } else { + *r->out.s2 = NULL; + } + if (*r->out.s2) { + _mem_save_s2_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.s2, 0); + NDR_CHECK(ndr_pull_array_size(ndr, r->out.s2)); + NDR_CHECK(ndr_pull_array_length(ndr, r->out.s2)); + if (ndr_get_array_length(ndr, r->out.s2) > ndr_get_array_size(ndr, r->out.s2)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.s2), ndr_get_array_length(ndr, r->out.s2)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.s2), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.s2, ndr_get_array_length(ndr, r->out.s2), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_s2_1, 0); } - NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.s2), sizeof(uint16_t))); - NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.s2, ndr_get_array_length(ndr, r->out.s2), sizeof(uint16_t), CH_UTF16)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_s2_0, LIBNDR_FLAG_REF_ALLOC); } return NDR_ERR_SUCCESS; @@ -947,7 +957,9 @@ _PUBLIC_ void ndr_print_echo_TestCall(struct ndr_print *ndr, const char *name, i ndr->depth++; ndr_print_ptr(ndr, "s2", *r->out.s2); ndr->depth++; - ndr_print_string(ndr, "s2", *r->out.s2); + if (*r->out.s2) { + ndr_print_string(ndr, "s2", *r->out.s2); + } ndr->depth--; ndr->depth--; ndr->depth--; @@ -1290,15 +1302,13 @@ static enum ndr_err_code ndr_push_echo_TestDoublePointer(struct ndr_push *ndr, i if (r->in.data == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->in.data == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); - } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - if (**r->in.data == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->in.data)); + if (*r->in.data) { + NDR_CHECK(ndr_push_unique_ptr(ndr, **r->in.data)); + if (**r->in.data) { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ***r->in.data)); + } } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ***r->in.data)); } if (flags & NDR_OUT) { NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->out.result)); @@ -1318,21 +1328,29 @@ static enum ndr_err_code ndr_pull_echo_TestDoublePointer(struct ndr_pull *ndr, i } _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->in.data, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_data)); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data)); + if (_ptr_data) { NDR_PULL_ALLOC(ndr, *r->in.data); + } else { + *r->in.data = NULL; } - _mem_save_data_1 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, *r->in.data, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_data)); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { - NDR_PULL_ALLOC(ndr, **r->in.data); + if (*r->in.data) { + _mem_save_data_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->in.data, 0); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data)); + if (_ptr_data) { + NDR_PULL_ALLOC(ndr, **r->in.data); + } else { + **r->in.data = NULL; + } + if (**r->in.data) { + _mem_save_data_2 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, **r->in.data, 0); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, **r->in.data)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_2, 0); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_1, 0); } - _mem_save_data_2 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, **r->in.data, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, **r->in.data)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_2, LIBNDR_FLAG_REF_ALLOC); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_1, LIBNDR_FLAG_REF_ALLOC); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, LIBNDR_FLAG_REF_ALLOC); } if (flags & NDR_OUT) { @@ -1355,10 +1373,14 @@ _PUBLIC_ void ndr_print_echo_TestDoublePointer(struct ndr_print *ndr, const char ndr->depth++; ndr_print_ptr(ndr, "data", *r->in.data); ndr->depth++; - ndr_print_ptr(ndr, "data", **r->in.data); - ndr->depth++; - ndr_print_uint16(ndr, "data", ***r->in.data); - ndr->depth--; + if (*r->in.data) { + ndr_print_ptr(ndr, "data", **r->in.data); + ndr->depth++; + if (**r->in.data) { + ndr_print_uint16(ndr, "data", ***r->in.data); + } + ndr->depth--; + } ndr->depth--; ndr->depth--; ndr->depth--; diff --git a/source3/librpc/gen_ndr/ndr_lsa.c b/source3/librpc/gen_ndr/ndr_lsa.c index 89b7da5785..e934ca87c2 100644 --- a/source3/librpc/gen_ndr/ndr_lsa.c +++ b/source3/librpc/gen_ndr/ndr_lsa.c @@ -4771,11 +4771,10 @@ static enum ndr_err_code ndr_push_lsa_QuerySecurity(struct ndr_push *ndr, int fl if (r->out.sdbuf == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.sdbuf == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.sdbuf)); + if (*r->out.sdbuf) { + NDR_CHECK(ndr_push_sec_desc_buf(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.sdbuf)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_sec_desc_buf(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.sdbuf)); NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -4807,14 +4806,18 @@ static enum ndr_err_code ndr_pull_lsa_QuerySecurity(struct ndr_pull *ndr, int fl } _mem_save_sdbuf_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.sdbuf, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_sdbuf)); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sdbuf)); + if (_ptr_sdbuf) { NDR_PULL_ALLOC(ndr, *r->out.sdbuf); + } else { + *r->out.sdbuf = NULL; + } + if (*r->out.sdbuf) { + _mem_save_sdbuf_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.sdbuf, 0); + NDR_CHECK(ndr_pull_sec_desc_buf(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.sdbuf)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sdbuf_1, 0); } - _mem_save_sdbuf_1 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, *r->out.sdbuf, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_sec_desc_buf(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.sdbuf)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sdbuf_1, LIBNDR_FLAG_REF_ALLOC); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sdbuf_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); } @@ -4845,7 +4848,9 @@ _PUBLIC_ void ndr_print_lsa_QuerySecurity(struct ndr_print *ndr, const char *nam ndr->depth++; ndr_print_ptr(ndr, "sdbuf", *r->out.sdbuf); ndr->depth++; - ndr_print_sec_desc_buf(ndr, "sdbuf", *r->out.sdbuf); + if (*r->out.sdbuf) { + ndr_print_sec_desc_buf(ndr, "sdbuf", *r->out.sdbuf); + } ndr->depth--; ndr->depth--; ndr_print_NTSTATUS(ndr, "result", r->out.result); @@ -7640,21 +7645,19 @@ static enum ndr_err_code ndr_push_lsa_DeleteObject(struct ndr_push *ndr, int fla if (r->in.handle == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->in.handle == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->in.handle)); + if (*r->in.handle) { + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->in.handle)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->in.handle)); } if (flags & NDR_OUT) { if (r->out.handle == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.handle == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.handle)); + if (*r->out.handle) { + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.handle)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.handle)); NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -7673,14 +7676,18 @@ static enum ndr_err_code ndr_pull_lsa_DeleteObject(struct ndr_pull *ndr, int fla } _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_handle)); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_handle)); + if (_ptr_handle) { NDR_PULL_ALLOC(ndr, *r->in.handle); + } else { + *r->in.handle = NULL; + } + if (*r->in.handle) { + _mem_save_handle_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->in.handle, 0); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_1, 0); } - _mem_save_handle_1 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, *r->in.handle, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->in.handle)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_1, LIBNDR_FLAG_REF_ALLOC); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); NDR_PULL_ALLOC(ndr, r->out.handle); *r->out.handle = *r->in.handle; @@ -7691,14 +7698,18 @@ static enum ndr_err_code ndr_pull_lsa_DeleteObject(struct ndr_pull *ndr, int fla } _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_handle)); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_handle)); + if (_ptr_handle) { NDR_PULL_ALLOC(ndr, *r->out.handle); + } else { + *r->out.handle = NULL; + } + if (*r->out.handle) { + _mem_save_handle_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.handle, 0); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_1, 0); } - _mem_save_handle_1 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, *r->out.handle, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.handle)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_1, LIBNDR_FLAG_REF_ALLOC); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); } @@ -7719,7 +7730,9 @@ _PUBLIC_ void ndr_print_lsa_DeleteObject(struct ndr_print *ndr, const char *name ndr->depth++; ndr_print_ptr(ndr, "handle", *r->in.handle); ndr->depth++; - ndr_print_policy_handle(ndr, "handle", *r->in.handle); + if (*r->in.handle) { + ndr_print_policy_handle(ndr, "handle", *r->in.handle); + } ndr->depth--; ndr->depth--; ndr->depth--; @@ -7731,7 +7744,9 @@ _PUBLIC_ void ndr_print_lsa_DeleteObject(struct ndr_print *ndr, const char *name ndr->depth++; ndr_print_ptr(ndr, "handle", *r->out.handle); ndr->depth++; - ndr_print_policy_handle(ndr, "handle", *r->out.handle); + if (*r->out.handle) { + ndr_print_policy_handle(ndr, "handle", *r->out.handle); + } ndr->depth--; ndr->depth--; ndr_print_NTSTATUS(ndr, "result", r->out.result); @@ -10701,11 +10716,10 @@ static enum ndr_err_code ndr_push_lsa_lsaRQueryForestTrustInformation(struct ndr if (r->out.forest_trust_info == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.forest_trust_info == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.forest_trust_info)); + if (*r->out.forest_trust_info) { + NDR_CHECK(ndr_push_lsa_ForestTrustInformation(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.forest_trust_info)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_lsa_ForestTrustInformation(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.forest_trust_info)); NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -10745,14 +10759,18 @@ static enum ndr_err_code ndr_pull_lsa_lsaRQueryForestTrustInformation(struct ndr } _mem_save_forest_trust_info_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.forest_trust_info, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_forest_trust_info)); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_forest_trust_info)); + if (_ptr_forest_trust_info) { NDR_PULL_ALLOC(ndr, *r->out.forest_trust_info); + } else { + *r->out.forest_trust_info = NULL; + } + if (*r->out.forest_trust_info) { + _mem_save_forest_trust_info_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.forest_trust_info, 0); + NDR_CHECK(ndr_pull_lsa_ForestTrustInformation(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.forest_trust_info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_forest_trust_info_1, 0); } - _mem_save_forest_trust_info_1 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, *r->out.forest_trust_info, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_lsa_ForestTrustInformation(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.forest_trust_info)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_forest_trust_info_1, LIBNDR_FLAG_REF_ALLOC); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_forest_trust_info_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); } @@ -10787,7 +10805,9 @@ _PUBLIC_ void ndr_print_lsa_lsaRQueryForestTrustInformation(struct ndr_print *nd ndr->depth++; ndr_print_ptr(ndr, "forest_trust_info", *r->out.forest_trust_info); ndr->depth++; - ndr_print_lsa_ForestTrustInformation(ndr, "forest_trust_info", *r->out.forest_trust_info); + if (*r->out.forest_trust_info) { + ndr_print_lsa_ForestTrustInformation(ndr, "forest_trust_info", *r->out.forest_trust_info); + } ndr->depth--; ndr->depth--; ndr_print_NTSTATUS(ndr, "result", r->out.result); diff --git a/source3/librpc/gen_ndr/ndr_netlogon.c b/source3/librpc/gen_ndr/ndr_netlogon.c index 2d41a2675e..eabbc337fc 100644 --- a/source3/librpc/gen_ndr/ndr_netlogon.c +++ b/source3/librpc/gen_ndr/ndr_netlogon.c @@ -9777,14 +9777,13 @@ static enum ndr_err_code ndr_push_netr_GetDcName(struct ndr_push *ndr, int flags if (r->out.dcname == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.dcname == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.dcname)); + if (*r->out.dcname) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.dcname, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.dcname, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.dcname, ndr_charset_length(*r->out.dcname, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.dcname, CH_UTF16))); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.dcname, CH_UTF16))); - NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.dcname, ndr_charset_length(*r->out.dcname, CH_UTF16), sizeof(uint16_t), CH_UTF16)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -9796,6 +9795,7 @@ static enum ndr_err_code ndr_pull_netr_GetDcName(struct ndr_pull *ndr, int flags uint32_t _ptr_dcname; TALLOC_CTX *_mem_save_domainname_0; TALLOC_CTX *_mem_save_dcname_0; + TALLOC_CTX *_mem_save_dcname_1; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -9833,14 +9833,24 @@ static enum ndr_err_code ndr_pull_netr_GetDcName(struct ndr_pull *ndr, int flags } _mem_save_dcname_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.dcname, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_dcname)); - NDR_CHECK(ndr_pull_array_size(ndr, r->out.dcname)); - NDR_CHECK(ndr_pull_array_length(ndr, r->out.dcname)); - if (ndr_get_array_length(ndr, r->out.dcname) > ndr_get_array_size(ndr, r->out.dcname)) { - return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.dcname), ndr_get_array_length(ndr, r->out.dcname)); - } - NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.dcname), sizeof(uint16_t))); - NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.dcname, ndr_get_array_length(ndr, r->out.dcname), sizeof(uint16_t), CH_UTF16)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_dcname)); + if (_ptr_dcname) { + NDR_PULL_ALLOC(ndr, *r->out.dcname); + } else { + *r->out.dcname = NULL; + } + if (*r->out.dcname) { + _mem_save_dcname_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.dcname, 0); + NDR_CHECK(ndr_pull_array_size(ndr, r->out.dcname)); + NDR_CHECK(ndr_pull_array_length(ndr, r->out.dcname)); + if (ndr_get_array_length(ndr, r->out.dcname) > ndr_get_array_size(ndr, r->out.dcname)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.dcname), ndr_get_array_length(ndr, r->out.dcname)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.dcname), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.dcname, ndr_get_array_length(ndr, r->out.dcname), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dcname_1, 0); + } NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dcname_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } @@ -9873,7 +9883,9 @@ _PUBLIC_ void ndr_print_netr_GetDcName(struct ndr_print *ndr, const char *name, ndr->depth++; ndr_print_ptr(ndr, "dcname", *r->out.dcname); ndr->depth++; - ndr_print_string(ndr, "dcname", *r->out.dcname); + if (*r->out.dcname) { + ndr_print_string(ndr, "dcname", *r->out.dcname); + } ndr->depth--; ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); @@ -10007,14 +10019,13 @@ static enum ndr_err_code ndr_push_netr_GetAnyDCName(struct ndr_push *ndr, int fl if (r->out.dcname == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.dcname == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.dcname)); + if (*r->out.dcname) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.dcname, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.dcname, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.dcname, ndr_charset_length(*r->out.dcname, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.dcname, CH_UTF16))); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.dcname, CH_UTF16))); - NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.dcname, ndr_charset_length(*r->out.dcname, CH_UTF16), sizeof(uint16_t), CH_UTF16)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -10028,6 +10039,7 @@ static enum ndr_err_code ndr_pull_netr_GetAnyDCName(struct ndr_pull *ndr, int fl TALLOC_CTX *_mem_save_logon_server_0; TALLOC_CTX *_mem_save_domainname_0; TALLOC_CTX *_mem_save_dcname_0; + TALLOC_CTX *_mem_save_dcname_1; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -10076,14 +10088,24 @@ static enum ndr_err_code ndr_pull_netr_GetAnyDCName(struct ndr_pull *ndr, int fl } _mem_save_dcname_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.dcname, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_dcname)); - NDR_CHECK(ndr_pull_array_size(ndr, r->out.dcname)); - NDR_CHECK(ndr_pull_array_length(ndr, r->out.dcname)); - if (ndr_get_array_length(ndr, r->out.dcname) > ndr_get_array_size(ndr, r->out.dcname)) { - return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.dcname), ndr_get_array_length(ndr, r->out.dcname)); - } - NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.dcname), sizeof(uint16_t))); - NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.dcname, ndr_get_array_length(ndr, r->out.dcname), sizeof(uint16_t), CH_UTF16)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_dcname)); + if (_ptr_dcname) { + NDR_PULL_ALLOC(ndr, *r->out.dcname); + } else { + *r->out.dcname = NULL; + } + if (*r->out.dcname) { + _mem_save_dcname_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.dcname, 0); + NDR_CHECK(ndr_pull_array_size(ndr, r->out.dcname)); + NDR_CHECK(ndr_pull_array_length(ndr, r->out.dcname)); + if (ndr_get_array_length(ndr, r->out.dcname) > ndr_get_array_size(ndr, r->out.dcname)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.dcname), ndr_get_array_length(ndr, r->out.dcname)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.dcname), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.dcname, ndr_get_array_length(ndr, r->out.dcname), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dcname_1, 0); + } NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dcname_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } @@ -10121,7 +10143,9 @@ _PUBLIC_ void ndr_print_netr_GetAnyDCName(struct ndr_print *ndr, const char *nam ndr->depth++; ndr_print_ptr(ndr, "dcname", *r->out.dcname); ndr->depth++; - ndr_print_string(ndr, "dcname", *r->out.dcname); + if (*r->out.dcname) { + ndr_print_string(ndr, "dcname", *r->out.dcname); + } ndr->depth--; ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); @@ -11618,11 +11642,10 @@ static enum ndr_err_code ndr_push_netr_DsRGetDCNameEx(struct ndr_push *ndr, int if (r->out.info == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.info == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.info)); + if (*r->out.info) { + NDR_CHECK(ndr_push_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.info)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.info)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -11720,14 +11743,18 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCNameEx(struct ndr_pull *ndr, int } _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_info)); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info)); + if (_ptr_info) { NDR_PULL_ALLOC(ndr, *r->out.info); + } else { + *r->out.info = NULL; + } + if (*r->out.info) { + _mem_save_info_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.info, 0); + NDR_CHECK(ndr_pull_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_1, 0); } - _mem_save_info_1 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, *r->out.info, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.info)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_1, LIBNDR_FLAG_REF_ALLOC); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } @@ -11778,7 +11805,9 @@ _PUBLIC_ void ndr_print_netr_DsRGetDCNameEx(struct ndr_print *ndr, const char *n ndr->depth++; ndr_print_ptr(ndr, "info", *r->out.info); ndr->depth++; - ndr_print_netr_DsRGetDCNameInfo(ndr, "info", *r->out.info); + if (*r->out.info) { + ndr_print_netr_DsRGetDCNameInfo(ndr, "info", *r->out.info); + } ndr->depth--; ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); @@ -11802,14 +11831,13 @@ static enum ndr_err_code ndr_push_netr_DsRGetSiteName(struct ndr_push *ndr, int if (r->out.site == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.site == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.site)); + if (*r->out.site) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.site, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.site, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.site, ndr_charset_length(*r->out.site, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.site, CH_UTF16))); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.site, CH_UTF16))); - NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.site, ndr_charset_length(*r->out.site, CH_UTF16), sizeof(uint16_t), CH_UTF16)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -11821,6 +11849,7 @@ static enum ndr_err_code ndr_pull_netr_DsRGetSiteName(struct ndr_pull *ndr, int uint32_t _ptr_site; TALLOC_CTX *_mem_save_computer_name_0; TALLOC_CTX *_mem_save_site_0; + TALLOC_CTX *_mem_save_site_1; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -11851,14 +11880,24 @@ static enum ndr_err_code ndr_pull_netr_DsRGetSiteName(struct ndr_pull *ndr, int } _mem_save_site_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.site, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_site)); - NDR_CHECK(ndr_pull_array_size(ndr, r->out.site)); - NDR_CHECK(ndr_pull_array_length(ndr, r->out.site)); - if (ndr_get_array_length(ndr, r->out.site) > ndr_get_array_size(ndr, r->out.site)) { - return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.site), ndr_get_array_length(ndr, r->out.site)); - } - NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.site), sizeof(uint16_t))); - NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.site, ndr_get_array_length(ndr, r->out.site), sizeof(uint16_t), CH_UTF16)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_site)); + if (_ptr_site) { + NDR_PULL_ALLOC(ndr, *r->out.site); + } else { + *r->out.site = NULL; + } + if (*r->out.site) { + _mem_save_site_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.site, 0); + NDR_CHECK(ndr_pull_array_size(ndr, r->out.site)); + NDR_CHECK(ndr_pull_array_length(ndr, r->out.site)); + if (ndr_get_array_length(ndr, r->out.site) > ndr_get_array_size(ndr, r->out.site)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.site), ndr_get_array_length(ndr, r->out.site)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.site), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.site, ndr_get_array_length(ndr, r->out.site), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_site_1, 0); + } NDR_PULL_SET_MEM_CTX(ndr, _mem_save_site_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } @@ -11890,7 +11929,9 @@ _PUBLIC_ void ndr_print_netr_DsRGetSiteName(struct ndr_print *ndr, const char *n ndr->depth++; ndr_print_ptr(ndr, "site", *r->out.site); ndr->depth++; - ndr_print_string(ndr, "site", *r->out.site); + if (*r->out.site) { + ndr_print_string(ndr, "site", *r->out.site); + } ndr->depth--; ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); @@ -12416,11 +12457,10 @@ static enum ndr_err_code ndr_push_netr_DsRAddressToSitenamesW(struct ndr_push *n if (r->out.ctr == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.ctr == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.ctr)); + if (*r->out.ctr) { + NDR_CHECK(ndr_push_netr_DsRAddressToSitenamesWCtr(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.ctr)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_netr_DsRAddressToSitenamesWCtr(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.ctr)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -12485,14 +12525,18 @@ static enum ndr_err_code ndr_pull_netr_DsRAddressToSitenamesW(struct ndr_pull *n } _mem_save_ctr_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.ctr, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_ctr)); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_ctr)); + if (_ptr_ctr) { NDR_PULL_ALLOC(ndr, *r->out.ctr); + } else { + *r->out.ctr = NULL; + } + if (*r->out.ctr) { + _mem_save_ctr_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.ctr, 0); + NDR_CHECK(ndr_pull_netr_DsRAddressToSitenamesWCtr(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.ctr)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr_1, 0); } - _mem_save_ctr_1 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, *r->out.ctr, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_netr_DsRAddressToSitenamesWCtr(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.ctr)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr_1, LIBNDR_FLAG_REF_ALLOC); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } @@ -12540,7 +12584,9 @@ _PUBLIC_ void ndr_print_netr_DsRAddressToSitenamesW(struct ndr_print *ndr, const ndr->depth++; ndr_print_ptr(ndr, "ctr", *r->out.ctr); ndr->depth++; - ndr_print_netr_DsRAddressToSitenamesWCtr(ndr, "ctr", *r->out.ctr); + if (*r->out.ctr) { + ndr_print_netr_DsRAddressToSitenamesWCtr(ndr, "ctr", *r->out.ctr); + } ndr->depth--; ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); @@ -12591,11 +12637,10 @@ static enum ndr_err_code ndr_push_netr_DsRGetDCNameEx2(struct ndr_push *ndr, int if (r->out.info == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.info == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.info)); + if (*r->out.info) { + NDR_CHECK(ndr_push_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.info)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.info)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -12714,14 +12759,18 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCNameEx2(struct ndr_pull *ndr, int } _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_info)); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info)); + if (_ptr_info) { NDR_PULL_ALLOC(ndr, *r->out.info); + } else { + *r->out.info = NULL; + } + if (*r->out.info) { + _mem_save_info_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.info, 0); + NDR_CHECK(ndr_pull_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_1, 0); } - _mem_save_info_1 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, *r->out.info, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.info)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_1, LIBNDR_FLAG_REF_ALLOC); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } @@ -12779,7 +12828,9 @@ _PUBLIC_ void ndr_print_netr_DsRGetDCNameEx2(struct ndr_print *ndr, const char * ndr->depth++; ndr_print_ptr(ndr, "info", *r->out.info); ndr->depth++; - ndr_print_netr_DsRGetDCNameInfo(ndr, "info", *r->out.info); + if (*r->out.info) { + ndr_print_netr_DsRGetDCNameInfo(ndr, "info", *r->out.info); + } ndr->depth--; ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); @@ -12950,11 +13001,10 @@ static enum ndr_err_code ndr_push_netr_DsRAddressToSitenamesExW(struct ndr_push if (r->out.ctr == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.ctr == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.ctr)); + if (*r->out.ctr) { + NDR_CHECK(ndr_push_netr_DsRAddressToSitenamesExWCtr(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.ctr)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_netr_DsRAddressToSitenamesExWCtr(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.ctr)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -13019,14 +13069,18 @@ static enum ndr_err_code ndr_pull_netr_DsRAddressToSitenamesExW(struct ndr_pull } _mem_save_ctr_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.ctr, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_ctr)); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_ctr)); + if (_ptr_ctr) { NDR_PULL_ALLOC(ndr, *r->out.ctr); + } else { + *r->out.ctr = NULL; + } + if (*r->out.ctr) { + _mem_save_ctr_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.ctr, 0); + NDR_CHECK(ndr_pull_netr_DsRAddressToSitenamesExWCtr(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.ctr)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr_1, 0); } - _mem_save_ctr_1 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, *r->out.ctr, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_netr_DsRAddressToSitenamesExWCtr(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.ctr)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr_1, LIBNDR_FLAG_REF_ALLOC); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } @@ -13074,7 +13128,9 @@ _PUBLIC_ void ndr_print_netr_DsRAddressToSitenamesExW(struct ndr_print *ndr, con ndr->depth++; ndr_print_ptr(ndr, "ctr", *r->out.ctr); ndr->depth++; - ndr_print_netr_DsRAddressToSitenamesExWCtr(ndr, "ctr", *r->out.ctr); + if (*r->out.ctr) { + ndr_print_netr_DsRAddressToSitenamesExWCtr(ndr, "ctr", *r->out.ctr); + } ndr->depth--; ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); @@ -13836,11 +13892,10 @@ static enum ndr_err_code ndr_push_netr_DsRGetForestTrustInformation(struct ndr_p if (r->out.forest_trust_info == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.forest_trust_info == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.forest_trust_info)); + if (*r->out.forest_trust_info) { + NDR_CHECK(ndr_push_lsa_ForestTrustInformation(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.forest_trust_info)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_lsa_ForestTrustInformation(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.forest_trust_info)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -13904,14 +13959,18 @@ static enum ndr_err_code ndr_pull_netr_DsRGetForestTrustInformation(struct ndr_p } _mem_save_forest_trust_info_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.forest_trust_info, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_forest_trust_info)); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_forest_trust_info)); + if (_ptr_forest_trust_info) { NDR_PULL_ALLOC(ndr, *r->out.forest_trust_info); + } else { + *r->out.forest_trust_info = NULL; + } + if (*r->out.forest_trust_info) { + _mem_save_forest_trust_info_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.forest_trust_info, 0); + NDR_CHECK(ndr_pull_lsa_ForestTrustInformation(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.forest_trust_info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_forest_trust_info_1, 0); } - _mem_save_forest_trust_info_1 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, *r->out.forest_trust_info, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_lsa_ForestTrustInformation(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.forest_trust_info)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_forest_trust_info_1, LIBNDR_FLAG_REF_ALLOC); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_forest_trust_info_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } @@ -13950,7 +14009,9 @@ _PUBLIC_ void ndr_print_netr_DsRGetForestTrustInformation(struct ndr_print *ndr, ndr->depth++; ndr_print_ptr(ndr, "forest_trust_info", *r->out.forest_trust_info); ndr->depth++; - ndr_print_lsa_ForestTrustInformation(ndr, "forest_trust_info", *r->out.forest_trust_info); + if (*r->out.forest_trust_info) { + ndr_print_lsa_ForestTrustInformation(ndr, "forest_trust_info", *r->out.forest_trust_info); + } ndr->depth--; ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); @@ -13990,11 +14051,10 @@ static enum ndr_err_code ndr_push_netr_GetForestTrustInformation(struct ndr_push if (r->out.forest_trust_info == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.forest_trust_info == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.forest_trust_info)); + if (*r->out.forest_trust_info) { + NDR_CHECK(ndr_push_lsa_ForestTrustInformation(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.forest_trust_info)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_lsa_ForestTrustInformation(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.forest_trust_info)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -14063,14 +14123,18 @@ static enum ndr_err_code ndr_pull_netr_GetForestTrustInformation(struct ndr_pull } _mem_save_forest_trust_info_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.forest_trust_info, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_forest_trust_info)); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_forest_trust_info)); + if (_ptr_forest_trust_info) { NDR_PULL_ALLOC(ndr, *r->out.forest_trust_info); + } else { + *r->out.forest_trust_info = NULL; + } + if (*r->out.forest_trust_info) { + _mem_save_forest_trust_info_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.forest_trust_info, 0); + NDR_CHECK(ndr_pull_lsa_ForestTrustInformation(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.forest_trust_info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_forest_trust_info_1, 0); } - _mem_save_forest_trust_info_1 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, *r->out.forest_trust_info, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_lsa_ForestTrustInformation(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.forest_trust_info)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_forest_trust_info_1, LIBNDR_FLAG_REF_ALLOC); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_forest_trust_info_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } @@ -14115,7 +14179,9 @@ _PUBLIC_ void ndr_print_netr_GetForestTrustInformation(struct ndr_print *ndr, co ndr->depth++; ndr_print_ptr(ndr, "forest_trust_info", *r->out.forest_trust_info); ndr->depth++; - ndr_print_lsa_ForestTrustInformation(ndr, "forest_trust_info", *r->out.forest_trust_info); + if (*r->out.forest_trust_info) { + ndr_print_lsa_ForestTrustInformation(ndr, "forest_trust_info", *r->out.forest_trust_info); + } ndr->depth--; ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); diff --git a/source3/librpc/gen_ndr/ndr_samr.c b/source3/librpc/gen_ndr/ndr_samr.c index ff3f0a1c98..a7d9a9d610 100644 --- a/source3/librpc/gen_ndr/ndr_samr.c +++ b/source3/librpc/gen_ndr/ndr_samr.c @@ -5451,11 +5451,10 @@ static enum ndr_err_code ndr_push_samr_QuerySecurity(struct ndr_push *ndr, int f if (r->out.sdbuf == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.sdbuf == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.sdbuf)); + if (*r->out.sdbuf) { + NDR_CHECK(ndr_push_sec_desc_buf(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.sdbuf)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_sec_desc_buf(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.sdbuf)); NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -5487,14 +5486,18 @@ static enum ndr_err_code ndr_pull_samr_QuerySecurity(struct ndr_pull *ndr, int f } _mem_save_sdbuf_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.sdbuf, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_sdbuf)); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sdbuf)); + if (_ptr_sdbuf) { NDR_PULL_ALLOC(ndr, *r->out.sdbuf); + } else { + *r->out.sdbuf = NULL; + } + if (*r->out.sdbuf) { + _mem_save_sdbuf_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.sdbuf, 0); + NDR_CHECK(ndr_pull_sec_desc_buf(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.sdbuf)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sdbuf_1, 0); } - _mem_save_sdbuf_1 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, *r->out.sdbuf, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_sec_desc_buf(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.sdbuf)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sdbuf_1, LIBNDR_FLAG_REF_ALLOC); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sdbuf_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); } @@ -5525,7 +5528,9 @@ _PUBLIC_ void ndr_print_samr_QuerySecurity(struct ndr_print *ndr, const char *na ndr->depth++; ndr_print_ptr(ndr, "sdbuf", *r->out.sdbuf); ndr->depth++; - ndr_print_sec_desc_buf(ndr, "sdbuf", *r->out.sdbuf); + if (*r->out.sdbuf) { + ndr_print_sec_desc_buf(ndr, "sdbuf", *r->out.sdbuf); + } ndr->depth--; ndr->depth--; ndr_print_NTSTATUS(ndr, "result", r->out.result); @@ -5607,11 +5612,10 @@ static enum ndr_err_code ndr_push_samr_LookupDomain(struct ndr_push *ndr, int fl if (r->out.sid == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.sid == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.sid)); + if (*r->out.sid) { + NDR_CHECK(ndr_push_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.sid)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.sid)); NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -5650,14 +5654,18 @@ static enum ndr_err_code ndr_pull_samr_LookupDomain(struct ndr_pull *ndr, int fl } _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.sid, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_sid)); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sid)); + if (_ptr_sid) { NDR_PULL_ALLOC(ndr, *r->out.sid); + } else { + *r->out.sid = NULL; + } + if (*r->out.sid) { + _mem_save_sid_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.sid, 0); + NDR_CHECK(ndr_pull_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.sid)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_1, 0); } - _mem_save_sid_1 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, *r->out.sid, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.sid)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_1, LIBNDR_FLAG_REF_ALLOC); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); } @@ -5691,7 +5699,9 @@ _PUBLIC_ void ndr_print_samr_LookupDomain(struct ndr_print *ndr, const char *nam ndr->depth++; ndr_print_ptr(ndr, "sid", *r->out.sid); ndr->depth++; - ndr_print_dom_sid2(ndr, "sid", *r->out.sid); + if (*r->out.sid) { + ndr_print_dom_sid2(ndr, "sid", *r->out.sid); + } ndr->depth--; ndr->depth--; ndr_print_NTSTATUS(ndr, "result", r->out.result); @@ -5940,12 +5950,11 @@ static enum ndr_err_code ndr_push_samr_QueryDomainInfo(struct ndr_push *ndr, int if (r->out.info == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.info == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.info)); + if (*r->out.info) { + NDR_CHECK(ndr_push_set_switch_value(ndr, *r->out.info, r->in.level)); + NDR_CHECK(ndr_push_samr_DomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.info)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_set_switch_value(ndr, *r->out.info, r->in.level)); - NDR_CHECK(ndr_push_samr_DomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.info)); NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -5977,15 +5986,19 @@ static enum ndr_err_code ndr_pull_samr_QueryDomainInfo(struct ndr_pull *ndr, int } _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_info)); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info)); + if (_ptr_info) { NDR_PULL_ALLOC(ndr, *r->out.info); + } else { + *r->out.info = NULL; + } + if (*r->out.info) { + _mem_save_info_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.info, 0); + NDR_CHECK(ndr_pull_set_switch_value(ndr, *r->out.info, r->in.level)); + NDR_CHECK(ndr_pull_samr_DomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_1, 0); } - _mem_save_info_1 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, *r->out.info, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_set_switch_value(ndr, *r->out.info, r->in.level)); - NDR_CHECK(ndr_pull_samr_DomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.info)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_1, LIBNDR_FLAG_REF_ALLOC); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); } @@ -6016,8 +6029,10 @@ _PUBLIC_ void ndr_print_samr_QueryDomainInfo(struct ndr_print *ndr, const char * ndr->depth++; ndr_print_ptr(ndr, "info", *r->out.info); ndr->depth++; - ndr_print_set_switch_value(ndr, *r->out.info, r->in.level); - ndr_print_samr_DomainInfo(ndr, "info", *r->out.info); + if (*r->out.info) { + ndr_print_set_switch_value(ndr, *r->out.info, r->in.level); + ndr_print_samr_DomainInfo(ndr, "info", *r->out.info); + } ndr->depth--; ndr->depth--; ndr_print_NTSTATUS(ndr, "result", r->out.result); @@ -7684,11 +7699,10 @@ static enum ndr_err_code ndr_push_samr_QueryGroupMember(struct ndr_push *ndr, in if (r->out.rids == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.rids == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.rids)); + if (*r->out.rids) { + NDR_CHECK(ndr_push_samr_RidTypeArray(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.rids)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_samr_RidTypeArray(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.rids)); NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -7719,14 +7733,18 @@ static enum ndr_err_code ndr_pull_samr_QueryGroupMember(struct ndr_pull *ndr, in } _mem_save_rids_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.rids, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_rids)); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_rids)); + if (_ptr_rids) { NDR_PULL_ALLOC(ndr, *r->out.rids); + } else { + *r->out.rids = NULL; + } + if (*r->out.rids) { + _mem_save_rids_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.rids, 0); + NDR_CHECK(ndr_pull_samr_RidTypeArray(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.rids)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rids_1, 0); } - _mem_save_rids_1 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, *r->out.rids, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_samr_RidTypeArray(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.rids)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rids_1, LIBNDR_FLAG_REF_ALLOC); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rids_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); } @@ -7756,7 +7774,9 @@ _PUBLIC_ void ndr_print_samr_QueryGroupMember(struct ndr_print *ndr, const char ndr->depth++; ndr_print_ptr(ndr, "rids", *r->out.rids); ndr->depth++; - ndr_print_samr_RidTypeArray(ndr, "rids", *r->out.rids); + if (*r->out.rids) { + ndr_print_samr_RidTypeArray(ndr, "rids", *r->out.rids); + } ndr->depth--; ndr->depth--; ndr_print_NTSTATUS(ndr, "result", r->out.result); @@ -9471,12 +9491,11 @@ static enum ndr_err_code ndr_push_samr_QueryDomainInfo2(struct ndr_push *ndr, in if (r->out.info == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.info == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.info)); + if (*r->out.info) { + NDR_CHECK(ndr_push_set_switch_value(ndr, *r->out.info, r->in.level)); + NDR_CHECK(ndr_push_samr_DomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.info)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_set_switch_value(ndr, *r->out.info, r->in.level)); - NDR_CHECK(ndr_push_samr_DomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.info)); NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -9508,15 +9527,19 @@ static enum ndr_err_code ndr_pull_samr_QueryDomainInfo2(struct ndr_pull *ndr, in } _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_info)); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info)); + if (_ptr_info) { NDR_PULL_ALLOC(ndr, *r->out.info); + } else { + *r->out.info = NULL; + } + if (*r->out.info) { + _mem_save_info_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.info, 0); + NDR_CHECK(ndr_pull_set_switch_value(ndr, *r->out.info, r->in.level)); + NDR_CHECK(ndr_pull_samr_DomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_1, 0); } - _mem_save_info_1 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, *r->out.info, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_set_switch_value(ndr, *r->out.info, r->in.level)); - NDR_CHECK(ndr_pull_samr_DomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.info)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_1, LIBNDR_FLAG_REF_ALLOC); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); } @@ -9547,8 +9570,10 @@ _PUBLIC_ void ndr_print_samr_QueryDomainInfo2(struct ndr_print *ndr, const char ndr->depth++; ndr_print_ptr(ndr, "info", *r->out.info); ndr->depth++; - ndr_print_set_switch_value(ndr, *r->out.info, r->in.level); - ndr_print_samr_DomainInfo(ndr, "info", *r->out.info); + if (*r->out.info) { + ndr_print_set_switch_value(ndr, *r->out.info, r->in.level); + ndr_print_samr_DomainInfo(ndr, "info", *r->out.info); + } ndr->depth--; ndr->depth--; ndr_print_NTSTATUS(ndr, "result", r->out.result); diff --git a/source3/librpc/gen_ndr/ndr_svcctl.c b/source3/librpc/gen_ndr/ndr_svcctl.c index b8d5dc186d..b2dfd0eef4 100644 --- a/source3/librpc/gen_ndr/ndr_svcctl.c +++ b/source3/librpc/gen_ndr/ndr_svcctl.c @@ -2380,14 +2380,13 @@ static enum ndr_err_code ndr_push_svcctl_GetServiceDisplayNameW(struct ndr_push if (r->out.display_name == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.display_name == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.display_name)); + if (*r->out.display_name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.display_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.display_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.display_name, ndr_charset_length(*r->out.display_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.display_name, CH_UTF16))); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.display_name, CH_UTF16))); - NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.display_name, ndr_charset_length(*r->out.display_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.display_name_length)); if (r->out.display_name_length) { NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.display_name_length)); @@ -2405,6 +2404,7 @@ static enum ndr_err_code ndr_pull_svcctl_GetServiceDisplayNameW(struct ndr_pull TALLOC_CTX *_mem_save_handle_0; TALLOC_CTX *_mem_save_service_name_0; TALLOC_CTX *_mem_save_display_name_0; + TALLOC_CTX *_mem_save_display_name_1; TALLOC_CTX *_mem_save_display_name_length_0; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -2455,14 +2455,24 @@ static enum ndr_err_code ndr_pull_svcctl_GetServiceDisplayNameW(struct ndr_pull } _mem_save_display_name_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.display_name, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_display_name)); - NDR_CHECK(ndr_pull_array_size(ndr, r->out.display_name)); - NDR_CHECK(ndr_pull_array_length(ndr, r->out.display_name)); - if (ndr_get_array_length(ndr, r->out.display_name) > ndr_get_array_size(ndr, r->out.display_name)) { - return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.display_name), ndr_get_array_length(ndr, r->out.display_name)); - } - NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.display_name), sizeof(uint16_t))); - NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.display_name, ndr_get_array_length(ndr, r->out.display_name), sizeof(uint16_t), CH_UTF16)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_display_name)); + if (_ptr_display_name) { + NDR_PULL_ALLOC(ndr, *r->out.display_name); + } else { + *r->out.display_name = NULL; + } + if (*r->out.display_name) { + _mem_save_display_name_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.display_name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, r->out.display_name)); + NDR_CHECK(ndr_pull_array_length(ndr, r->out.display_name)); + if (ndr_get_array_length(ndr, r->out.display_name) > ndr_get_array_size(ndr, r->out.display_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.display_name), ndr_get_array_length(ndr, r->out.display_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.display_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.display_name, ndr_get_array_length(ndr, r->out.display_name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_display_name_1, 0); + } NDR_PULL_SET_MEM_CTX(ndr, _mem_save_display_name_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_display_name_length)); if (_ptr_display_name_length) { @@ -2516,7 +2526,9 @@ _PUBLIC_ void ndr_print_svcctl_GetServiceDisplayNameW(struct ndr_print *ndr, con ndr->depth++; ndr_print_ptr(ndr, "display_name", *r->out.display_name); ndr->depth++; - ndr_print_string(ndr, "display_name", *r->out.display_name); + if (*r->out.display_name) { + ndr_print_string(ndr, "display_name", *r->out.display_name); + } ndr->depth--; ndr->depth--; ndr_print_ptr(ndr, "display_name_length", r->out.display_name_length); @@ -2554,14 +2566,13 @@ static enum ndr_err_code ndr_push_svcctl_GetServiceKeyNameW(struct ndr_push *ndr if (r->out.key_name == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.key_name == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.key_name)); + if (*r->out.key_name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.key_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.key_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.key_name, ndr_charset_length(*r->out.key_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.key_name, CH_UTF16))); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.key_name, CH_UTF16))); - NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.key_name, ndr_charset_length(*r->out.key_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.display_name_length)); if (r->out.display_name_length) { NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.display_name_length)); @@ -2579,6 +2590,7 @@ static enum ndr_err_code ndr_pull_svcctl_GetServiceKeyNameW(struct ndr_pull *ndr TALLOC_CTX *_mem_save_handle_0; TALLOC_CTX *_mem_save_service_name_0; TALLOC_CTX *_mem_save_key_name_0; + TALLOC_CTX *_mem_save_key_name_1; TALLOC_CTX *_mem_save_display_name_length_0; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -2629,14 +2641,24 @@ static enum ndr_err_code ndr_pull_svcctl_GetServiceKeyNameW(struct ndr_pull *ndr } _mem_save_key_name_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.key_name, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_key_name)); - NDR_CHECK(ndr_pull_array_size(ndr, r->out.key_name)); - NDR_CHECK(ndr_pull_array_length(ndr, r->out.key_name)); - if (ndr_get_array_length(ndr, r->out.key_name) > ndr_get_array_size(ndr, r->out.key_name)) { - return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.key_name), ndr_get_array_length(ndr, r->out.key_name)); - } - NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.key_name), sizeof(uint16_t))); - NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.key_name, ndr_get_array_length(ndr, r->out.key_name), sizeof(uint16_t), CH_UTF16)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_key_name)); + if (_ptr_key_name) { + NDR_PULL_ALLOC(ndr, *r->out.key_name); + } else { + *r->out.key_name = NULL; + } + if (*r->out.key_name) { + _mem_save_key_name_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.key_name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, r->out.key_name)); + NDR_CHECK(ndr_pull_array_length(ndr, r->out.key_name)); + if (ndr_get_array_length(ndr, r->out.key_name) > ndr_get_array_size(ndr, r->out.key_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.key_name), ndr_get_array_length(ndr, r->out.key_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.key_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.key_name, ndr_get_array_length(ndr, r->out.key_name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_key_name_1, 0); + } NDR_PULL_SET_MEM_CTX(ndr, _mem_save_key_name_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_display_name_length)); if (_ptr_display_name_length) { @@ -2690,7 +2712,9 @@ _PUBLIC_ void ndr_print_svcctl_GetServiceKeyNameW(struct ndr_print *ndr, const c ndr->depth++; ndr_print_ptr(ndr, "key_name", *r->out.key_name); ndr->depth++; - ndr_print_string(ndr, "key_name", *r->out.key_name); + if (*r->out.key_name) { + ndr_print_string(ndr, "key_name", *r->out.key_name); + } ndr->depth--; ndr->depth--; ndr_print_ptr(ndr, "display_name_length", r->out.display_name_length); @@ -4186,14 +4210,13 @@ static enum ndr_err_code ndr_push_svcctl_GetServiceDisplayNameA(struct ndr_push if (r->out.display_name == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.display_name == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.display_name)); + if (*r->out.display_name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.display_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.display_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.display_name, ndr_charset_length(*r->out.display_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.display_name, CH_UTF16))); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.display_name, CH_UTF16))); - NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.display_name, ndr_charset_length(*r->out.display_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.display_name_length)); if (r->out.display_name_length) { NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.display_name_length)); @@ -4211,6 +4234,7 @@ static enum ndr_err_code ndr_pull_svcctl_GetServiceDisplayNameA(struct ndr_pull TALLOC_CTX *_mem_save_handle_0; TALLOC_CTX *_mem_save_service_name_0; TALLOC_CTX *_mem_save_display_name_0; + TALLOC_CTX *_mem_save_display_name_1; TALLOC_CTX *_mem_save_display_name_length_0; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -4261,14 +4285,24 @@ static enum ndr_err_code ndr_pull_svcctl_GetServiceDisplayNameA(struct ndr_pull } _mem_save_display_name_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.display_name, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_display_name)); - NDR_CHECK(ndr_pull_array_size(ndr, r->out.display_name)); - NDR_CHECK(ndr_pull_array_length(ndr, r->out.display_name)); - if (ndr_get_array_length(ndr, r->out.display_name) > ndr_get_array_size(ndr, r->out.display_name)) { - return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.display_name), ndr_get_array_length(ndr, r->out.display_name)); - } - NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.display_name), sizeof(uint16_t))); - NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.display_name, ndr_get_array_length(ndr, r->out.display_name), sizeof(uint16_t), CH_UTF16)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_display_name)); + if (_ptr_display_name) { + NDR_PULL_ALLOC(ndr, *r->out.display_name); + } else { + *r->out.display_name = NULL; + } + if (*r->out.display_name) { + _mem_save_display_name_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.display_name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, r->out.display_name)); + NDR_CHECK(ndr_pull_array_length(ndr, r->out.display_name)); + if (ndr_get_array_length(ndr, r->out.display_name) > ndr_get_array_size(ndr, r->out.display_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.display_name), ndr_get_array_length(ndr, r->out.display_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.display_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.display_name, ndr_get_array_length(ndr, r->out.display_name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_display_name_1, 0); + } NDR_PULL_SET_MEM_CTX(ndr, _mem_save_display_name_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_display_name_length)); if (_ptr_display_name_length) { @@ -4322,7 +4356,9 @@ _PUBLIC_ void ndr_print_svcctl_GetServiceDisplayNameA(struct ndr_print *ndr, con ndr->depth++; ndr_print_ptr(ndr, "display_name", *r->out.display_name); ndr->depth++; - ndr_print_string(ndr, "display_name", *r->out.display_name); + if (*r->out.display_name) { + ndr_print_string(ndr, "display_name", *r->out.display_name); + } ndr->depth--; ndr->depth--; ndr_print_ptr(ndr, "display_name_length", r->out.display_name_length); @@ -4360,14 +4396,13 @@ static enum ndr_err_code ndr_push_svcctl_GetServiceKeyNameA(struct ndr_push *ndr if (r->out.key_name == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.key_name == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.key_name)); + if (*r->out.key_name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.key_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.key_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.key_name, ndr_charset_length(*r->out.key_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.key_name, CH_UTF16))); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.key_name, CH_UTF16))); - NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.key_name, ndr_charset_length(*r->out.key_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.display_name_length)); if (r->out.display_name_length) { NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.display_name_length)); @@ -4385,6 +4420,7 @@ static enum ndr_err_code ndr_pull_svcctl_GetServiceKeyNameA(struct ndr_pull *ndr TALLOC_CTX *_mem_save_handle_0; TALLOC_CTX *_mem_save_service_name_0; TALLOC_CTX *_mem_save_key_name_0; + TALLOC_CTX *_mem_save_key_name_1; TALLOC_CTX *_mem_save_display_name_length_0; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -4435,14 +4471,24 @@ static enum ndr_err_code ndr_pull_svcctl_GetServiceKeyNameA(struct ndr_pull *ndr } _mem_save_key_name_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.key_name, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_key_name)); - NDR_CHECK(ndr_pull_array_size(ndr, r->out.key_name)); - NDR_CHECK(ndr_pull_array_length(ndr, r->out.key_name)); - if (ndr_get_array_length(ndr, r->out.key_name) > ndr_get_array_size(ndr, r->out.key_name)) { - return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.key_name), ndr_get_array_length(ndr, r->out.key_name)); - } - NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.key_name), sizeof(uint16_t))); - NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.key_name, ndr_get_array_length(ndr, r->out.key_name), sizeof(uint16_t), CH_UTF16)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_key_name)); + if (_ptr_key_name) { + NDR_PULL_ALLOC(ndr, *r->out.key_name); + } else { + *r->out.key_name = NULL; + } + if (*r->out.key_name) { + _mem_save_key_name_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.key_name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, r->out.key_name)); + NDR_CHECK(ndr_pull_array_length(ndr, r->out.key_name)); + if (ndr_get_array_length(ndr, r->out.key_name) > ndr_get_array_size(ndr, r->out.key_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.key_name), ndr_get_array_length(ndr, r->out.key_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.key_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.key_name, ndr_get_array_length(ndr, r->out.key_name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_key_name_1, 0); + } NDR_PULL_SET_MEM_CTX(ndr, _mem_save_key_name_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_display_name_length)); if (_ptr_display_name_length) { @@ -4496,7 +4542,9 @@ _PUBLIC_ void ndr_print_svcctl_GetServiceKeyNameA(struct ndr_print *ndr, const c ndr->depth++; ndr_print_ptr(ndr, "key_name", *r->out.key_name); ndr->depth++; - ndr_print_string(ndr, "key_name", *r->out.key_name); + if (*r->out.key_name) { + ndr_print_string(ndr, "key_name", *r->out.key_name); + } ndr->depth--; ndr->depth--; ndr_print_ptr(ndr, "display_name_length", r->out.display_name_length); @@ -5055,14 +5103,13 @@ static enum ndr_err_code ndr_push_EnumServicesStatusExA(struct ndr_push *ndr, in if (r->out.group_name == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.group_name == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.group_name)); + if (*r->out.group_name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.group_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.group_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.group_name, ndr_charset_length(*r->out.group_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.group_name, CH_UTF16))); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.group_name, CH_UTF16))); - NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.group_name, ndr_charset_length(*r->out.group_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -5077,6 +5124,7 @@ static enum ndr_err_code ndr_pull_EnumServicesStatusExA(struct ndr_pull *ndr, in TALLOC_CTX *_mem_save_service_returned_0; TALLOC_CTX *_mem_save_resume_handle_0; TALLOC_CTX *_mem_save_group_name_0; + TALLOC_CTX *_mem_save_group_name_1; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -5144,14 +5192,24 @@ static enum ndr_err_code ndr_pull_EnumServicesStatusExA(struct ndr_pull *ndr, in } _mem_save_group_name_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.group_name, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_group_name)); - NDR_CHECK(ndr_pull_array_size(ndr, r->out.group_name)); - NDR_CHECK(ndr_pull_array_length(ndr, r->out.group_name)); - if (ndr_get_array_length(ndr, r->out.group_name) > ndr_get_array_size(ndr, r->out.group_name)) { - return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.group_name), ndr_get_array_length(ndr, r->out.group_name)); - } - NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.group_name), sizeof(uint16_t))); - NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.group_name, ndr_get_array_length(ndr, r->out.group_name), sizeof(uint16_t), CH_UTF16)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_group_name)); + if (_ptr_group_name) { + NDR_PULL_ALLOC(ndr, *r->out.group_name); + } else { + *r->out.group_name = NULL; + } + if (*r->out.group_name) { + _mem_save_group_name_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.group_name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, r->out.group_name)); + NDR_CHECK(ndr_pull_array_length(ndr, r->out.group_name)); + if (ndr_get_array_length(ndr, r->out.group_name) > ndr_get_array_size(ndr, r->out.group_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.group_name), ndr_get_array_length(ndr, r->out.group_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.group_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.group_name, ndr_get_array_length(ndr, r->out.group_name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_name_1, 0); + } NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_name_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } @@ -5206,7 +5264,9 @@ _PUBLIC_ void ndr_print_EnumServicesStatusExA(struct ndr_print *ndr, const char ndr->depth++; ndr_print_ptr(ndr, "group_name", *r->out.group_name); ndr->depth++; - ndr_print_string(ndr, "group_name", *r->out.group_name); + if (*r->out.group_name) { + ndr_print_string(ndr, "group_name", *r->out.group_name); + } ndr->depth--; ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); @@ -5248,14 +5308,13 @@ static enum ndr_err_code ndr_push_EnumServicesStatusExW(struct ndr_push *ndr, in if (r->out.group_name == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.group_name == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.group_name)); + if (*r->out.group_name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.group_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.group_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.group_name, ndr_charset_length(*r->out.group_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.group_name, CH_UTF16))); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.group_name, CH_UTF16))); - NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.group_name, ndr_charset_length(*r->out.group_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -5270,6 +5329,7 @@ static enum ndr_err_code ndr_pull_EnumServicesStatusExW(struct ndr_pull *ndr, in TALLOC_CTX *_mem_save_service_returned_0; TALLOC_CTX *_mem_save_resume_handle_0; TALLOC_CTX *_mem_save_group_name_0; + TALLOC_CTX *_mem_save_group_name_1; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -5337,14 +5397,24 @@ static enum ndr_err_code ndr_pull_EnumServicesStatusExW(struct ndr_pull *ndr, in } _mem_save_group_name_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.group_name, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_group_name)); - NDR_CHECK(ndr_pull_array_size(ndr, r->out.group_name)); - NDR_CHECK(ndr_pull_array_length(ndr, r->out.group_name)); - if (ndr_get_array_length(ndr, r->out.group_name) > ndr_get_array_size(ndr, r->out.group_name)) { - return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.group_name), ndr_get_array_length(ndr, r->out.group_name)); - } - NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.group_name), sizeof(uint16_t))); - NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.group_name, ndr_get_array_length(ndr, r->out.group_name), sizeof(uint16_t), CH_UTF16)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_group_name)); + if (_ptr_group_name) { + NDR_PULL_ALLOC(ndr, *r->out.group_name); + } else { + *r->out.group_name = NULL; + } + if (*r->out.group_name) { + _mem_save_group_name_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.group_name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, r->out.group_name)); + NDR_CHECK(ndr_pull_array_length(ndr, r->out.group_name)); + if (ndr_get_array_length(ndr, r->out.group_name) > ndr_get_array_size(ndr, r->out.group_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.group_name), ndr_get_array_length(ndr, r->out.group_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.group_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.group_name, ndr_get_array_length(ndr, r->out.group_name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_name_1, 0); + } NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_name_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } @@ -5399,7 +5469,9 @@ _PUBLIC_ void ndr_print_EnumServicesStatusExW(struct ndr_print *ndr, const char ndr->depth++; ndr_print_ptr(ndr, "group_name", *r->out.group_name); ndr->depth++; - ndr_print_string(ndr, "group_name", *r->out.group_name); + if (*r->out.group_name) { + ndr_print_string(ndr, "group_name", *r->out.group_name); + } ndr->depth--; ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); diff --git a/source3/librpc/gen_ndr/ndr_wkssvc.c b/source3/librpc/gen_ndr/ndr_wkssvc.c index c3a1f706cd..3f2f418618 100644 --- a/source3/librpc/gen_ndr/ndr_wkssvc.c +++ b/source3/librpc/gen_ndr/ndr_wkssvc.c @@ -7458,11 +7458,10 @@ static enum ndr_err_code ndr_push_wkssvc_NetrWorkstationStatisticsGet(struct ndr if (r->out.info == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.info == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.info)); + if (*r->out.info) { + NDR_CHECK(ndr_push_wkssvc_NetrWorkstationStatistics(ndr, NDR_SCALARS, *r->out.info)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_wkssvc_NetrWorkstationStatistics(ndr, NDR_SCALARS, *r->out.info)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -7527,14 +7526,18 @@ static enum ndr_err_code ndr_pull_wkssvc_NetrWorkstationStatisticsGet(struct ndr } _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_info)); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info)); + if (_ptr_info) { NDR_PULL_ALLOC(ndr, *r->out.info); + } else { + *r->out.info = NULL; + } + if (*r->out.info) { + _mem_save_info_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.info, 0); + NDR_CHECK(ndr_pull_wkssvc_NetrWorkstationStatistics(ndr, NDR_SCALARS, *r->out.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_1, 0); } - _mem_save_info_1 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, *r->out.info, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_wkssvc_NetrWorkstationStatistics(ndr, NDR_SCALARS, *r->out.info)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_1, LIBNDR_FLAG_REF_ALLOC); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } @@ -7574,7 +7577,9 @@ _PUBLIC_ void ndr_print_wkssvc_NetrWorkstationStatisticsGet(struct ndr_print *nd ndr->depth++; ndr_print_ptr(ndr, "info", *r->out.info); ndr->depth++; - ndr_print_wkssvc_NetrWorkstationStatistics(ndr, "info", *r->out.info); + if (*r->out.info) { + ndr_print_wkssvc_NetrWorkstationStatistics(ndr, "info", *r->out.info); + } ndr->depth--; ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); @@ -8388,27 +8393,25 @@ static enum ndr_err_code ndr_push_wkssvc_NetrGetJoinInformation(struct ndr_push if (r->in.name_buffer == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->in.name_buffer == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->in.name_buffer)); + if (*r->in.name_buffer) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->in.name_buffer, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->in.name_buffer, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->in.name_buffer, ndr_charset_length(*r->in.name_buffer, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->in.name_buffer, CH_UTF16))); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->in.name_buffer, CH_UTF16))); - NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->in.name_buffer, ndr_charset_length(*r->in.name_buffer, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } if (flags & NDR_OUT) { if (r->out.name_buffer == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.name_buffer == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.name_buffer)); + if (*r->out.name_buffer) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.name_buffer, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.name_buffer, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.name_buffer, ndr_charset_length(*r->out.name_buffer, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.name_buffer, CH_UTF16))); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.name_buffer, CH_UTF16))); - NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.name_buffer, ndr_charset_length(*r->out.name_buffer, CH_UTF16), sizeof(uint16_t), CH_UTF16)); if (r->out.name_type == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } @@ -8424,6 +8427,7 @@ static enum ndr_err_code ndr_pull_wkssvc_NetrGetJoinInformation(struct ndr_pull uint32_t _ptr_name_buffer; TALLOC_CTX *_mem_save_server_name_0; TALLOC_CTX *_mem_save_name_buffer_0; + TALLOC_CTX *_mem_save_name_buffer_1; TALLOC_CTX *_mem_save_name_type_0; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -8451,14 +8455,24 @@ static enum ndr_err_code ndr_pull_wkssvc_NetrGetJoinInformation(struct ndr_pull } _mem_save_name_buffer_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->in.name_buffer, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_name_buffer)); - NDR_CHECK(ndr_pull_array_size(ndr, r->in.name_buffer)); - NDR_CHECK(ndr_pull_array_length(ndr, r->in.name_buffer)); - if (ndr_get_array_length(ndr, r->in.name_buffer) > ndr_get_array_size(ndr, r->in.name_buffer)) { - return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->in.name_buffer), ndr_get_array_length(ndr, r->in.name_buffer)); - } - NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->in.name_buffer), sizeof(uint16_t))); - NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->in.name_buffer, ndr_get_array_length(ndr, r->in.name_buffer), sizeof(uint16_t), CH_UTF16)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_name_buffer)); + if (_ptr_name_buffer) { + NDR_PULL_ALLOC(ndr, *r->in.name_buffer); + } else { + *r->in.name_buffer = NULL; + } + if (*r->in.name_buffer) { + _mem_save_name_buffer_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->in.name_buffer, 0); + NDR_CHECK(ndr_pull_array_size(ndr, r->in.name_buffer)); + NDR_CHECK(ndr_pull_array_length(ndr, r->in.name_buffer)); + if (ndr_get_array_length(ndr, r->in.name_buffer) > ndr_get_array_size(ndr, r->in.name_buffer)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->in.name_buffer), ndr_get_array_length(ndr, r->in.name_buffer)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->in.name_buffer), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->in.name_buffer, ndr_get_array_length(ndr, r->in.name_buffer), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_buffer_1, 0); + } NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_buffer_0, LIBNDR_FLAG_REF_ALLOC); NDR_PULL_ALLOC(ndr, r->out.name_buffer); *r->out.name_buffer = *r->in.name_buffer; @@ -8471,14 +8485,24 @@ static enum ndr_err_code ndr_pull_wkssvc_NetrGetJoinInformation(struct ndr_pull } _mem_save_name_buffer_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.name_buffer, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_name_buffer)); - NDR_CHECK(ndr_pull_array_size(ndr, r->out.name_buffer)); - NDR_CHECK(ndr_pull_array_length(ndr, r->out.name_buffer)); - if (ndr_get_array_length(ndr, r->out.name_buffer) > ndr_get_array_size(ndr, r->out.name_buffer)) { - return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.name_buffer), ndr_get_array_length(ndr, r->out.name_buffer)); - } - NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.name_buffer), sizeof(uint16_t))); - NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.name_buffer, ndr_get_array_length(ndr, r->out.name_buffer), sizeof(uint16_t), CH_UTF16)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_name_buffer)); + if (_ptr_name_buffer) { + NDR_PULL_ALLOC(ndr, *r->out.name_buffer); + } else { + *r->out.name_buffer = NULL; + } + if (*r->out.name_buffer) { + _mem_save_name_buffer_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.name_buffer, 0); + NDR_CHECK(ndr_pull_array_size(ndr, r->out.name_buffer)); + NDR_CHECK(ndr_pull_array_length(ndr, r->out.name_buffer)); + if (ndr_get_array_length(ndr, r->out.name_buffer) > ndr_get_array_size(ndr, r->out.name_buffer)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.name_buffer), ndr_get_array_length(ndr, r->out.name_buffer)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.name_buffer), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.name_buffer, ndr_get_array_length(ndr, r->out.name_buffer), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_buffer_1, 0); + } NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_buffer_0, LIBNDR_FLAG_REF_ALLOC); if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.name_type); @@ -8512,7 +8536,9 @@ _PUBLIC_ void ndr_print_wkssvc_NetrGetJoinInformation(struct ndr_print *ndr, con ndr->depth++; ndr_print_ptr(ndr, "name_buffer", *r->in.name_buffer); ndr->depth++; - ndr_print_string(ndr, "name_buffer", *r->in.name_buffer); + if (*r->in.name_buffer) { + ndr_print_string(ndr, "name_buffer", *r->in.name_buffer); + } ndr->depth--; ndr->depth--; ndr->depth--; @@ -8524,7 +8550,9 @@ _PUBLIC_ void ndr_print_wkssvc_NetrGetJoinInformation(struct ndr_print *ndr, con ndr->depth++; ndr_print_ptr(ndr, "name_buffer", *r->out.name_buffer); ndr->depth++; - ndr_print_string(ndr, "name_buffer", *r->out.name_buffer); + if (*r->out.name_buffer) { + ndr_print_string(ndr, "name_buffer", *r->out.name_buffer); + } ndr->depth--; ndr->depth--; ndr_print_ptr(ndr, "name_type", r->out.name_type); @@ -8584,10 +8612,18 @@ static enum ndr_err_code ndr_push_wkssvc_NetrGetJoinableOus(struct ndr_push *ndr } NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.num_ous)); for (cntr_ous_1 = 0; cntr_ous_1 < *r->out.num_ous; cntr_ous_1++) { - if (r->out.ous[cntr_ous_1] == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.ous[cntr_ous_1])); + } + for (cntr_ous_1 = 0; cntr_ous_1 < *r->out.num_ous; cntr_ous_1++) { + if (r->out.ous[cntr_ous_1]) { + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.ous[cntr_ous_1])); + if (*r->out.ous[cntr_ous_1]) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.ous[cntr_ous_1], CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.ous[cntr_ous_1], CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.ous[cntr_ous_1], ndr_charset_length(*r->out.ous[cntr_ous_1], CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } } - NDR_CHECK(ndr_push_ref_ptr(ndr)); } NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } @@ -8607,6 +8643,7 @@ static enum ndr_err_code ndr_pull_wkssvc_NetrGetJoinableOus(struct ndr_pull *ndr TALLOC_CTX *_mem_save_num_ous_0; TALLOC_CTX *_mem_save_ous_1; TALLOC_CTX *_mem_save_ous_2; + TALLOC_CTX *_mem_save_ous_3; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -8698,9 +8735,36 @@ static enum ndr_err_code ndr_pull_wkssvc_NetrGetJoinableOus(struct ndr_pull *ndr _mem_save_ous_1 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.ous, 0); for (cntr_ous_1 = 0; cntr_ous_1 < *r->out.num_ous; cntr_ous_1++) { - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_ous)); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_ous)); + if (_ptr_ous) { NDR_PULL_ALLOC(ndr, r->out.ous[cntr_ous_1]); + } else { + r->out.ous[cntr_ous_1] = NULL; + } + } + for (cntr_ous_1 = 0; cntr_ous_1 < *r->out.num_ous; cntr_ous_1++) { + if (r->out.ous[cntr_ous_1]) { + _mem_save_ous_2 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.ous[cntr_ous_1], 0); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_ous)); + if (_ptr_ous) { + NDR_PULL_ALLOC(ndr, *r->out.ous[cntr_ous_1]); + } else { + *r->out.ous[cntr_ous_1] = NULL; + } + if (*r->out.ous[cntr_ous_1]) { + _mem_save_ous_3 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.ous[cntr_ous_1], 0); + NDR_CHECK(ndr_pull_array_size(ndr, r->out.ous[cntr_ous_1])); + NDR_CHECK(ndr_pull_array_length(ndr, r->out.ous[cntr_ous_1])); + if (ndr_get_array_length(ndr, r->out.ous[cntr_ous_1]) > ndr_get_array_size(ndr, r->out.ous[cntr_ous_1])) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.ous[cntr_ous_1]), ndr_get_array_length(ndr, r->out.ous[cntr_ous_1])); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.ous[cntr_ous_1]), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.ous[cntr_ous_1], ndr_get_array_length(ndr, r->out.ous[cntr_ous_1]), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ous_3, 0); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ous_2, 0); } } NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ous_1, 0); @@ -8768,10 +8832,14 @@ _PUBLIC_ void ndr_print_wkssvc_NetrGetJoinableOus(struct ndr_print *ndr, const c if (idx_1) { ndr_print_ptr(ndr, "ous", r->out.ous[cntr_ous_1]); ndr->depth++; - ndr_print_ptr(ndr, "ous", *r->out.ous[cntr_ous_1]); - ndr->depth++; - ndr_print_string(ndr, "ous", *r->out.ous[cntr_ous_1]); - ndr->depth--; + if (r->out.ous[cntr_ous_1]) { + ndr_print_ptr(ndr, "ous", *r->out.ous[cntr_ous_1]); + ndr->depth++; + if (*r->out.ous[cntr_ous_1]) { + ndr_print_string(ndr, "ous", *r->out.ous[cntr_ous_1]); + } + ndr->depth--; + } ndr->depth--; free(idx_1); } @@ -9466,10 +9534,18 @@ static enum ndr_err_code ndr_push_wkssvc_NetrGetJoinableOus2(struct ndr_push *nd } NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.num_ous)); for (cntr_ous_1 = 0; cntr_ous_1 < *r->out.num_ous; cntr_ous_1++) { - if (r->out.ous[cntr_ous_1] == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.ous[cntr_ous_1])); + } + for (cntr_ous_1 = 0; cntr_ous_1 < *r->out.num_ous; cntr_ous_1++) { + if (r->out.ous[cntr_ous_1]) { + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.ous[cntr_ous_1])); + if (*r->out.ous[cntr_ous_1]) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.ous[cntr_ous_1], CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.ous[cntr_ous_1], CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.ous[cntr_ous_1], ndr_charset_length(*r->out.ous[cntr_ous_1], CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } } - NDR_CHECK(ndr_push_ref_ptr(ndr)); } NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } @@ -9489,6 +9565,7 @@ static enum ndr_err_code ndr_pull_wkssvc_NetrGetJoinableOus2(struct ndr_pull *nd TALLOC_CTX *_mem_save_num_ous_0; TALLOC_CTX *_mem_save_ous_1; TALLOC_CTX *_mem_save_ous_2; + TALLOC_CTX *_mem_save_ous_3; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -9574,9 +9651,36 @@ static enum ndr_err_code ndr_pull_wkssvc_NetrGetJoinableOus2(struct ndr_pull *nd _mem_save_ous_1 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.ous, 0); for (cntr_ous_1 = 0; cntr_ous_1 < *r->out.num_ous; cntr_ous_1++) { - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_ous)); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_ous)); + if (_ptr_ous) { NDR_PULL_ALLOC(ndr, r->out.ous[cntr_ous_1]); + } else { + r->out.ous[cntr_ous_1] = NULL; + } + } + for (cntr_ous_1 = 0; cntr_ous_1 < *r->out.num_ous; cntr_ous_1++) { + if (r->out.ous[cntr_ous_1]) { + _mem_save_ous_2 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.ous[cntr_ous_1], 0); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_ous)); + if (_ptr_ous) { + NDR_PULL_ALLOC(ndr, *r->out.ous[cntr_ous_1]); + } else { + *r->out.ous[cntr_ous_1] = NULL; + } + if (*r->out.ous[cntr_ous_1]) { + _mem_save_ous_3 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.ous[cntr_ous_1], 0); + NDR_CHECK(ndr_pull_array_size(ndr, r->out.ous[cntr_ous_1])); + NDR_CHECK(ndr_pull_array_length(ndr, r->out.ous[cntr_ous_1])); + if (ndr_get_array_length(ndr, r->out.ous[cntr_ous_1]) > ndr_get_array_size(ndr, r->out.ous[cntr_ous_1])) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.ous[cntr_ous_1]), ndr_get_array_length(ndr, r->out.ous[cntr_ous_1])); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.ous[cntr_ous_1]), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.ous[cntr_ous_1], ndr_get_array_length(ndr, r->out.ous[cntr_ous_1]), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ous_3, 0); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ous_2, 0); } } NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ous_1, 0); @@ -9644,10 +9748,14 @@ _PUBLIC_ void ndr_print_wkssvc_NetrGetJoinableOus2(struct ndr_print *ndr, const if (idx_1) { ndr_print_ptr(ndr, "ous", r->out.ous[cntr_ous_1]); ndr->depth++; - ndr_print_ptr(ndr, "ous", *r->out.ous[cntr_ous_1]); - ndr->depth++; - ndr_print_string(ndr, "ous", *r->out.ous[cntr_ous_1]); - ndr->depth--; + if (r->out.ous[cntr_ous_1]) { + ndr_print_ptr(ndr, "ous", *r->out.ous[cntr_ous_1]); + ndr->depth++; + if (*r->out.ous[cntr_ous_1]) { + ndr_print_string(ndr, "ous", *r->out.ous[cntr_ous_1]); + } + ndr->depth--; + } ndr->depth--; free(idx_1); } @@ -10178,11 +10286,10 @@ static enum ndr_err_code ndr_push_wkssvc_NetrEnumerateComputerNames(struct ndr_p if (r->out.ctr == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - if (*r->out.ctr == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.ctr)); + if (*r->out.ctr) { + NDR_CHECK(ndr_push_wkssvc_ComputerNamesCtr(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.ctr)); } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - NDR_CHECK(ndr_push_wkssvc_ComputerNamesCtr(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.ctr)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -10227,14 +10334,18 @@ static enum ndr_err_code ndr_pull_wkssvc_NetrEnumerateComputerNames(struct ndr_p } _mem_save_ctr_0 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->out.ctr, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_ctr)); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_ctr)); + if (_ptr_ctr) { NDR_PULL_ALLOC(ndr, *r->out.ctr); + } else { + *r->out.ctr = NULL; + } + if (*r->out.ctr) { + _mem_save_ctr_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.ctr, 0); + NDR_CHECK(ndr_pull_wkssvc_ComputerNamesCtr(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.ctr)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr_1, 0); } - _mem_save_ctr_1 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, *r->out.ctr, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_wkssvc_ComputerNamesCtr(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.ctr)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr_1, LIBNDR_FLAG_REF_ALLOC); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } @@ -10268,7 +10379,9 @@ _PUBLIC_ void ndr_print_wkssvc_NetrEnumerateComputerNames(struct ndr_print *ndr, ndr->depth++; ndr_print_ptr(ndr, "ctr", *r->out.ctr); ndr->depth++; - ndr_print_wkssvc_ComputerNamesCtr(ndr, "ctr", *r->out.ctr); + if (*r->out.ctr) { + ndr_print_wkssvc_ComputerNamesCtr(ndr, "ctr", *r->out.ctr); + } ndr->depth--; ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); |