diff options
-rw-r--r-- | librpc/gen_ndr/cli_spoolss.c | 2 | ||||
-rw-r--r-- | librpc/gen_ndr/cli_spoolss.h | 1 | ||||
-rw-r--r-- | librpc/gen_ndr/ndr_spoolss.c | 343 | ||||
-rw-r--r-- | librpc/gen_ndr/ndr_spoolss.h | 7 | ||||
-rw-r--r-- | librpc/gen_ndr/spoolss.h | 82 | ||||
-rw-r--r-- | librpc/gen_ndr/srv_spoolss.c | 13 |
6 files changed, 243 insertions, 205 deletions
diff --git a/librpc/gen_ndr/cli_spoolss.c b/librpc/gen_ndr/cli_spoolss.c index 2f15cb30bb..6225d2dba5 100644 --- a/librpc/gen_ndr/cli_spoolss.c +++ b/librpc/gen_ndr/cli_spoolss.c @@ -3314,6 +3314,7 @@ NTSTATUS rpccli_spoolss_AddPrinterEx(struct rpc_pipe_client *cli, struct security_descriptor *secdesc /* [in] [unique] */, uint32_t ulevel /* [in] */, union spoolss_UserLevel userlevel /* [in] [switch_is(ulevel)] */, + struct policy_handle *handle /* [out] [ref] */, WERROR *werror) { struct spoolss_AddPrinterEx r; @@ -3351,6 +3352,7 @@ NTSTATUS rpccli_spoolss_AddPrinterEx(struct rpc_pipe_client *cli, } /* Return variables */ + *handle = *r.out.handle; /* Return result */ if (werror) { diff --git a/librpc/gen_ndr/cli_spoolss.h b/librpc/gen_ndr/cli_spoolss.h index 6903aa6909..34c50a0891 100644 --- a/librpc/gen_ndr/cli_spoolss.h +++ b/librpc/gen_ndr/cli_spoolss.h @@ -420,6 +420,7 @@ NTSTATUS rpccli_spoolss_AddPrinterEx(struct rpc_pipe_client *cli, struct security_descriptor *secdesc /* [in] [unique] */, uint32_t ulevel /* [in] */, union spoolss_UserLevel userlevel /* [in] [switch_is(ulevel)] */, + struct policy_handle *handle /* [out] [ref] */, WERROR *werror); NTSTATUS rpccli_spoolss_47(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, diff --git a/librpc/gen_ndr/ndr_spoolss.c b/librpc/gen_ndr/ndr_spoolss.c index 5525ad4586..1bb419bc3a 100644 --- a/librpc/gen_ndr/ndr_spoolss.c +++ b/librpc/gen_ndr/ndr_spoolss.c @@ -57,6 +57,65 @@ _PUBLIC_ void ndr_print_spoolss_Time(struct ndr_print *ndr, const char *name, co ndr->depth--; } +static size_t ndr_size_spoolss_Time(const struct spoolss_Time *r, struct smb_iconv_convenience *ic, int flags) +{ + return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_Time, ic); +} + +static enum ndr_err_code ndr_push_spoolss_TimeCtr(struct ndr_push *ndr, int ndr_flags, const struct spoolss_TimeCtr *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_spoolss_Time(r->time, ndr->iconv_convenience, ndr->flags))); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->time)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->time) { + NDR_CHECK(ndr_push_spoolss_Time(ndr, NDR_SCALARS, r->time)); + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_spoolss_TimeCtr(struct ndr_pull *ndr, int ndr_flags, struct spoolss_TimeCtr *r) +{ + uint32_t _ptr_time; + TALLOC_CTX *_mem_save_time_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->size)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_time)); + if (_ptr_time) { + NDR_PULL_ALLOC(ndr, r->time); + } else { + r->time = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->time) { + _mem_save_time_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->time, 0); + NDR_CHECK(ndr_pull_spoolss_Time(ndr, NDR_SCALARS, r->time)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_time_0, 0); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_spoolss_TimeCtr(struct ndr_print *ndr, const char *name, const struct spoolss_TimeCtr *r) +{ + ndr_print_struct(ndr, name, "spoolss_TimeCtr"); + ndr->depth++; + ndr_print_uint32(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_spoolss_Time(r->time, ndr->iconv_convenience, ndr->flags):r->size); + ndr_print_ptr(ndr, "time", r->time); + ndr->depth++; + if (r->time) { + ndr_print_spoolss_Time(ndr, "time", r->time); + } + ndr->depth--; + ndr->depth--; +} + static enum ndr_err_code ndr_push_spoolss_PrinterInfo0(struct ndr_push *ndr, int ndr_flags, const struct spoolss_PrinterInfo0 *r) { if (ndr_flags & NDR_SCALARS) { @@ -10023,7 +10082,7 @@ static enum ndr_err_code ndr_push_spoolss_NotifyOptionsContainer(struct ndr_push uint32_t cntr_options_1; if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->version)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 2)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->flags)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); NDR_CHECK(ndr_push_unique_ptr(ndr, r->options)); @@ -10089,7 +10148,7 @@ _PUBLIC_ void ndr_print_spoolss_NotifyOptionsContainer(struct ndr_print *ndr, co uint32_t cntr_options_1; ndr_print_struct(ndr, name, "spoolss_NotifyOptionsContainer"); ndr->depth++; - ndr_print_uint32(ndr, "version", r->version); + ndr_print_uint32(ndr, "version", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?2:r->version); ndr_print_uint32(ndr, "flags", r->flags); ndr_print_uint32(ndr, "count", r->count); ndr_print_ptr(ndr, "options", r->options); @@ -10110,7 +10169,7 @@ _PUBLIC_ void ndr_print_spoolss_NotifyOptionsContainer(struct ndr_print *ndr, co ndr->depth--; } -static enum ndr_err_code ndr_push_spoolss_NotifyUTF16String(struct ndr_push *ndr, int ndr_flags, const struct spoolss_NotifyUTF16String *r) +static enum ndr_err_code ndr_push_spoolss_NotifyString(struct ndr_push *ndr, int ndr_flags, const struct spoolss_NotifyString *r) { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); @@ -10126,7 +10185,7 @@ static enum ndr_err_code ndr_push_spoolss_NotifyUTF16String(struct ndr_push *ndr return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_spoolss_NotifyUTF16String(struct ndr_pull *ndr, int ndr_flags, struct spoolss_NotifyUTF16String *r) +static enum ndr_err_code ndr_pull_spoolss_NotifyString(struct ndr_pull *ndr, int ndr_flags, struct spoolss_NotifyString *r) { uint32_t _ptr_string; TALLOC_CTX *_mem_save_string_0; @@ -10155,68 +10214,9 @@ static enum ndr_err_code ndr_pull_spoolss_NotifyUTF16String(struct ndr_pull *ndr return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_spoolss_NotifyUTF16String(struct ndr_print *ndr, const char *name, const struct spoolss_NotifyUTF16String *r) -{ - ndr_print_struct(ndr, name, "spoolss_NotifyUTF16String"); - ndr->depth++; - ndr_print_uint32(ndr, "size", r->size); - ndr_print_ptr(ndr, "string", r->string); - ndr->depth++; - if (r->string) { - ndr_print_string(ndr, "string", r->string); - } - ndr->depth--; - ndr->depth--; -} - -static enum ndr_err_code ndr_push_spoolss_NotifyDOSString(struct ndr_push *ndr, int ndr_flags, const struct spoolss_NotifyDOSString *r) -{ - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size)); - NDR_CHECK(ndr_push_unique_ptr(ndr, r->string)); - } - if (ndr_flags & NDR_BUFFERS) { - if (r->string) { - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size)); - NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->string, r->size, sizeof(uint8_t), CH_DOS)); - } - } - return NDR_ERR_SUCCESS; -} - -static enum ndr_err_code ndr_pull_spoolss_NotifyDOSString(struct ndr_pull *ndr, int ndr_flags, struct spoolss_NotifyDOSString *r) +_PUBLIC_ void ndr_print_spoolss_NotifyString(struct ndr_print *ndr, const char *name, const struct spoolss_NotifyString *r) { - uint32_t _ptr_string; - TALLOC_CTX *_mem_save_string_0; - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_pull_align(ndr, 4)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->size)); - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_string)); - if (_ptr_string) { - NDR_PULL_ALLOC(ndr, r->string); - } else { - r->string = NULL; - } - } - if (ndr_flags & NDR_BUFFERS) { - if (r->string) { - _mem_save_string_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->string, 0); - NDR_CHECK(ndr_pull_array_size(ndr, &r->string)); - NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->string, ndr_get_array_size(ndr, &r->string), sizeof(uint8_t), CH_DOS)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_string_0, 0); - } - if (r->string) { - NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->string, r->size)); - } - } - return NDR_ERR_SUCCESS; -} - -_PUBLIC_ void ndr_print_spoolss_NotifyDOSString(struct ndr_print *ndr, const char *name, const struct spoolss_NotifyDOSString *r) -{ - ndr_print_struct(ndr, name, "spoolss_NotifyDOSString"); + ndr_print_struct(ndr, name, "spoolss_NotifyString"); ndr->depth++; ndr_print_uint32(ndr, "size", r->size); ndr_print_ptr(ndr, "string", r->string); @@ -10228,104 +10228,32 @@ _PUBLIC_ void ndr_print_spoolss_NotifyDOSString(struct ndr_print *ndr, const cha ndr->depth--; } -static enum ndr_err_code ndr_push_spoolss_NotifyBlobData(struct ndr_push *ndr, int ndr_flags, const struct spoolss_NotifyBlobData *r) -{ - uint32_t cntr_data_0; - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_push_align(ndr, 2)); - for (cntr_data_0 = 0; cntr_data_0 < 8; cntr_data_0++) { - NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->data[cntr_data_0])); - } - } - if (ndr_flags & NDR_BUFFERS) { - } - return NDR_ERR_SUCCESS; -} - -static enum ndr_err_code ndr_pull_spoolss_NotifyBlobData(struct ndr_pull *ndr, int ndr_flags, struct spoolss_NotifyBlobData *r) +static enum ndr_err_code ndr_push_spoolss_NotifyTable(struct ndr_push *ndr, int ndr_flags, enum spoolss_NotifyTable r) { - uint32_t cntr_data_0; - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_pull_align(ndr, 2)); - for (cntr_data_0 = 0; cntr_data_0 < 8; cntr_data_0++) { - NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->data[cntr_data_0])); - } - } - if (ndr_flags & NDR_BUFFERS) { - } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_spoolss_NotifyBlobData(struct ndr_print *ndr, const char *name, const struct spoolss_NotifyBlobData *r) +static enum ndr_err_code ndr_pull_spoolss_NotifyTable(struct ndr_pull *ndr, int ndr_flags, enum spoolss_NotifyTable *r) { - uint32_t cntr_data_0; - ndr_print_struct(ndr, name, "spoolss_NotifyBlobData"); - ndr->depth++; - ndr->print(ndr, "%s: ARRAY(%d)", "data", (int)8); - ndr->depth++; - for (cntr_data_0=0;cntr_data_0<8;cntr_data_0++) { - char *idx_0=NULL; - if (asprintf(&idx_0, "[%d]", cntr_data_0) != -1) { - ndr_print_uint16(ndr, "data", r->data[cntr_data_0]); - free(idx_0); - } - } - ndr->depth--; - ndr->depth--; -} - -static enum ndr_err_code ndr_push_spoolss_NotifyBlob(struct ndr_push *ndr, int ndr_flags, const struct spoolss_NotifyBlob *r) -{ - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->len)); - NDR_CHECK(ndr_push_unique_ptr(ndr, r->data)); - } - if (ndr_flags & NDR_BUFFERS) { - if (r->data) { - NDR_CHECK(ndr_push_spoolss_NotifyBlobData(ndr, NDR_SCALARS, r->data)); - } - } + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_spoolss_NotifyBlob(struct ndr_pull *ndr, int ndr_flags, struct spoolss_NotifyBlob *r) +_PUBLIC_ void ndr_print_spoolss_NotifyTable(struct ndr_print *ndr, const char *name, enum spoolss_NotifyTable r) { - uint32_t _ptr_data; - TALLOC_CTX *_mem_save_data_0; - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_pull_align(ndr, 4)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->len)); - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data)); - if (_ptr_data) { - NDR_PULL_ALLOC(ndr, r->data); - } else { - r->data = NULL; - } - } - if (ndr_flags & NDR_BUFFERS) { - if (r->data) { - _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->data, 0); - NDR_CHECK(ndr_pull_spoolss_NotifyBlobData(ndr, NDR_SCALARS, r->data)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0); - } - } - return NDR_ERR_SUCCESS; -} + const char *val = NULL; -_PUBLIC_ void ndr_print_spoolss_NotifyBlob(struct ndr_print *ndr, const char *name, const struct spoolss_NotifyBlob *r) -{ - ndr_print_struct(ndr, name, "spoolss_NotifyBlob"); - ndr->depth++; - ndr_print_uint32(ndr, "len", r->len); - ndr_print_ptr(ndr, "data", r->data); - ndr->depth++; - if (r->data) { - ndr_print_spoolss_NotifyBlobData(ndr, "data", r->data); + switch (r) { + case NOTIFY_TABLE_DWORD: val = "NOTIFY_TABLE_DWORD"; break; + case NOTIFY_TABLE_STRING: val = "NOTIFY_TABLE_STRING"; break; + case NOTIFY_TABLE_DEVMODE: val = "NOTIFY_TABLE_DEVMODE"; break; + case NOTIFY_TABLE_TIME: val = "NOTIFY_TABLE_TIME"; break; + case NOTIFY_TABLE_SECURITYDESCRIPTOR: val = "NOTIFY_TABLE_SECURITYDESCRIPTOR"; break; } - ndr->depth--; - ndr->depth--; + ndr_print_enum(ndr, name, "ENUM", val, r); } static enum ndr_err_code ndr_push_spoolss_NotifyData(struct ndr_push *ndr, int ndr_flags, const union spoolss_NotifyData *r) @@ -10335,23 +10263,26 @@ static enum ndr_err_code ndr_push_spoolss_NotifyData(struct ndr_push *ndr, int n NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, level)); switch (level) { case 1: { - NDR_CHECK(ndr_push_dlong(ndr, NDR_SCALARS, r->integer)); + uint32_t cntr_integer_0; + for (cntr_integer_0 = 0; cntr_integer_0 < 2; cntr_integer_0++) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->integer[cntr_integer_0])); + } break; } case 2: { - NDR_CHECK(ndr_push_spoolss_NotifyUTF16String(ndr, NDR_SCALARS, &r->utf16_string)); + NDR_CHECK(ndr_push_spoolss_NotifyString(ndr, NDR_SCALARS, &r->string)); break; } case 3: { - NDR_CHECK(ndr_push_spoolss_NotifyDOSString(ndr, NDR_SCALARS, &r->ascii_string)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->devmode)); break; } case 4: { - NDR_CHECK(ndr_push_spoolss_NotifyBlob(ndr, NDR_SCALARS, &r->blob)); + NDR_CHECK(ndr_push_spoolss_TimeCtr(ndr, NDR_SCALARS, &r->time)); break; } case 5: { - NDR_CHECK(ndr_push_spoolss_NotifyDOSString(ndr, NDR_SCALARS, &r->ascii_string)); + NDR_CHECK(ndr_push_sec_desc_buf(ndr, NDR_SCALARS, &r->sd)); break; } default: @@ -10365,19 +10296,21 @@ static enum ndr_err_code ndr_push_spoolss_NotifyData(struct ndr_push *ndr, int n break; case 2: - NDR_CHECK(ndr_push_spoolss_NotifyUTF16String(ndr, NDR_BUFFERS, &r->utf16_string)); + NDR_CHECK(ndr_push_spoolss_NotifyString(ndr, NDR_BUFFERS, &r->string)); break; case 3: - NDR_CHECK(ndr_push_spoolss_NotifyDOSString(ndr, NDR_BUFFERS, &r->ascii_string)); + if (r->devmode) { + NDR_CHECK(ndr_push_spoolss_DeviceMode(ndr, NDR_SCALARS, r->devmode)); + } break; case 4: - NDR_CHECK(ndr_push_spoolss_NotifyBlob(ndr, NDR_BUFFERS, &r->blob)); + NDR_CHECK(ndr_push_spoolss_TimeCtr(ndr, NDR_BUFFERS, &r->time)); break; case 5: - NDR_CHECK(ndr_push_spoolss_NotifyDOSString(ndr, NDR_BUFFERS, &r->ascii_string)); + NDR_CHECK(ndr_push_sec_desc_buf(ndr, NDR_BUFFERS, &r->sd)); break; default: @@ -10391,6 +10324,7 @@ static enum ndr_err_code ndr_pull_spoolss_NotifyData(struct ndr_pull *ndr, int n { int level; uint32_t _level; + TALLOC_CTX *_mem_save_devmode_0; level = ndr_pull_get_switch_value(ndr, r); if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &_level)); @@ -10399,23 +10333,32 @@ static enum ndr_err_code ndr_pull_spoolss_NotifyData(struct ndr_pull *ndr, int n } switch (level) { case 1: { - NDR_CHECK(ndr_pull_dlong(ndr, NDR_SCALARS, &r->integer)); + uint32_t cntr_integer_0; + for (cntr_integer_0 = 0; cntr_integer_0 < 2; cntr_integer_0++) { + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->integer[cntr_integer_0])); + } break; } case 2: { - NDR_CHECK(ndr_pull_spoolss_NotifyUTF16String(ndr, NDR_SCALARS, &r->utf16_string)); + NDR_CHECK(ndr_pull_spoolss_NotifyString(ndr, NDR_SCALARS, &r->string)); break; } case 3: { - NDR_CHECK(ndr_pull_spoolss_NotifyDOSString(ndr, NDR_SCALARS, &r->ascii_string)); + uint32_t _ptr_devmode; + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_devmode)); + if (_ptr_devmode) { + NDR_PULL_ALLOC(ndr, r->devmode); + } else { + r->devmode = NULL; + } break; } case 4: { - NDR_CHECK(ndr_pull_spoolss_NotifyBlob(ndr, NDR_SCALARS, &r->blob)); + NDR_CHECK(ndr_pull_spoolss_TimeCtr(ndr, NDR_SCALARS, &r->time)); break; } case 5: { - NDR_CHECK(ndr_pull_spoolss_NotifyDOSString(ndr, NDR_SCALARS, &r->ascii_string)); + NDR_CHECK(ndr_pull_sec_desc_buf(ndr, NDR_SCALARS, &r->sd)); break; } default: @@ -10428,19 +10371,24 @@ static enum ndr_err_code ndr_pull_spoolss_NotifyData(struct ndr_pull *ndr, int n break; case 2: - NDR_CHECK(ndr_pull_spoolss_NotifyUTF16String(ndr, NDR_BUFFERS, &r->utf16_string)); + NDR_CHECK(ndr_pull_spoolss_NotifyString(ndr, NDR_BUFFERS, &r->string)); break; case 3: - NDR_CHECK(ndr_pull_spoolss_NotifyDOSString(ndr, NDR_BUFFERS, &r->ascii_string)); + if (r->devmode) { + _mem_save_devmode_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->devmode, 0); + NDR_CHECK(ndr_pull_spoolss_DeviceMode(ndr, NDR_SCALARS, r->devmode)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_devmode_0, 0); + } break; case 4: - NDR_CHECK(ndr_pull_spoolss_NotifyBlob(ndr, NDR_BUFFERS, &r->blob)); + NDR_CHECK(ndr_pull_spoolss_TimeCtr(ndr, NDR_BUFFERS, &r->time)); break; case 5: - NDR_CHECK(ndr_pull_spoolss_NotifyDOSString(ndr, NDR_BUFFERS, &r->ascii_string)); + NDR_CHECK(ndr_pull_sec_desc_buf(ndr, NDR_BUFFERS, &r->sd)); break; default: @@ -10453,27 +10401,42 @@ static enum ndr_err_code ndr_pull_spoolss_NotifyData(struct ndr_pull *ndr, int n _PUBLIC_ void ndr_print_spoolss_NotifyData(struct ndr_print *ndr, const char *name, const union spoolss_NotifyData *r) { int level; + uint32_t cntr_integer_0; level = ndr_print_get_switch_value(ndr, r); ndr_print_union(ndr, name, level, "spoolss_NotifyData"); switch (level) { case 1: - ndr_print_dlong(ndr, "integer", r->integer); + ndr->print(ndr, "%s: ARRAY(%d)", "integer", (int)2); + ndr->depth++; + for (cntr_integer_0=0;cntr_integer_0<2;cntr_integer_0++) { + char *idx_0=NULL; + if (asprintf(&idx_0, "[%d]", cntr_integer_0) != -1) { + ndr_print_uint32(ndr, "integer", r->integer[cntr_integer_0]); + free(idx_0); + } + } + ndr->depth--; break; case 2: - ndr_print_spoolss_NotifyUTF16String(ndr, "utf16_string", &r->utf16_string); + ndr_print_spoolss_NotifyString(ndr, "string", &r->string); break; case 3: - ndr_print_spoolss_NotifyDOSString(ndr, "ascii_string", &r->ascii_string); + ndr_print_ptr(ndr, "devmode", r->devmode); + ndr->depth++; + if (r->devmode) { + ndr_print_spoolss_DeviceMode(ndr, "devmode", r->devmode); + } + ndr->depth--; break; case 4: - ndr_print_spoolss_NotifyBlob(ndr, "blob", &r->blob); + ndr_print_spoolss_TimeCtr(ndr, "time", &r->time); break; case 5: - ndr_print_spoolss_NotifyDOSString(ndr, "ascii_string", &r->ascii_string); + ndr_print_sec_desc_buf(ndr, "sd", &r->sd); break; default: @@ -10487,7 +10450,7 @@ static enum ndr_err_code ndr_push_spoolss_Notify(struct ndr_push *ndr, int ndr_f NDR_CHECK(ndr_push_align(ndr, 4)); NDR_CHECK(ndr_push_spoolss_NotifyType(ndr, NDR_SCALARS, r->type)); NDR_CHECK(ndr_push_spoolss_Field(ndr, NDR_SCALARS, r->field)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->variable_type)); + NDR_CHECK(ndr_push_spoolss_NotifyTable(ndr, NDR_SCALARS, r->variable_type)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->job_id)); NDR_CHECK(ndr_push_set_switch_value(ndr, &r->data, r->variable_type)); NDR_CHECK(ndr_push_spoolss_NotifyData(ndr, NDR_SCALARS, &r->data)); @@ -10504,7 +10467,7 @@ static enum ndr_err_code ndr_pull_spoolss_Notify(struct ndr_pull *ndr, int ndr_f NDR_CHECK(ndr_pull_align(ndr, 4)); NDR_CHECK(ndr_pull_spoolss_NotifyType(ndr, NDR_SCALARS, &r->type)); NDR_CHECK(ndr_pull_spoolss_Field(ndr, NDR_SCALARS, &r->field)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->variable_type)); + NDR_CHECK(ndr_pull_spoolss_NotifyTable(ndr, NDR_SCALARS, &r->variable_type)); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->job_id)); NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->data, r->variable_type)); NDR_CHECK(ndr_pull_spoolss_NotifyData(ndr, NDR_SCALARS, &r->data)); @@ -10521,7 +10484,7 @@ _PUBLIC_ void ndr_print_spoolss_Notify(struct ndr_print *ndr, const char *name, ndr->depth++; ndr_print_spoolss_NotifyType(ndr, "type", r->type); ndr_print_spoolss_Field(ndr, "field", r->field); - ndr_print_uint32(ndr, "variable_type", r->variable_type); + ndr_print_spoolss_NotifyTable(ndr, "variable_type", r->variable_type); ndr_print_uint32(ndr, "job_id", r->job_id); ndr_print_set_switch_value(ndr, &r->data, r->variable_type); ndr_print_spoolss_NotifyData(ndr, "data", &r->data); @@ -10534,7 +10497,7 @@ static enum ndr_err_code ndr_push_spoolss_NotifyInfo(struct ndr_push *ndr, int n if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->version)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 2)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->flags)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); for (cntr_notifies_0 = 0; cntr_notifies_0 < r->count; cntr_notifies_0++) { @@ -10586,7 +10549,7 @@ _PUBLIC_ void ndr_print_spoolss_NotifyInfo(struct ndr_print *ndr, const char *na uint32_t cntr_notifies_0; ndr_print_struct(ndr, name, "spoolss_NotifyInfo"); ndr->depth++; - ndr_print_uint32(ndr, "version", r->version); + ndr_print_uint32(ndr, "version", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?2:r->version); ndr_print_uint32(ndr, "flags", r->flags); ndr_print_uint32(ndr, "count", r->count); ndr->print(ndr, "%s: ARRAY(%d)", "notifies", (int)r->count); @@ -17211,6 +17174,10 @@ static enum ndr_err_code ndr_push_spoolss_AddPrinterEx(struct ndr_push *ndr, int NDR_CHECK(ndr_push_spoolss_UserLevel(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.userlevel)); } if (flags & NDR_OUT) { + if (r->out.handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.handle)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -17224,7 +17191,10 @@ static enum ndr_err_code ndr_pull_spoolss_AddPrinterEx(struct ndr_pull *ndr, int TALLOC_CTX *_mem_save_server_0; TALLOC_CTX *_mem_save_info_0; TALLOC_CTX *_mem_save_secdesc_0; + TALLOC_CTX *_mem_save_handle_0; if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server)); if (_ptr_server) { NDR_PULL_ALLOC(ndr, r->in.server); @@ -17273,8 +17243,17 @@ static enum ndr_err_code ndr_pull_spoolss_AddPrinterEx(struct ndr_pull *ndr, int NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.ulevel)); NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->in.userlevel, r->in.ulevel)); NDR_CHECK(ndr_pull_spoolss_UserLevel(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.userlevel)); + NDR_PULL_ALLOC(ndr, r->out.handle); + ZERO_STRUCTP(r->out.handle); } if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.handle); + } + _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_policy_handle(ndr, NDR_SCALARS, r->out.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; @@ -17319,6 +17298,10 @@ _PUBLIC_ void ndr_print_spoolss_AddPrinterEx(struct ndr_print *ndr, const char * if (flags & NDR_OUT) { ndr_print_struct(ndr, "out", "spoolss_AddPrinterEx"); ndr->depth++; + ndr_print_ptr(ndr, "handle", r->out.handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->out.handle); + ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; } diff --git a/librpc/gen_ndr/ndr_spoolss.h b/librpc/gen_ndr/ndr_spoolss.h index ef97a01ecd..3bf74e5ff9 100644 --- a/librpc/gen_ndr/ndr_spoolss.h +++ b/librpc/gen_ndr/ndr_spoolss.h @@ -206,6 +206,7 @@ extern const struct ndr_interface_table ndr_table_spoolss; #define NDR_SPOOLSS_CALL_COUNT (96) void ndr_print_spoolss_Time(struct ndr_print *ndr, const char *name, const struct spoolss_Time *r); +void ndr_print_spoolss_TimeCtr(struct ndr_print *ndr, const char *name, const struct spoolss_TimeCtr *r); void ndr_print_spoolss_PrinterInfo0(struct ndr_print *ndr, const char *name, const struct spoolss_PrinterInfo0 *r); void ndr_print_spoolss_DeviceModeFields(struct ndr_print *ndr, const char *name, uint32_t r); enum ndr_err_code ndr_push_spoolss_DeviceMode(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DeviceMode *r); @@ -308,10 +309,8 @@ void ndr_print_spoolss_Field(struct ndr_print *ndr, const char *name, enum spool void ndr_print_spoolss_NotifyType(struct ndr_print *ndr, const char *name, enum spoolss_NotifyType r); void ndr_print_spoolss_NotifyOptionsArray(struct ndr_print *ndr, const char *name, const struct spoolss_NotifyOptionsArray *r); void ndr_print_spoolss_NotifyOptionsContainer(struct ndr_print *ndr, const char *name, const struct spoolss_NotifyOptionsContainer *r); -void ndr_print_spoolss_NotifyUTF16String(struct ndr_print *ndr, const char *name, const struct spoolss_NotifyUTF16String *r); -void ndr_print_spoolss_NotifyDOSString(struct ndr_print *ndr, const char *name, const struct spoolss_NotifyDOSString *r); -void ndr_print_spoolss_NotifyBlobData(struct ndr_print *ndr, const char *name, const struct spoolss_NotifyBlobData *r); -void ndr_print_spoolss_NotifyBlob(struct ndr_print *ndr, const char *name, const struct spoolss_NotifyBlob *r); +void ndr_print_spoolss_NotifyString(struct ndr_print *ndr, const char *name, const struct spoolss_NotifyString *r); +void ndr_print_spoolss_NotifyTable(struct ndr_print *ndr, const char *name, enum spoolss_NotifyTable r); void ndr_print_spoolss_NotifyData(struct ndr_print *ndr, const char *name, const union spoolss_NotifyData *r); void ndr_print_spoolss_Notify(struct ndr_print *ndr, const char *name, const struct spoolss_Notify *r); void ndr_print_spoolss_NotifyInfo(struct ndr_print *ndr, const char *name, const struct spoolss_NotifyInfo *r); diff --git a/librpc/gen_ndr/spoolss.h b/librpc/gen_ndr/spoolss.h index 3554d37b39..d60aea582a 100644 --- a/librpc/gen_ndr/spoolss.h +++ b/librpc/gen_ndr/spoolss.h @@ -41,6 +41,11 @@ struct spoolss_Time { uint16_t minute; uint16_t second; uint16_t millisecond; +}/* [gensize] */; + +struct spoolss_TimeCtr { + uint32_t size;/* [value(ndr_size_spoolss_Time(time,ndr->iconv_convenience,ndr->flags))] */ + struct spoolss_Time *time;/* [unique] */ }; struct spoolss_PrinterInfo0 { @@ -555,6 +560,34 @@ struct spoolss_DriverInfo6 { const char * provider;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ }; +struct spoolss_DriverInfo8 { + enum spoolss_DriverOSVersion version; + const char * driver_name;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char * architecture;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char * driver_path;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char * data_file;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char * config_file;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char * help_file;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char * monitor_name;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char * default_datatype;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char ** dependent_files;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char ** previous_names;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ + NTTIME driver_data; + uint64_t driver_version; + const char * manufacturer_name;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char * manufacturer_url;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char * hardware_id;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char * provider;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char * print_processor;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char * vendor_setup;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char ** color_profiles;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ + const char * inf_path;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ + uint32_t printer_driver_attributes; + const char ** core_driver_dependencies;/* [relative,flag(LIBNDR_FLAG_STR_NULLTERM)] */ + NTTIME min_inbox_driver_ver_date; + uint64_t min_inbox_driver_ver_version; +}; + union spoolss_DriverInfo { struct spoolss_DriverInfo1 info1;/* [case] */ struct spoolss_DriverInfo2 info2;/* [case(2)] */ @@ -830,48 +863,54 @@ struct spoolss_NotifyOptionsArray { }; struct spoolss_NotifyOptionsContainer { - uint32_t version; + uint32_t version;/* [value(2)] */ uint32_t flags; uint32_t count; struct spoolss_NotifyOptionsArray *options;/* [unique,size_is(count)] */ }; -struct spoolss_NotifyUTF16String { +struct spoolss_NotifyString { uint32_t size; const char *string;/* [unique,charset(UTF16),size_is(size/2)] */ }; -struct spoolss_NotifyDOSString { - uint32_t size; - const char *string;/* [unique,charset(DOS),size_is(size)] */ -}; - -struct spoolss_NotifyBlobData { - uint16_t data[8]; -}; - -struct spoolss_NotifyBlob { - uint32_t len; - struct spoolss_NotifyBlobData *data;/* [unique] */ -}; +enum spoolss_NotifyTable +#ifndef USE_UINT_ENUMS + { + NOTIFY_TABLE_DWORD=0x0001, + NOTIFY_TABLE_STRING=0x0002, + NOTIFY_TABLE_DEVMODE=0x0003, + NOTIFY_TABLE_TIME=0x0004, + NOTIFY_TABLE_SECURITYDESCRIPTOR=0x0005 +} +#else + { __donnot_use_enum_spoolss_NotifyTable=0x7FFFFFFF} +#define NOTIFY_TABLE_DWORD ( 0x0001 ) +#define NOTIFY_TABLE_STRING ( 0x0002 ) +#define NOTIFY_TABLE_DEVMODE ( 0x0003 ) +#define NOTIFY_TABLE_TIME ( 0x0004 ) +#define NOTIFY_TABLE_SECURITYDESCRIPTOR ( 0x0005 ) +#endif +; union spoolss_NotifyData { - int64_t integer;/* [case] */ - struct spoolss_NotifyUTF16String utf16_string;/* [case(2)] */ - struct spoolss_NotifyDOSString ascii_string;/* [case(3)] */ - struct spoolss_NotifyBlob blob;/* [case(4)] */ + uint32_t integer[2];/* [case] */ + struct spoolss_NotifyString string;/* [case(2)] */ + struct spoolss_DeviceMode *devmode;/* [unique,case(3)] */ + struct spoolss_TimeCtr time;/* [case(4)] */ + struct sec_desc_buf sd;/* [case(5)] */ }/* [switch_type(uint32)] */; struct spoolss_Notify { enum spoolss_NotifyType type; enum spoolss_Field field; - uint32_t variable_type; + enum spoolss_NotifyTable variable_type; uint32_t job_id; union spoolss_NotifyData data;/* [switch_is(variable_type)] */ }; struct spoolss_NotifyInfo { - uint32_t version; + uint32_t version;/* [value(2)] */ uint32_t flags; uint32_t count; struct spoolss_Notify *notifies;/* [size_is(count)] */ @@ -2106,6 +2145,7 @@ struct spoolss_AddPrinterEx { } in; struct { + struct policy_handle *handle;/* [ref] */ WERROR result; } out; diff --git a/librpc/gen_ndr/srv_spoolss.c b/librpc/gen_ndr/srv_spoolss.c index 1f8c89a53f..eaee600b62 100644 --- a/librpc/gen_ndr/srv_spoolss.c +++ b/librpc/gen_ndr/srv_spoolss.c @@ -5409,6 +5409,13 @@ static bool api_spoolss_AddPrinterEx(pipes_struct *p) NDR_PRINT_IN_DEBUG(spoolss_AddPrinterEx, r); } + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(r, struct policy_handle); + if (r->out.handle == NULL) { + talloc_free(r); + return false; + } + r->out.result = _spoolss_AddPrinterEx(p, r); if (p->rng_fault_state) { @@ -8120,6 +8127,12 @@ NTSTATUS rpc_spoolss_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, case NDR_SPOOLSS_ADDPRINTEREX: { struct spoolss_AddPrinterEx *r = (struct spoolss_AddPrinterEx *)_r; + ZERO_STRUCT(r->out); + r->out.handle = talloc_zero(mem_ctx, struct policy_handle); + if (r->out.handle == NULL) { + return NT_STATUS_NO_MEMORY; + } + r->out.result = _spoolss_AddPrinterEx(cli->pipes_struct, r); return NT_STATUS_OK; } |