s3-kerberos: temporary fix for ipv6 in print_kdc_line().
[Samba/bb.git] / librpc / ndr / ndr_spoolss_buf.c
blob5aa89e408eb96c903aab939b51bf97789783f2b4
1 /*
2 Unix SMB/CIFS implementation.
4 routines for marshalling/unmarshalling spoolss subcontext buffer structures
6 Copyright (C) Andrew Tridgell 2003
7 Copyright (C) Tim Potter 2003
8 Copyright (C) Guenther Deschner 2009
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #include "includes.h"
26 #include "librpc/gen_ndr/ndr_spoolss.h"
27 #include "librpc/gen_ndr/ndr_security.h"
28 #if (_SAMBA_BUILD_ >= 4)
29 #include "param/param.h"
30 #endif
32 #define NDR_SPOOLSS_PUSH_ENUM_IN(fn) do { \
33 if (!r->in.buffer && r->in.offered != 0) {\
34 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
35 "SPOOLSS Buffer: r->in.offered[%u] but there's no buffer",\
36 (unsigned)r->in.offered);\
37 } else if (r->in.buffer && r->in.buffer->length != r->in.offered) {\
38 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
39 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of r->in.buffer[%u]",\
40 (unsigned)r->in.offered, (unsigned)r->in.buffer->length);\
42 _r.in.level = r->in.level;\
43 _r.in.buffer = r->in.buffer;\
44 _r.in.offered = r->in.offered;\
45 NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\
46 } while(0)
48 #define NDR_SPOOLSS_PUSH_ENUM_OUT(fn) do { \
49 struct ndr_push *_ndr_info;\
50 _r.in.level = r->in.level;\
51 _r.in.buffer = r->in.buffer;\
52 _r.in.offered = r->in.offered;\
53 _r.out.info = NULL;\
54 _r.out.needed = r->out.needed;\
55 _r.out.count = r->out.count;\
56 _r.out.result = r->out.result;\
57 if (r->out.info && *r->out.info && !r->in.buffer) {\
58 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
59 "SPOOLSS Buffer: *r->out.info but there's no r->in.buffer");\
61 if (r->in.buffer) {\
62 DATA_BLOB _data_blob_info;\
63 _ndr_info = ndr_push_init_ctx(ndr, ndr->iconv_convenience);\
64 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
65 _ndr_info->flags= ndr->flags;\
66 if (r->out.info) {\
67 struct ndr_push *_subndr_info;\
68 struct __##fn __r;\
69 __r.in.level = r->in.level;\
70 __r.in.count = *r->out.count;\
71 __r.out.info = *r->out.info;\
72 NDR_CHECK(ndr_push_subcontext_start(_ndr_info, &_subndr_info, 0, r->in.offered));\
73 NDR_CHECK(ndr_push___##fn(_subndr_info, flags, &__r)); \
74 NDR_CHECK(ndr_push_subcontext_end(_ndr_info, _subndr_info, 0, r->in.offered));\
76 if (r->in.offered > _ndr_info->offset) {\
77 uint32_t _padding_len = r->in.offered - _ndr_info->offset;\
78 NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len));\
79 } else if (r->in.offered < _ndr_info->offset) {\
80 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
81 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of out buffer[%u]!",\
82 (unsigned)r->in.offered, (unsigned)_ndr_info->offset);\
84 _data_blob_info = ndr_push_blob(_ndr_info);\
85 _r.out.info = &_data_blob_info;\
87 NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\
88 } while(0)
90 #define NDR_SPOOLSS_PUSH_ENUM(fn,in,out) do { \
91 struct _##fn _r;\
92 if (flags & NDR_IN) {\
93 in;\
94 NDR_SPOOLSS_PUSH_ENUM_IN(fn);\
96 if (flags & NDR_OUT) {\
97 out;\
98 NDR_SPOOLSS_PUSH_ENUM_OUT(fn);\
100 } while(0)
102 #define NDR_SPOOLSS_PULL_ENUM_IN(fn) do { \
103 ZERO_STRUCT(r->out);\
104 NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
105 r->in.level = _r.in.level;\
106 r->in.buffer = _r.in.buffer;\
107 r->in.offered = _r.in.offered;\
108 r->out.needed = _r.out.needed;\
109 r->out.count = _r.out.count;\
110 if (!r->in.buffer && r->in.offered != 0) {\
111 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
112 "SPOOLSS Buffer: r->in.offered[%u] but there's no buffer",\
113 (unsigned)r->in.offered);\
114 } else if (r->in.buffer && r->in.buffer->length != r->in.offered) {\
115 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
116 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of r->in.buffer[%u]",\
117 (unsigned)r->in.offered, (unsigned)r->in.buffer->length);\
119 NDR_PULL_ALLOC(ndr, r->out.info);\
120 ZERO_STRUCTP(r->out.info);\
121 } while(0)
123 #define NDR_SPOOLSS_PULL_ENUM_OUT(fn) do { \
124 _r.in.level = r->in.level;\
125 _r.in.buffer = r->in.buffer;\
126 _r.in.offered = r->in.offered;\
127 _r.out.needed = r->out.needed;\
128 _r.out.count = r->out.count;\
129 NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
130 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {\
131 NDR_PULL_ALLOC(ndr, r->out.info);\
133 *r->out.info = NULL;\
134 r->out.needed = _r.out.needed;\
135 r->out.count = _r.out.count;\
136 r->out.result = _r.out.result;\
137 if (_r.out.info) {\
138 struct ndr_pull *_ndr_info;\
139 NDR_PULL_ALLOC(ndr, *r->out.info);\
140 _ndr_info = ndr_pull_init_blob(_r.out.info, *r->out.info, ndr->iconv_convenience);\
141 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
142 _ndr_info->flags= ndr->flags;\
143 if (r->in.offered != _ndr_info->data_size) {\
144 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
145 "SPOOLSS Buffer: offered[%u] doesn't match length of buffer[%u]",\
146 (unsigned)r->in.offered, (unsigned)_ndr_info->data_size);\
148 if (*r->out.needed <= _ndr_info->data_size) {\
149 struct __##fn __r;\
150 __r.in.level = r->in.level;\
151 __r.in.count = *r->out.count;\
152 __r.out.info = NULL;\
153 NDR_CHECK(ndr_pull___##fn(_ndr_info, flags, &__r));\
154 *r->out.info = __r.out.info;\
157 } while(0)
159 #define NDR_SPOOLSS_PULL_ENUM(fn,in,out) do { \
160 struct _##fn _r;\
161 if (flags & NDR_IN) {\
162 out;\
163 NDR_SPOOLSS_PULL_ENUM_IN(fn);\
164 in;\
166 if (flags & NDR_OUT) {\
167 out;\
168 NDR_SPOOLSS_PULL_ENUM_OUT(fn);\
170 } while(0)
172 #define _NDR_CHECK_UINT32(call) do {\
173 enum ndr_err_code _ndr_err; \
174 _ndr_err = call; \
175 if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \
176 return 0; \
178 } while (0)
180 /* TODO: set _ndr_info->flags correct */
181 #define NDR_SPOOLSS_SIZE_ENUM_LEVEL(fn) do { \
182 struct __##fn __r;\
183 DATA_BLOB _data_blob_info;\
184 struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx, iconv_convenience);\
185 if (!_ndr_info) return 0;\
186 _ndr_info->flags|=LIBNDR_FLAG_NO_NDR_SIZE;\
187 __r.in.level = level;\
188 __r.in.count = count;\
189 __r.out.info = info;\
190 _NDR_CHECK_UINT32(ndr_push___##fn(_ndr_info, NDR_OUT, &__r)); \
191 _data_blob_info = ndr_push_blob(_ndr_info);\
192 return _data_blob_info.length;\
193 } while(0)
195 /* TODO: set _ndr_info->flags correct */
196 #define NDR_SPOOLSS_SIZE_ENUM(fn) do { \
197 struct __##fn __r;\
198 DATA_BLOB _data_blob_info;\
199 struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx, iconv_convenience);\
200 if (!_ndr_info) return 0;\
201 _ndr_info->flags|=LIBNDR_FLAG_NO_NDR_SIZE;\
202 __r.in.count = count;\
203 __r.out.info = info;\
204 _NDR_CHECK_UINT32(ndr_push___##fn(_ndr_info, NDR_OUT, &__r)); \
205 _data_blob_info = ndr_push_blob(_ndr_info);\
206 return _data_blob_info.length;\
207 } while(0)
211 spoolss_EnumPrinters
213 enum ndr_err_code ndr_push_spoolss_EnumPrinters(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinters *r)
215 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinters,{
216 _r.in.flags = r->in.flags;
217 _r.in.server = r->in.server;
219 _r.in.flags = r->in.flags;
220 _r.in.server = r->in.server;
222 return NDR_ERR_SUCCESS;
225 enum ndr_err_code ndr_pull_spoolss_EnumPrinters(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinters *r)
227 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrinters,{
228 r->in.flags = _r.in.flags;
229 r->in.server = _r.in.server;
231 _r.in.flags = r->in.flags;
232 _r.in.server = r->in.server;
234 return NDR_ERR_SUCCESS;
237 uint32_t ndr_size_spoolss_EnumPrinters_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_PrinterInfo *info)
239 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrinters);
243 spoolss_EnumJobs
245 enum ndr_err_code ndr_push_spoolss_EnumJobs(struct ndr_push *ndr, int flags, const struct spoolss_EnumJobs *r)
247 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumJobs,{
248 _r.in.handle = r->in.handle;
249 _r.in.firstjob = r->in.firstjob;
250 _r.in.numjobs = r->in.numjobs;
252 _r.in.handle = r->in.handle;
253 _r.in.firstjob = r->in.firstjob;
254 _r.in.numjobs = r->in.numjobs;
256 return NDR_ERR_SUCCESS;
259 enum ndr_err_code ndr_pull_spoolss_EnumJobs(struct ndr_pull *ndr, int flags, struct spoolss_EnumJobs *r)
261 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumJobs,{
262 r->in.handle = _r.in.handle;
263 r->in.firstjob = _r.in.firstjob;
264 r->in.numjobs = _r.in.numjobs;
266 _r.in.handle = r->in.handle;
267 _r.in.firstjob = r->in.firstjob;
268 _r.in.numjobs = r->in.numjobs;
270 return NDR_ERR_SUCCESS;
273 uint32_t ndr_size_spoolss_EnumJobs_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_JobInfo *info)
275 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumJobs);
279 spoolss_EnumPrinterDrivers
281 enum ndr_err_code ndr_push_spoolss_EnumPrinterDrivers(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDrivers *r)
283 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinterDrivers,{
284 _r.in.server = r->in.server;
285 _r.in.environment = r->in.environment;
287 _r.in.server = r->in.server;
288 _r.in.environment = r->in.environment;
290 return NDR_ERR_SUCCESS;
293 enum ndr_err_code ndr_pull_spoolss_EnumPrinterDrivers(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDrivers *r)
295 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrinterDrivers,{
296 r->in.server = _r.in.server;
297 r->in.environment = _r.in.environment;
299 _r.in.server = r->in.server;
300 _r.in.environment = r->in.environment;
302 return NDR_ERR_SUCCESS;
305 uint32_t ndr_size_spoolss_EnumPrinterDrivers_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_DriverInfo *info)
307 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrinterDrivers);
311 spoolss_EnumForms
313 enum ndr_err_code ndr_push_spoolss_EnumForms(struct ndr_push *ndr, int flags, const struct spoolss_EnumForms *r)
315 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumForms,{
316 _r.in.handle = r->in.handle;
318 _r.in.handle = r->in.handle;
320 return NDR_ERR_SUCCESS;
323 enum ndr_err_code ndr_pull_spoolss_EnumForms(struct ndr_pull *ndr, int flags, struct spoolss_EnumForms *r)
325 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumForms,{
326 r->in.handle = _r.in.handle;
328 _r.in.handle = r->in.handle;
330 return NDR_ERR_SUCCESS;
333 uint32_t ndr_size_spoolss_EnumForms_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_FormInfo *info)
335 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumForms);
339 spoolss_EnumPorts
341 enum ndr_err_code ndr_push_spoolss_EnumPorts(struct ndr_push *ndr, int flags, const struct spoolss_EnumPorts *r)
343 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPorts,{
344 _r.in.servername= r->in.servername;
346 _r.in.servername= r->in.servername;
348 return NDR_ERR_SUCCESS;
351 enum ndr_err_code ndr_pull_spoolss_EnumPorts(struct ndr_pull *ndr, int flags, struct spoolss_EnumPorts *r)
353 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPorts,{
354 r->in.servername= _r.in.servername;
356 _r.in.servername= r->in.servername;
358 return NDR_ERR_SUCCESS;
361 uint32_t ndr_size_spoolss_EnumPorts_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_PortInfo *info)
363 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPorts);
367 spoolss_EnumMonitors
369 enum ndr_err_code ndr_push_spoolss_EnumMonitors(struct ndr_push *ndr, int flags, const struct spoolss_EnumMonitors *r)
371 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumMonitors,{
372 _r.in.servername= r->in.servername;
374 _r.in.servername= r->in.servername;
376 return NDR_ERR_SUCCESS;
379 enum ndr_err_code ndr_pull_spoolss_EnumMonitors(struct ndr_pull *ndr, int flags, struct spoolss_EnumMonitors *r)
381 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumMonitors,{
382 r->in.servername= _r.in.servername;
384 _r.in.servername= r->in.servername;
386 return NDR_ERR_SUCCESS;
389 uint32_t ndr_size_spoolss_EnumMonitors_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_MonitorInfo *info)
391 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumMonitors);
395 spoolss_EnumPrintProcessors
397 enum ndr_err_code ndr_push_spoolss_EnumPrintProcessors(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrintProcessors *r)
399 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrintProcessors,{
400 _r.in.servername = r->in.servername;
401 _r.in.environment = r->in.environment;
403 _r.in.servername = r->in.servername;
404 _r.in.environment = r->in.environment;
406 return NDR_ERR_SUCCESS;
409 enum ndr_err_code ndr_pull_spoolss_EnumPrintProcessors(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcessors *r)
411 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrintProcessors,{
412 r->in.servername = _r.in.servername;
413 r->in.environment = _r.in.environment;
415 _r.in.servername = r->in.servername;
416 _r.in.environment = r->in.environment;
418 return NDR_ERR_SUCCESS;
421 uint32_t ndr_size_spoolss_EnumPrintProcessors_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience,
422 uint32_t level, uint32_t count, union spoolss_PrintProcessorInfo *info)
424 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcessors);
428 spoolss_EnumPrintProcessors
430 enum ndr_err_code ndr_push_spoolss_EnumPrintProcDataTypes(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrintProcDataTypes *r)
432 NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrintProcDataTypes,{
433 _r.in.servername = r->in.servername;
434 _r.in.print_processor_name = r->in.print_processor_name;
436 _r.in.servername = r->in.servername;
437 _r.in.print_processor_name = r->in.print_processor_name;
439 return NDR_ERR_SUCCESS;
442 enum ndr_err_code ndr_pull_spoolss_EnumPrintProcDataTypes(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcDataTypes *r)
444 NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrintProcDataTypes,{
445 r->in.servername = _r.in.servername;
446 r->in.print_processor_name = _r.in.print_processor_name;
448 _r.in.servername = r->in.servername;
449 _r.in.print_processor_name = r->in.print_processor_name;
451 return NDR_ERR_SUCCESS;
454 uint32_t ndr_size_spoolss_EnumPrintProcDataTypes_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience,
455 uint32_t level, uint32_t count, union spoolss_PrintProcDataTypesInfo *info)
457 NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcDataTypes);
461 spoolss_EnumPrinterDataEx
464 enum ndr_err_code ndr_push_spoolss_EnumPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDataEx *r)
466 struct _spoolss_EnumPrinterDataEx _r;
467 if (flags & NDR_IN) {
468 _r.in.handle = r->in.handle;
469 _r.in.key_name = r->in.key_name;
470 _r.in.offered = r->in.offered;
471 NDR_CHECK(ndr_push__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
473 if (flags & NDR_OUT) {
474 struct ndr_push *_ndr_info;
475 _r.in.handle = r->in.handle;
476 _r.in.key_name = r->in.key_name;
477 _r.in.offered = r->in.offered;
478 _r.out.count = r->out.count;
479 _r.out.needed = r->out.needed;
480 _r.out.result = r->out.result;
481 _r.out.info = data_blob(NULL, 0);
482 if (r->in.offered >= *r->out.needed) {
483 struct __spoolss_EnumPrinterDataEx __r;
484 _ndr_info = ndr_push_init_ctx(ndr, ndr->iconv_convenience);
485 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);
486 _ndr_info->flags= ndr->flags;
487 __r.in.count = *r->out.count;
488 __r.out.info = *r->out.info;
489 NDR_CHECK(ndr_push___spoolss_EnumPrinterDataEx(_ndr_info, flags, &__r));
490 if (r->in.offered > _ndr_info->offset) {
491 uint32_t _padding_len = r->in.offered - _ndr_info->offset;
492 NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len));
494 _r.out.info = ndr_push_blob(_ndr_info);
496 NDR_CHECK(ndr_push__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
498 return NDR_ERR_SUCCESS;
501 enum ndr_err_code ndr_pull_spoolss_EnumPrinterDataEx(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDataEx *r)
503 struct _spoolss_EnumPrinterDataEx _r;
504 if (flags & NDR_IN) {
505 _r.in.handle = r->in.handle;
506 _r.in.key_name = r->in.key_name;
507 ZERO_STRUCT(r->out);
508 NDR_CHECK(ndr_pull__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
509 r->in.handle = _r.in.handle;
510 r->in.key_name = _r.in.key_name;
511 r->in.offered = _r.in.offered;
512 r->out.needed = _r.out.needed;
513 r->out.count = _r.out.count;
514 NDR_PULL_ALLOC(ndr, r->out.info);
515 ZERO_STRUCTP(r->out.info);
517 if (flags & NDR_OUT) {
518 _r.in.handle = r->in.handle;
519 _r.in.key_name = r->in.key_name;
520 _r.in.offered = r->in.offered;
521 _r.out.count = r->out.count;
522 _r.out.needed = r->out.needed;
523 NDR_CHECK(ndr_pull__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
524 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
525 NDR_PULL_ALLOC(ndr, r->out.info);
527 *r->out.info = NULL;
528 r->out.needed = _r.out.needed;
529 r->out.count = _r.out.count;
530 r->out.result = _r.out.result;
531 if (_r.out.info.length) {
532 struct ndr_pull *_ndr_info;
533 NDR_PULL_ALLOC(ndr, *r->out.info);
534 _ndr_info = ndr_pull_init_blob(&_r.out.info, *r->out.info, ndr->iconv_convenience);
535 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);
536 _ndr_info->flags= ndr->flags;
537 if (r->in.offered != _ndr_info->data_size) {
538 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,
539 "SPOOLSS Buffer: offered[%u] doesn't match length of buffer[%u]",
540 (unsigned)r->in.offered, (unsigned)_ndr_info->data_size);
542 if (*r->out.needed <= _ndr_info->data_size) {
543 struct __spoolss_EnumPrinterDataEx __r;
544 __r.in.count = *r->out.count;
545 __r.out.info = NULL;
546 NDR_CHECK(ndr_pull___spoolss_EnumPrinterDataEx(_ndr_info, flags, &__r));
547 *r->out.info = __r.out.info;
551 return NDR_ERR_SUCCESS;
554 uint32_t ndr_size_spoolss_EnumPrinterDataEx_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience,
555 uint32_t count, struct spoolss_PrinterEnumValues *info)
557 NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrinterDataEx);
560 uint32_t _ndr_size_spoolss_DeviceMode(struct spoolss_DeviceMode *devmode, struct smb_iconv_convenience *ic, uint32_t flags)
562 if (!devmode) return 0;
563 return ndr_size_spoolss_DeviceMode(devmode,ic,flags);
566 _PUBLIC_ size_t ndr_size_spoolss_StringArray(const struct spoolss_StringArray *r, struct smb_iconv_convenience *ic, int flags)
568 if (!r) {
569 return 4;
572 return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_StringArray, ic);
575 /* hand marshall as pidl cannot (yet) generate a relative pointer to a fixed array of
576 * structs */
578 _PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo101(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo101 *r)
580 uint32_t cntr_file_info_1;
581 if (ndr_flags & NDR_SCALARS) {
582 NDR_CHECK(ndr_push_align(ndr, 8));
583 NDR_CHECK(ndr_push_spoolss_DriverOSVersion(ndr, NDR_SCALARS, r->version));
585 uint32_t _flags_save_string = ndr->flags;
586 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
587 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->driver_name));
588 ndr->flags = _flags_save_string;
591 uint32_t _flags_save_string = ndr->flags;
592 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
593 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->architecture));
594 ndr->flags = _flags_save_string;
596 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->file_info));
597 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->file_count));
599 uint32_t _flags_save_string = ndr->flags;
600 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
601 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->monitor_name));
602 ndr->flags = _flags_save_string;
605 uint32_t _flags_save_string = ndr->flags;
606 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
607 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->default_datatype));
608 ndr->flags = _flags_save_string;
611 uint32_t _flags_save_string_array = ndr->flags;
612 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
613 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->previous_names));
614 ndr->flags = _flags_save_string_array;
616 NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->driver_date));
617 NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->driver_version));
619 uint32_t _flags_save_string = ndr->flags;
620 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
621 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->manufacturer_name));
622 ndr->flags = _flags_save_string;
625 uint32_t _flags_save_string = ndr->flags;
626 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
627 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->manufacturer_url));
628 ndr->flags = _flags_save_string;
631 uint32_t _flags_save_string = ndr->flags;
632 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
633 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->hardware_id));
634 ndr->flags = _flags_save_string;
637 uint32_t _flags_save_string = ndr->flags;
638 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
639 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->provider));
640 ndr->flags = _flags_save_string;
643 if (ndr_flags & NDR_BUFFERS) {
645 uint32_t _flags_save_string = ndr->flags;
646 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
647 if (r->driver_name) {
648 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->driver_name));
649 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->driver_name));
650 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->driver_name));
652 ndr->flags = _flags_save_string;
655 uint32_t _flags_save_string = ndr->flags;
656 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
657 if (r->architecture) {
658 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->architecture));
659 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->architecture));
660 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->architecture));
662 ndr->flags = _flags_save_string;
664 if (r->file_info) {
665 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->file_info));
666 #if 0
667 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->file_count));
668 #endif
669 for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
670 NDR_CHECK(ndr_push_spoolss_DriverFileInfo(ndr, NDR_SCALARS, &r->file_info[cntr_file_info_1]));
672 for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
673 NDR_CHECK(ndr_push_spoolss_DriverFileInfo(ndr, NDR_BUFFERS, &r->file_info[cntr_file_info_1]));
675 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->file_info));
678 uint32_t _flags_save_string = ndr->flags;
679 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
680 if (r->monitor_name) {
681 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->monitor_name));
682 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->monitor_name));
683 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->monitor_name));
685 ndr->flags = _flags_save_string;
688 uint32_t _flags_save_string = ndr->flags;
689 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
690 if (r->default_datatype) {
691 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->default_datatype));
692 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->default_datatype));
693 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->default_datatype));
695 ndr->flags = _flags_save_string;
698 uint32_t _flags_save_string_array = ndr->flags;
699 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
700 if (r->previous_names) {
701 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->previous_names));
702 NDR_CHECK(ndr_push_string_array(ndr, NDR_SCALARS, r->previous_names));
703 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->previous_names));
705 ndr->flags = _flags_save_string_array;
708 uint32_t _flags_save_string = ndr->flags;
709 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
710 if (r->manufacturer_name) {
711 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->manufacturer_name));
712 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->manufacturer_name));
713 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->manufacturer_name));
715 ndr->flags = _flags_save_string;
718 uint32_t _flags_save_string = ndr->flags;
719 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
720 if (r->manufacturer_url) {
721 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->manufacturer_url));
722 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->manufacturer_url));
723 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->manufacturer_url));
725 ndr->flags = _flags_save_string;
728 uint32_t _flags_save_string = ndr->flags;
729 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
730 if (r->hardware_id) {
731 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->hardware_id));
732 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->hardware_id));
733 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->hardware_id));
735 ndr->flags = _flags_save_string;
738 uint32_t _flags_save_string = ndr->flags;
739 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
740 if (r->provider) {
741 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->provider));
742 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->provider));
743 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->provider));
745 ndr->flags = _flags_save_string;
748 return NDR_ERR_SUCCESS;
751 _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverInfo101(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo101 *r)
753 uint32_t _ptr_driver_name;
754 TALLOC_CTX *_mem_save_driver_name_0;
755 uint32_t _ptr_architecture;
756 TALLOC_CTX *_mem_save_architecture_0;
757 uint32_t _ptr_file_info;
758 uint32_t cntr_file_info_1;
759 TALLOC_CTX *_mem_save_file_info_0;
760 TALLOC_CTX *_mem_save_file_info_1;
761 uint32_t _ptr_monitor_name;
762 TALLOC_CTX *_mem_save_monitor_name_0;
763 uint32_t _ptr_default_datatype;
764 TALLOC_CTX *_mem_save_default_datatype_0;
765 uint32_t _ptr_previous_names;
766 TALLOC_CTX *_mem_save_previous_names_0;
767 uint32_t _ptr_manufacturer_name;
768 TALLOC_CTX *_mem_save_manufacturer_name_0;
769 uint32_t _ptr_manufacturer_url;
770 TALLOC_CTX *_mem_save_manufacturer_url_0;
771 uint32_t _ptr_hardware_id;
772 TALLOC_CTX *_mem_save_hardware_id_0;
773 uint32_t _ptr_provider;
774 TALLOC_CTX *_mem_save_provider_0;
775 if (ndr_flags & NDR_SCALARS) {
776 NDR_CHECK(ndr_pull_align(ndr, 8));
777 NDR_CHECK(ndr_pull_spoolss_DriverOSVersion(ndr, NDR_SCALARS, &r->version));
779 uint32_t _flags_save_string = ndr->flags;
780 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
781 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_driver_name));
782 if (_ptr_driver_name) {
783 NDR_PULL_ALLOC(ndr, r->driver_name);
784 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->driver_name, _ptr_driver_name));
785 } else {
786 r->driver_name = NULL;
788 ndr->flags = _flags_save_string;
791 uint32_t _flags_save_string = ndr->flags;
792 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
793 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_architecture));
794 if (_ptr_architecture) {
795 NDR_PULL_ALLOC(ndr, r->architecture);
796 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->architecture, _ptr_architecture));
797 } else {
798 r->architecture = NULL;
800 ndr->flags = _flags_save_string;
802 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_file_info));
803 if (_ptr_file_info) {
804 NDR_PULL_ALLOC(ndr, r->file_info);
805 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->file_info, _ptr_file_info));
806 } else {
807 r->file_info = NULL;
809 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->file_count));
811 uint32_t _flags_save_string = ndr->flags;
812 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
813 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_monitor_name));
814 if (_ptr_monitor_name) {
815 NDR_PULL_ALLOC(ndr, r->monitor_name);
816 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->monitor_name, _ptr_monitor_name));
817 } else {
818 r->monitor_name = NULL;
820 ndr->flags = _flags_save_string;
823 uint32_t _flags_save_string = ndr->flags;
824 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
825 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_default_datatype));
826 if (_ptr_default_datatype) {
827 NDR_PULL_ALLOC(ndr, r->default_datatype);
828 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->default_datatype, _ptr_default_datatype));
829 } else {
830 r->default_datatype = NULL;
832 ndr->flags = _flags_save_string;
835 uint32_t _flags_save_string_array = ndr->flags;
836 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
837 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_previous_names));
838 if (_ptr_previous_names) {
839 NDR_PULL_ALLOC(ndr, r->previous_names);
840 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->previous_names, _ptr_previous_names));
841 } else {
842 r->previous_names = NULL;
844 ndr->flags = _flags_save_string_array;
846 NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->driver_date));
847 NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->driver_version));
849 uint32_t _flags_save_string = ndr->flags;
850 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
851 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_manufacturer_name));
852 if (_ptr_manufacturer_name) {
853 NDR_PULL_ALLOC(ndr, r->manufacturer_name);
854 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->manufacturer_name, _ptr_manufacturer_name));
855 } else {
856 r->manufacturer_name = NULL;
858 ndr->flags = _flags_save_string;
861 uint32_t _flags_save_string = ndr->flags;
862 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
863 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_manufacturer_url));
864 if (_ptr_manufacturer_url) {
865 NDR_PULL_ALLOC(ndr, r->manufacturer_url);
866 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->manufacturer_url, _ptr_manufacturer_url));
867 } else {
868 r->manufacturer_url = NULL;
870 ndr->flags = _flags_save_string;
873 uint32_t _flags_save_string = ndr->flags;
874 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
875 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_hardware_id));
876 if (_ptr_hardware_id) {
877 NDR_PULL_ALLOC(ndr, r->hardware_id);
878 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->hardware_id, _ptr_hardware_id));
879 } else {
880 r->hardware_id = NULL;
882 ndr->flags = _flags_save_string;
885 uint32_t _flags_save_string = ndr->flags;
886 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
887 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_provider));
888 if (_ptr_provider) {
889 NDR_PULL_ALLOC(ndr, r->provider);
890 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->provider, _ptr_provider));
891 } else {
892 r->provider = NULL;
894 ndr->flags = _flags_save_string;
897 if (ndr_flags & NDR_BUFFERS) {
899 uint32_t _flags_save_string = ndr->flags;
900 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
901 if (r->driver_name) {
902 uint32_t _relative_save_offset;
903 _relative_save_offset = ndr->offset;
904 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->driver_name));
905 _mem_save_driver_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
906 NDR_PULL_SET_MEM_CTX(ndr, r->driver_name, 0);
907 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->driver_name));
908 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_driver_name_0, 0);
909 ndr->offset = _relative_save_offset;
911 ndr->flags = _flags_save_string;
914 uint32_t _flags_save_string = ndr->flags;
915 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
916 if (r->architecture) {
917 uint32_t _relative_save_offset;
918 _relative_save_offset = ndr->offset;
919 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->architecture));
920 _mem_save_architecture_0 = NDR_PULL_GET_MEM_CTX(ndr);
921 NDR_PULL_SET_MEM_CTX(ndr, r->architecture, 0);
922 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->architecture));
923 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_architecture_0, 0);
924 ndr->offset = _relative_save_offset;
926 ndr->flags = _flags_save_string;
928 if (r->file_info) {
929 uint32_t _relative_save_offset;
930 _relative_save_offset = ndr->offset;
931 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->file_info));
932 _mem_save_file_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
933 NDR_PULL_SET_MEM_CTX(ndr, r->file_info, 0);
934 #if 0
935 NDR_CHECK(ndr_pull_array_size(ndr, &r->file_info));
936 #else
937 NDR_CHECK(ndr_token_store(ndr, &ndr->array_size_list, &r->file_info, r->file_count));
938 #endif
939 NDR_PULL_ALLOC_N(ndr, r->file_info, ndr_get_array_size(ndr, &r->file_info));
940 _mem_save_file_info_1 = NDR_PULL_GET_MEM_CTX(ndr);
941 NDR_PULL_SET_MEM_CTX(ndr, r->file_info, 0);
942 for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
943 NDR_CHECK(ndr_pull_spoolss_DriverFileInfo(ndr, NDR_SCALARS, &r->file_info[cntr_file_info_1]));
945 for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
946 NDR_CHECK(ndr_pull_spoolss_DriverFileInfo(ndr, NDR_BUFFERS, &r->file_info[cntr_file_info_1]));
948 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_file_info_1, 0);
949 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_file_info_0, 0);
950 ndr->offset = _relative_save_offset;
953 uint32_t _flags_save_string = ndr->flags;
954 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
955 if (r->monitor_name) {
956 uint32_t _relative_save_offset;
957 _relative_save_offset = ndr->offset;
958 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->monitor_name));
959 _mem_save_monitor_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
960 NDR_PULL_SET_MEM_CTX(ndr, r->monitor_name, 0);
961 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->monitor_name));
962 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_monitor_name_0, 0);
963 ndr->offset = _relative_save_offset;
965 ndr->flags = _flags_save_string;
968 uint32_t _flags_save_string = ndr->flags;
969 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
970 if (r->default_datatype) {
971 uint32_t _relative_save_offset;
972 _relative_save_offset = ndr->offset;
973 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->default_datatype));
974 _mem_save_default_datatype_0 = NDR_PULL_GET_MEM_CTX(ndr);
975 NDR_PULL_SET_MEM_CTX(ndr, r->default_datatype, 0);
976 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->default_datatype));
977 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_default_datatype_0, 0);
978 ndr->offset = _relative_save_offset;
980 ndr->flags = _flags_save_string;
983 uint32_t _flags_save_string_array = ndr->flags;
984 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
985 if (r->previous_names) {
986 uint32_t _relative_save_offset;
987 _relative_save_offset = ndr->offset;
988 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->previous_names));
989 _mem_save_previous_names_0 = NDR_PULL_GET_MEM_CTX(ndr);
990 NDR_PULL_SET_MEM_CTX(ndr, r->previous_names, 0);
991 NDR_CHECK(ndr_pull_string_array(ndr, NDR_SCALARS, &r->previous_names));
992 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_previous_names_0, 0);
993 ndr->offset = _relative_save_offset;
995 ndr->flags = _flags_save_string_array;
998 uint32_t _flags_save_string = ndr->flags;
999 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1000 if (r->manufacturer_name) {
1001 uint32_t _relative_save_offset;
1002 _relative_save_offset = ndr->offset;
1003 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->manufacturer_name));
1004 _mem_save_manufacturer_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
1005 NDR_PULL_SET_MEM_CTX(ndr, r->manufacturer_name, 0);
1006 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->manufacturer_name));
1007 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_manufacturer_name_0, 0);
1008 ndr->offset = _relative_save_offset;
1010 ndr->flags = _flags_save_string;
1013 uint32_t _flags_save_string = ndr->flags;
1014 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1015 if (r->manufacturer_url) {
1016 uint32_t _relative_save_offset;
1017 _relative_save_offset = ndr->offset;
1018 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->manufacturer_url));
1019 _mem_save_manufacturer_url_0 = NDR_PULL_GET_MEM_CTX(ndr);
1020 NDR_PULL_SET_MEM_CTX(ndr, r->manufacturer_url, 0);
1021 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->manufacturer_url));
1022 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_manufacturer_url_0, 0);
1023 ndr->offset = _relative_save_offset;
1025 ndr->flags = _flags_save_string;
1028 uint32_t _flags_save_string = ndr->flags;
1029 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1030 if (r->hardware_id) {
1031 uint32_t _relative_save_offset;
1032 _relative_save_offset = ndr->offset;
1033 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->hardware_id));
1034 _mem_save_hardware_id_0 = NDR_PULL_GET_MEM_CTX(ndr);
1035 NDR_PULL_SET_MEM_CTX(ndr, r->hardware_id, 0);
1036 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->hardware_id));
1037 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_hardware_id_0, 0);
1038 ndr->offset = _relative_save_offset;
1040 ndr->flags = _flags_save_string;
1043 uint32_t _flags_save_string = ndr->flags;
1044 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1045 if (r->provider) {
1046 uint32_t _relative_save_offset;
1047 _relative_save_offset = ndr->offset;
1048 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->provider));
1049 _mem_save_provider_0 = NDR_PULL_GET_MEM_CTX(ndr);
1050 NDR_PULL_SET_MEM_CTX(ndr, r->provider, 0);
1051 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->provider));
1052 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_provider_0, 0);
1053 ndr->offset = _relative_save_offset;
1055 ndr->flags = _flags_save_string;
1057 if (r->file_info) {
1058 NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->file_info, r->file_count));
1061 return NDR_ERR_SUCCESS;
1064 void ndr_print_spoolss_Field(struct ndr_print *ndr, const char *name, const union spoolss_Field *r)
1066 int level;
1067 level = ndr_print_get_switch_value(ndr, r);
1068 ndr_print_union(ndr, name, level, "spoolss_Field");
1069 switch (level) {
1070 case PRINTER_NOTIFY_TYPE:
1071 ndr_print_spoolss_PrintNotifyField(ndr, "field", r->field);
1072 break;
1074 case JOB_NOTIFY_TYPE:
1075 ndr_print_spoolss_JobNotifyField(ndr, "field", r->field);
1076 break;
1078 default:
1079 ndr_print_uint16(ndr, "field", r->field);
1080 break;
1085 _PUBLIC_ size_t ndr_size_spoolss_PrinterData(const union spoolss_PrinterData *r, uint32_t level, struct smb_iconv_convenience *ic, int flags)
1087 if (!r) {
1088 return 0;
1090 return ndr_size_union(r, flags, level, (ndr_push_flags_fn_t)ndr_push_spoolss_PrinterData, ic);
1093 void ndr_print_spoolss_security_descriptor(struct ndr_print *ndr, const char *name, const struct security_descriptor *r)
1095 ndr_print_security_descriptor(ndr, name, r);
1098 enum ndr_err_code ndr_pull_spoolss_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r)
1100 uint32_t _flags_save_STRUCT = ndr->flags;
1101 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NO_RELATIVE_REVERSE);
1102 NDR_CHECK(ndr_pull_security_descriptor(ndr, ndr_flags, r));
1103 ndr->flags = _flags_save_STRUCT;
1104 return NDR_ERR_SUCCESS;
1107 enum ndr_err_code ndr_push_spoolss_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r)
1110 uint32_t _flags_save_STRUCT = ndr->flags;
1111 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN|LIBNDR_FLAG_NO_RELATIVE_REVERSE);
1112 if (ndr_flags & NDR_SCALARS) {
1113 NDR_CHECK(ndr_push_align(ndr, 5));
1114 NDR_CHECK(ndr_push_security_descriptor_revision(ndr, NDR_SCALARS, r->revision));
1115 NDR_CHECK(ndr_push_security_descriptor_type(ndr, NDR_SCALARS, r->type));
1116 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->owner_sid));
1117 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->group_sid));
1118 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->sacl));
1119 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->dacl));
1120 NDR_CHECK(ndr_push_trailer_align(ndr, 5));
1122 if (ndr_flags & NDR_BUFFERS) {
1123 if (r->sacl) {
1124 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->sacl));
1125 NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->sacl));
1126 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->sacl));
1128 if (r->dacl) {
1129 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->dacl));
1130 NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->dacl));
1131 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->dacl));
1133 if (r->owner_sid) {
1134 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->owner_sid));
1135 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->owner_sid));
1136 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->owner_sid));
1138 if (r->group_sid) {
1139 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->group_sid));
1140 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->group_sid));
1141 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->group_sid));
1144 ndr->flags = _flags_save_STRUCT;
1146 return NDR_ERR_SUCCESS;
1149 _PUBLIC_ enum ndr_err_code ndr_push_spoolss_PrinterInfo2(struct ndr_push *ndr, int ndr_flags, const struct spoolss_PrinterInfo2 *r)
1151 if (ndr_flags & NDR_SCALARS) {
1152 NDR_CHECK(ndr_push_align(ndr, 5));
1154 uint32_t _flags_save_string = ndr->flags;
1155 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1156 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->servername));
1157 ndr->flags = _flags_save_string;
1160 uint32_t _flags_save_string = ndr->flags;
1161 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1162 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->printername));
1163 ndr->flags = _flags_save_string;
1166 uint32_t _flags_save_string = ndr->flags;
1167 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1168 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->sharename));
1169 ndr->flags = _flags_save_string;
1172 uint32_t _flags_save_string = ndr->flags;
1173 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1174 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->portname));
1175 ndr->flags = _flags_save_string;
1178 uint32_t _flags_save_string = ndr->flags;
1179 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1180 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->drivername));
1181 ndr->flags = _flags_save_string;
1184 uint32_t _flags_save_string = ndr->flags;
1185 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1186 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->comment));
1187 ndr->flags = _flags_save_string;
1190 uint32_t _flags_save_string = ndr->flags;
1191 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1192 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->location));
1193 ndr->flags = _flags_save_string;
1196 uint32_t _flags_save_spoolss_DeviceMode = ndr->flags;
1197 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
1198 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->devmode));
1199 ndr->flags = _flags_save_spoolss_DeviceMode;
1202 uint32_t _flags_save_string = ndr->flags;
1203 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1204 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->sepfile));
1205 ndr->flags = _flags_save_string;
1208 uint32_t _flags_save_string = ndr->flags;
1209 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1210 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->printprocessor));
1211 ndr->flags = _flags_save_string;
1214 uint32_t _flags_save_string = ndr->flags;
1215 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1216 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->datatype));
1217 ndr->flags = _flags_save_string;
1220 uint32_t _flags_save_string = ndr->flags;
1221 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1222 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->parameters));
1223 ndr->flags = _flags_save_string;
1226 uint32_t _flags_save_spoolss_security_descriptor = ndr->flags;
1227 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
1228 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->secdesc));
1229 ndr->flags = _flags_save_spoolss_security_descriptor;
1231 NDR_CHECK(ndr_push_spoolss_PrinterAttributes(ndr, NDR_SCALARS, r->attributes));
1232 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->priority));
1233 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->defaultpriority));
1234 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->starttime));
1235 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->untiltime));
1236 NDR_CHECK(ndr_push_spoolss_PrinterStatus(ndr, NDR_SCALARS, r->status));
1237 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->cjobs));
1238 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->averageppm));
1239 NDR_CHECK(ndr_push_trailer_align(ndr, 5));
1241 if (ndr_flags & NDR_BUFFERS) {
1243 uint32_t _flags_save_string = ndr->flags;
1244 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1245 if (r->servername) {
1246 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->servername));
1247 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->servername));
1248 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->servername));
1250 ndr->flags = _flags_save_string;
1253 uint32_t _flags_save_string = ndr->flags;
1254 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1255 if (r->printername) {
1256 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->printername));
1257 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->printername));
1258 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->printername));
1260 ndr->flags = _flags_save_string;
1263 uint32_t _flags_save_string = ndr->flags;
1264 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1265 if (r->sharename) {
1266 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->sharename));
1267 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->sharename));
1268 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->sharename));
1270 ndr->flags = _flags_save_string;
1273 uint32_t _flags_save_string = ndr->flags;
1274 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1275 if (r->portname) {
1276 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->portname));
1277 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->portname));
1278 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->portname));
1280 ndr->flags = _flags_save_string;
1283 uint32_t _flags_save_string = ndr->flags;
1284 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1285 if (r->drivername) {
1286 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->drivername));
1287 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->drivername));
1288 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->drivername));
1290 ndr->flags = _flags_save_string;
1293 uint32_t _flags_save_string = ndr->flags;
1294 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1295 if (r->comment) {
1296 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->comment));
1297 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->comment));
1298 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->comment));
1300 ndr->flags = _flags_save_string;
1303 uint32_t _flags_save_string = ndr->flags;
1304 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1305 if (r->location) {
1306 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->location));
1307 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->location));
1308 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->location));
1310 ndr->flags = _flags_save_string;
1313 uint32_t _flags_save_string = ndr->flags;
1314 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1315 if (r->sepfile) {
1316 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->sepfile));
1317 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->sepfile));
1318 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->sepfile));
1320 ndr->flags = _flags_save_string;
1323 uint32_t _flags_save_string = ndr->flags;
1324 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1325 if (r->printprocessor) {
1326 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->printprocessor));
1327 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->printprocessor));
1328 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->printprocessor));
1330 ndr->flags = _flags_save_string;
1333 uint32_t _flags_save_string = ndr->flags;
1334 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1335 if (r->datatype) {
1336 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->datatype));
1337 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->datatype));
1338 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->datatype));
1340 ndr->flags = _flags_save_string;
1343 uint32_t _flags_save_string = ndr->flags;
1344 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1345 if (r->parameters) {
1346 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->parameters));
1347 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->parameters));
1348 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->parameters));
1350 ndr->flags = _flags_save_string;
1353 uint32_t _flags_save_spoolss_DeviceMode = ndr->flags;
1354 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
1355 if (r->devmode) {
1356 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->devmode));
1358 struct ndr_push *_ndr_devmode;
1359 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_devmode, 0, -1));
1360 NDR_CHECK(ndr_push_spoolss_DeviceMode(_ndr_devmode, NDR_SCALARS, r->devmode));
1361 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_devmode, 0, -1));
1363 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->devmode));
1365 ndr->flags = _flags_save_spoolss_DeviceMode;
1368 uint32_t _flags_save_spoolss_security_descriptor = ndr->flags;
1369 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
1370 if (r->secdesc) {
1371 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->secdesc));
1373 struct ndr_push *_ndr_secdesc;
1374 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_secdesc, 0, -1));
1375 NDR_CHECK(ndr_push_spoolss_security_descriptor(_ndr_secdesc, NDR_SCALARS|NDR_BUFFERS, r->secdesc));
1376 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_secdesc, 0, -1));
1378 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->secdesc));
1380 ndr->flags = _flags_save_spoolss_security_descriptor;
1383 return NDR_ERR_SUCCESS;