e15591633dcb4b5b845bcb1f0dc0183d8e81b017
[bbaumbach/samba-autobuild/.git] / librpc / ndr / ndr_spoolss_buf.c
1 /*
2    Unix SMB/CIFS implementation.
3
4    routines for marshalling/unmarshalling spoolss subcontext buffer structures
5
6    Copyright (C) Andrew Tridgell 2003
7    Copyright (C) Tim Potter 2003
8    Copyright (C) Guenther Deschner 2009
9
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.
14
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.
19
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/>.
22 */
23
24
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
31
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);\
41         }\
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)
47
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");\
60         }\
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));\
75                 }\
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);\
83                 }\
84                 _data_blob_info = ndr_push_blob(_ndr_info);\
85                 _r.out.info     = &_data_blob_info;\
86         }\
87         NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\
88 } while(0)
89
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);\
95         }\
96         if (flags & NDR_OUT) {\
97                 out;\
98                 NDR_SPOOLSS_PUSH_ENUM_OUT(fn);\
99         }\
100 } while(0)
101
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);\
118         }\
119         NDR_PULL_ALLOC(ndr, r->out.info);\
120         ZERO_STRUCTP(r->out.info);\
121 } while(0)
122
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);\
132         }\
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);\
147                 }\
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;\
155                 }\
156         }\
157 } while(0)
158
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;\
165         }\
166         if (flags & NDR_OUT) {\
167                 out;\
168                 NDR_SPOOLSS_PULL_ENUM_OUT(fn);\
169         }\
170 } while(0)
171
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; \
177         }\
178 } while (0)
179
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)
194
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)
208
209
210 /*
211   spoolss_EnumPrinters
212 */
213 enum ndr_err_code ndr_push_spoolss_EnumPrinters(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinters *r)
214 {
215         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinters,{
216                 _r.in.flags     = r->in.flags;
217                 _r.in.server    = r->in.server;
218         },{
219                 _r.in.flags     = r->in.flags;
220                 _r.in.server    = r->in.server;
221         });
222         return NDR_ERR_SUCCESS;
223 }
224
225 enum ndr_err_code ndr_pull_spoolss_EnumPrinters(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinters *r)
226 {
227         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrinters,{
228                 r->in.flags     = _r.in.flags;
229                 r->in.server    = _r.in.server;
230         },{
231                 _r.in.flags     = r->in.flags;
232                 _r.in.server    = r->in.server;
233         });
234         return NDR_ERR_SUCCESS;
235 }
236
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)
238 {
239         NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrinters);
240 }
241
242 /*
243   spoolss_EnumJobs
244 */
245 enum ndr_err_code ndr_push_spoolss_EnumJobs(struct ndr_push *ndr, int flags, const struct spoolss_EnumJobs *r)
246 {
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;
251         },{
252                 _r.in.handle    = r->in.handle;
253                 _r.in.firstjob  = r->in.firstjob;
254                 _r.in.numjobs   = r->in.numjobs;
255         });
256         return NDR_ERR_SUCCESS;
257 }
258
259 enum ndr_err_code ndr_pull_spoolss_EnumJobs(struct ndr_pull *ndr, int flags, struct spoolss_EnumJobs *r)
260 {
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;
265         },{
266                 _r.in.handle    = r->in.handle;
267                 _r.in.firstjob  = r->in.firstjob;
268                 _r.in.numjobs   = r->in.numjobs;
269         });
270         return NDR_ERR_SUCCESS;
271 }
272
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)
274 {
275         NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumJobs);
276 }
277
278 /*
279   spoolss_EnumPrinterDrivers
280 */
281 enum ndr_err_code ndr_push_spoolss_EnumPrinterDrivers(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDrivers *r)
282 {
283         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinterDrivers,{
284                 _r.in.server            = r->in.server;
285                 _r.in.environment       = r->in.environment;
286         },{
287                 _r.in.server            = r->in.server;
288                 _r.in.environment       = r->in.environment;
289         });
290         return NDR_ERR_SUCCESS;
291 }
292
293 enum ndr_err_code ndr_pull_spoolss_EnumPrinterDrivers(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDrivers *r)
294 {
295         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrinterDrivers,{
296                 r->in.server            = _r.in.server;
297                 r->in.environment       = _r.in.environment;
298         },{
299                 _r.in.server            = r->in.server;
300                 _r.in.environment       = r->in.environment;
301         });
302         return NDR_ERR_SUCCESS;
303 }
304
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)
306 {
307         NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrinterDrivers);
308 }
309
310 /*
311   spoolss_EnumForms
312 */
313 enum ndr_err_code ndr_push_spoolss_EnumForms(struct ndr_push *ndr, int flags, const struct spoolss_EnumForms *r)
314 {
315         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumForms,{
316                 _r.in.handle    = r->in.handle;
317         },{
318                 _r.in.handle    = r->in.handle;
319         });
320         return NDR_ERR_SUCCESS;
321 }
322
323 enum ndr_err_code ndr_pull_spoolss_EnumForms(struct ndr_pull *ndr, int flags, struct spoolss_EnumForms *r)
324 {
325         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumForms,{
326                 r->in.handle    = _r.in.handle;
327         },{
328                 _r.in.handle    = r->in.handle;
329         });
330         return NDR_ERR_SUCCESS;
331 }
332
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)
334 {
335         NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumForms);
336 }
337
338 /*
339   spoolss_EnumPorts
340 */
341 enum ndr_err_code ndr_push_spoolss_EnumPorts(struct ndr_push *ndr, int flags, const struct spoolss_EnumPorts *r)
342 {
343         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPorts,{
344                 _r.in.servername= r->in.servername;
345         },{
346                 _r.in.servername= r->in.servername;
347         });
348         return NDR_ERR_SUCCESS;
349 }
350
351 enum ndr_err_code ndr_pull_spoolss_EnumPorts(struct ndr_pull *ndr, int flags, struct spoolss_EnumPorts *r)
352 {
353         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPorts,{
354                 r->in.servername= _r.in.servername;
355         },{
356                 _r.in.servername= r->in.servername;
357         });
358         return NDR_ERR_SUCCESS;
359 }
360
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)
362 {
363         NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPorts);
364 }
365
366 /*
367   spoolss_EnumMonitors
368 */
369 enum ndr_err_code ndr_push_spoolss_EnumMonitors(struct ndr_push *ndr, int flags, const struct spoolss_EnumMonitors *r)
370 {
371         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumMonitors,{
372                 _r.in.servername= r->in.servername;
373         },{
374                 _r.in.servername= r->in.servername;
375         });
376         return NDR_ERR_SUCCESS;
377 }
378
379 enum ndr_err_code ndr_pull_spoolss_EnumMonitors(struct ndr_pull *ndr, int flags, struct spoolss_EnumMonitors *r)
380 {
381         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumMonitors,{
382                 r->in.servername= _r.in.servername;
383         },{
384                 _r.in.servername= r->in.servername;
385         });
386         return NDR_ERR_SUCCESS;
387 }
388
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)
390 {
391         NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumMonitors);
392 }
393
394 /*
395   spoolss_EnumPrintProcessors
396 */
397 enum ndr_err_code ndr_push_spoolss_EnumPrintProcessors(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrintProcessors *r)
398 {
399         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrintProcessors,{
400                 _r.in.servername        = r->in.servername;
401                 _r.in.environment       = r->in.environment;
402         },{
403                 _r.in.servername        = r->in.servername;
404                 _r.in.environment       = r->in.environment;
405         });
406         return NDR_ERR_SUCCESS;
407 }
408
409 enum ndr_err_code ndr_pull_spoolss_EnumPrintProcessors(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcessors *r)
410 {
411         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrintProcessors,{
412                 r->in.servername        = _r.in.servername;
413                 r->in.environment       = _r.in.environment;
414         },{
415                 _r.in.servername        = r->in.servername;
416                 _r.in.environment       = r->in.environment;
417         });
418         return NDR_ERR_SUCCESS;
419 }
420
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)
423 {
424         NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcessors);
425 }
426
427 /*
428   spoolss_EnumPrintProcessors
429 */
430 enum ndr_err_code ndr_push_spoolss_EnumPrintProcDataTypes(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrintProcDataTypes *r)
431 {
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;
435         },{
436                 _r.in.servername                = r->in.servername;
437                 _r.in.print_processor_name      = r->in.print_processor_name;
438         });
439         return NDR_ERR_SUCCESS;
440 }
441
442 enum ndr_err_code ndr_pull_spoolss_EnumPrintProcDataTypes(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcDataTypes *r)
443 {
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;
447         },{
448                 _r.in.servername                = r->in.servername;
449                 _r.in.print_processor_name      = r->in.print_processor_name;
450         });
451         return NDR_ERR_SUCCESS;
452 }
453
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)
456 {
457         NDR_SPOOLSS_SIZE_ENUM_LEVEL(spoolss_EnumPrintProcDataTypes);
458 }
459
460 /*
461   spoolss_EnumPrinterDataEx
462 */
463
464 enum ndr_err_code ndr_push_spoolss_EnumPrinterDataEx(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDataEx *r)
465 {
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));
472         }
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));
493                         }
494                         _r.out.info = ndr_push_blob(_ndr_info);
495                 }
496                 NDR_CHECK(ndr_push__spoolss_EnumPrinterDataEx(ndr, flags, &_r));
497         }
498         return NDR_ERR_SUCCESS;
499 }
500
501 enum ndr_err_code ndr_pull_spoolss_EnumPrinterDataEx(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDataEx *r)
502 {
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);
516         }
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);
526                 }
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);
541                         }
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;
548                         }
549                 }
550         }
551         return NDR_ERR_SUCCESS;
552 }
553
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)
556 {
557         NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrinterDataEx);
558 }
559
560 uint32_t _ndr_size_spoolss_DeviceMode(struct spoolss_DeviceMode *devmode, struct smb_iconv_convenience *ic, uint32_t flags)
561 {
562         if (!devmode) return 0;
563         return ndr_size_spoolss_DeviceMode(devmode,ic,flags);
564 }
565
566 _PUBLIC_ size_t ndr_size_spoolss_StringArray(const struct spoolss_StringArray *r, struct smb_iconv_convenience *ic, int flags)
567 {
568         if (!r) {
569                 return 4;
570         }
571
572         return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_spoolss_StringArray, ic);
573 }
574
575 /* hand marshall as pidl cannot (yet) generate a relative pointer to a fixed array of
576  * structs */
577
578 _PUBLIC_ enum ndr_err_code ndr_push_spoolss_DriverInfo101(struct ndr_push *ndr, int ndr_flags, const struct spoolss_DriverInfo101 *r)
579 {
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));
584                 {
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;
589                 }
590                 {
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;
595                 }
596                 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->file_info));
597                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->file_count));
598                 {
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;
603                 }
604                 {
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;
609                 }
610                 {
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;
615                 }
616                 NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->driver_date));
617                 NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->driver_version));
618                 {
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;
623                 }
624                 {
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;
629                 }
630                 {
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;
635                 }
636                 {
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;
641                 }
642                 NDR_CHECK(ndr_push_trailer_align(ndr, 8));
643         }
644         if (ndr_flags & NDR_BUFFERS) {
645                 {
646                         uint32_t _flags_save_string = ndr->flags;
647                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
648                         if (r->driver_name) {
649                                 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->driver_name));
650                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->driver_name));
651                                 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->driver_name));
652                         }
653                         ndr->flags = _flags_save_string;
654                 }
655                 {
656                         uint32_t _flags_save_string = ndr->flags;
657                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
658                         if (r->architecture) {
659                                 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->architecture));
660                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->architecture));
661                                 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->architecture));
662                         }
663                         ndr->flags = _flags_save_string;
664                 }
665                 if (r->file_info) {
666                         NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->file_info));
667 #if 0
668                         NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, r->file_count));
669 #endif
670                         for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
671                                 NDR_CHECK(ndr_push_spoolss_DriverFileInfo(ndr, NDR_SCALARS, &r->file_info[cntr_file_info_1]));
672                         }
673                         for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
674                                 NDR_CHECK(ndr_push_spoolss_DriverFileInfo(ndr, NDR_BUFFERS, &r->file_info[cntr_file_info_1]));
675                         }
676                         NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->file_info));
677                 }
678                 {
679                         uint32_t _flags_save_string = ndr->flags;
680                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
681                         if (r->monitor_name) {
682                                 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->monitor_name));
683                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->monitor_name));
684                                 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->monitor_name));
685                         }
686                         ndr->flags = _flags_save_string;
687                 }
688                 {
689                         uint32_t _flags_save_string = ndr->flags;
690                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
691                         if (r->default_datatype) {
692                                 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->default_datatype));
693                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->default_datatype));
694                                 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->default_datatype));
695                         }
696                         ndr->flags = _flags_save_string;
697                 }
698                 {
699                         uint32_t _flags_save_string_array = ndr->flags;
700                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
701                         if (r->previous_names) {
702                                 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->previous_names));
703                                 NDR_CHECK(ndr_push_string_array(ndr, NDR_SCALARS, r->previous_names));
704                                 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->previous_names));
705                         }
706                         ndr->flags = _flags_save_string_array;
707                 }
708                 {
709                         uint32_t _flags_save_string = ndr->flags;
710                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
711                         if (r->manufacturer_name) {
712                                 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->manufacturer_name));
713                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->manufacturer_name));
714                                 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->manufacturer_name));
715                         }
716                         ndr->flags = _flags_save_string;
717                 }
718                 {
719                         uint32_t _flags_save_string = ndr->flags;
720                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
721                         if (r->manufacturer_url) {
722                                 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->manufacturer_url));
723                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->manufacturer_url));
724                                 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->manufacturer_url));
725                         }
726                         ndr->flags = _flags_save_string;
727                 }
728                 {
729                         uint32_t _flags_save_string = ndr->flags;
730                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
731                         if (r->hardware_id) {
732                                 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->hardware_id));
733                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->hardware_id));
734                                 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->hardware_id));
735                         }
736                         ndr->flags = _flags_save_string;
737                 }
738                 {
739                         uint32_t _flags_save_string = ndr->flags;
740                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
741                         if (r->provider) {
742                                 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->provider));
743                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->provider));
744                                 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->provider));
745                         }
746                         ndr->flags = _flags_save_string;
747                 }
748         }
749         return NDR_ERR_SUCCESS;
750 }
751
752 _PUBLIC_ enum ndr_err_code ndr_pull_spoolss_DriverInfo101(struct ndr_pull *ndr, int ndr_flags, struct spoolss_DriverInfo101 *r)
753 {
754         uint32_t _ptr_driver_name;
755         TALLOC_CTX *_mem_save_driver_name_0;
756         uint32_t _ptr_architecture;
757         TALLOC_CTX *_mem_save_architecture_0;
758         uint32_t _ptr_file_info;
759         uint32_t cntr_file_info_1;
760         TALLOC_CTX *_mem_save_file_info_0;
761         TALLOC_CTX *_mem_save_file_info_1;
762         uint32_t _ptr_monitor_name;
763         TALLOC_CTX *_mem_save_monitor_name_0;
764         uint32_t _ptr_default_datatype;
765         TALLOC_CTX *_mem_save_default_datatype_0;
766         uint32_t _ptr_previous_names;
767         TALLOC_CTX *_mem_save_previous_names_0;
768         uint32_t _ptr_manufacturer_name;
769         TALLOC_CTX *_mem_save_manufacturer_name_0;
770         uint32_t _ptr_manufacturer_url;
771         TALLOC_CTX *_mem_save_manufacturer_url_0;
772         uint32_t _ptr_hardware_id;
773         TALLOC_CTX *_mem_save_hardware_id_0;
774         uint32_t _ptr_provider;
775         TALLOC_CTX *_mem_save_provider_0;
776         if (ndr_flags & NDR_SCALARS) {
777                 NDR_CHECK(ndr_pull_align(ndr, 8));
778                 NDR_CHECK(ndr_pull_spoolss_DriverOSVersion(ndr, NDR_SCALARS, &r->version));
779                 {
780                         uint32_t _flags_save_string = ndr->flags;
781                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
782                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_driver_name));
783                         if (_ptr_driver_name) {
784                                 NDR_PULL_ALLOC(ndr, r->driver_name);
785                                 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->driver_name, _ptr_driver_name));
786                         } else {
787                                 r->driver_name = NULL;
788                         }
789                         ndr->flags = _flags_save_string;
790                 }
791                 {
792                         uint32_t _flags_save_string = ndr->flags;
793                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
794                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_architecture));
795                         if (_ptr_architecture) {
796                                 NDR_PULL_ALLOC(ndr, r->architecture);
797                                 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->architecture, _ptr_architecture));
798                         } else {
799                                 r->architecture = NULL;
800                         }
801                         ndr->flags = _flags_save_string;
802                 }
803                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_file_info));
804                 if (_ptr_file_info) {
805                         NDR_PULL_ALLOC(ndr, r->file_info);
806                         NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->file_info, _ptr_file_info));
807                 } else {
808                         r->file_info = NULL;
809                 }
810                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->file_count));
811                 {
812                         uint32_t _flags_save_string = ndr->flags;
813                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
814                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_monitor_name));
815                         if (_ptr_monitor_name) {
816                                 NDR_PULL_ALLOC(ndr, r->monitor_name);
817                                 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->monitor_name, _ptr_monitor_name));
818                         } else {
819                                 r->monitor_name = NULL;
820                         }
821                         ndr->flags = _flags_save_string;
822                 }
823                 {
824                         uint32_t _flags_save_string = ndr->flags;
825                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
826                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_default_datatype));
827                         if (_ptr_default_datatype) {
828                                 NDR_PULL_ALLOC(ndr, r->default_datatype);
829                                 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->default_datatype, _ptr_default_datatype));
830                         } else {
831                                 r->default_datatype = NULL;
832                         }
833                         ndr->flags = _flags_save_string;
834                 }
835                 {
836                         uint32_t _flags_save_string_array = ndr->flags;
837                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
838                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_previous_names));
839                         if (_ptr_previous_names) {
840                                 NDR_PULL_ALLOC(ndr, r->previous_names);
841                                 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->previous_names, _ptr_previous_names));
842                         } else {
843                                 r->previous_names = NULL;
844                         }
845                         ndr->flags = _flags_save_string_array;
846                 }
847                 NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->driver_date));
848                 NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->driver_version));
849                 {
850                         uint32_t _flags_save_string = ndr->flags;
851                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
852                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_manufacturer_name));
853                         if (_ptr_manufacturer_name) {
854                                 NDR_PULL_ALLOC(ndr, r->manufacturer_name);
855                                 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->manufacturer_name, _ptr_manufacturer_name));
856                         } else {
857                                 r->manufacturer_name = NULL;
858                         }
859                         ndr->flags = _flags_save_string;
860                 }
861                 {
862                         uint32_t _flags_save_string = ndr->flags;
863                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
864                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_manufacturer_url));
865                         if (_ptr_manufacturer_url) {
866                                 NDR_PULL_ALLOC(ndr, r->manufacturer_url);
867                                 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->manufacturer_url, _ptr_manufacturer_url));
868                         } else {
869                                 r->manufacturer_url = NULL;
870                         }
871                         ndr->flags = _flags_save_string;
872                 }
873                 {
874                         uint32_t _flags_save_string = ndr->flags;
875                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
876                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_hardware_id));
877                         if (_ptr_hardware_id) {
878                                 NDR_PULL_ALLOC(ndr, r->hardware_id);
879                                 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->hardware_id, _ptr_hardware_id));
880                         } else {
881                                 r->hardware_id = NULL;
882                         }
883                         ndr->flags = _flags_save_string;
884                 }
885                 {
886                         uint32_t _flags_save_string = ndr->flags;
887                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
888                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_provider));
889                         if (_ptr_provider) {
890                                 NDR_PULL_ALLOC(ndr, r->provider);
891                                 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->provider, _ptr_provider));
892                         } else {
893                                 r->provider = NULL;
894                         }
895                         ndr->flags = _flags_save_string;
896                 }
897                 NDR_CHECK(ndr_pull_trailer_align(ndr, 8));
898         }
899         if (ndr_flags & NDR_BUFFERS) {
900                 {
901                         uint32_t _flags_save_string = ndr->flags;
902                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
903                         if (r->driver_name) {
904                                 uint32_t _relative_save_offset;
905                                 _relative_save_offset = ndr->offset;
906                                 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->driver_name));
907                                 _mem_save_driver_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
908                                 NDR_PULL_SET_MEM_CTX(ndr, r->driver_name, 0);
909                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->driver_name));
910                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_driver_name_0, 0);
911                                 if (ndr->offset > ndr->relative_highest_offset) {
912                                         ndr->relative_highest_offset = ndr->offset;
913                                 }
914                                 ndr->offset = _relative_save_offset;
915                         }
916                         ndr->flags = _flags_save_string;
917                 }
918                 {
919                         uint32_t _flags_save_string = ndr->flags;
920                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
921                         if (r->architecture) {
922                                 uint32_t _relative_save_offset;
923                                 _relative_save_offset = ndr->offset;
924                                 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->architecture));
925                                 _mem_save_architecture_0 = NDR_PULL_GET_MEM_CTX(ndr);
926                                 NDR_PULL_SET_MEM_CTX(ndr, r->architecture, 0);
927                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->architecture));
928                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_architecture_0, 0);
929                                 if (ndr->offset > ndr->relative_highest_offset) {
930                                         ndr->relative_highest_offset = ndr->offset;
931                                 }
932                                 ndr->offset = _relative_save_offset;
933                         }
934                         ndr->flags = _flags_save_string;
935                 }
936                 if (r->file_info) {
937                         uint32_t _relative_save_offset;
938                         _relative_save_offset = ndr->offset;
939                         NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->file_info));
940                         _mem_save_file_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
941                         NDR_PULL_SET_MEM_CTX(ndr, r->file_info, 0);
942 #if 0
943                         NDR_CHECK(ndr_pull_array_size(ndr, &r->file_info));
944 #else
945                         NDR_CHECK(ndr_token_store(ndr, &ndr->array_size_list, &r->file_info, r->file_count));
946 #endif
947                         NDR_PULL_ALLOC_N(ndr, r->file_info, ndr_get_array_size(ndr, &r->file_info));
948                         _mem_save_file_info_1 = NDR_PULL_GET_MEM_CTX(ndr);
949                         NDR_PULL_SET_MEM_CTX(ndr, r->file_info, 0);
950                         for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
951                                 NDR_CHECK(ndr_pull_spoolss_DriverFileInfo(ndr, NDR_SCALARS, &r->file_info[cntr_file_info_1]));
952                         }
953                         for (cntr_file_info_1 = 0; cntr_file_info_1 < r->file_count; cntr_file_info_1++) {
954                                 NDR_CHECK(ndr_pull_spoolss_DriverFileInfo(ndr, NDR_BUFFERS, &r->file_info[cntr_file_info_1]));
955                         }
956                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_file_info_1, 0);
957                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_file_info_0, 0);
958                         if (ndr->offset > ndr->relative_highest_offset) {
959                                 ndr->relative_highest_offset = ndr->offset;
960                         }
961                         ndr->offset = _relative_save_offset;
962                 }
963                 {
964                         uint32_t _flags_save_string = ndr->flags;
965                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
966                         if (r->monitor_name) {
967                                 uint32_t _relative_save_offset;
968                                 _relative_save_offset = ndr->offset;
969                                 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->monitor_name));
970                                 _mem_save_monitor_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
971                                 NDR_PULL_SET_MEM_CTX(ndr, r->monitor_name, 0);
972                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->monitor_name));
973                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_monitor_name_0, 0);
974                                 if (ndr->offset > ndr->relative_highest_offset) {
975                                         ndr->relative_highest_offset = ndr->offset;
976                                 }
977                                 ndr->offset = _relative_save_offset;
978                         }
979                         ndr->flags = _flags_save_string;
980                 }
981                 {
982                         uint32_t _flags_save_string = ndr->flags;
983                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
984                         if (r->default_datatype) {
985                                 uint32_t _relative_save_offset;
986                                 _relative_save_offset = ndr->offset;
987                                 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->default_datatype));
988                                 _mem_save_default_datatype_0 = NDR_PULL_GET_MEM_CTX(ndr);
989                                 NDR_PULL_SET_MEM_CTX(ndr, r->default_datatype, 0);
990                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->default_datatype));
991                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_default_datatype_0, 0);
992                                 if (ndr->offset > ndr->relative_highest_offset) {
993                                         ndr->relative_highest_offset = ndr->offset;
994                                 }
995                                 ndr->offset = _relative_save_offset;
996                         }
997                         ndr->flags = _flags_save_string;
998                 }
999                 {
1000                         uint32_t _flags_save_string_array = ndr->flags;
1001                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1002                         if (r->previous_names) {
1003                                 uint32_t _relative_save_offset;
1004                                 _relative_save_offset = ndr->offset;
1005                                 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->previous_names));
1006                                 _mem_save_previous_names_0 = NDR_PULL_GET_MEM_CTX(ndr);
1007                                 NDR_PULL_SET_MEM_CTX(ndr, r->previous_names, 0);
1008                                 NDR_CHECK(ndr_pull_string_array(ndr, NDR_SCALARS, &r->previous_names));
1009                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_previous_names_0, 0);
1010                                 if (ndr->offset > ndr->relative_highest_offset) {
1011                                         ndr->relative_highest_offset = ndr->offset;
1012                                 }
1013                                 ndr->offset = _relative_save_offset;
1014                         }
1015                         ndr->flags = _flags_save_string_array;
1016                 }
1017                 {
1018                         uint32_t _flags_save_string = ndr->flags;
1019                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1020                         if (r->manufacturer_name) {
1021                                 uint32_t _relative_save_offset;
1022                                 _relative_save_offset = ndr->offset;
1023                                 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->manufacturer_name));
1024                                 _mem_save_manufacturer_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
1025                                 NDR_PULL_SET_MEM_CTX(ndr, r->manufacturer_name, 0);
1026                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->manufacturer_name));
1027                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_manufacturer_name_0, 0);
1028                                 if (ndr->offset > ndr->relative_highest_offset) {
1029                                         ndr->relative_highest_offset = ndr->offset;
1030                                 }
1031                                 ndr->offset = _relative_save_offset;
1032                         }
1033                         ndr->flags = _flags_save_string;
1034                 }
1035                 {
1036                         uint32_t _flags_save_string = ndr->flags;
1037                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1038                         if (r->manufacturer_url) {
1039                                 uint32_t _relative_save_offset;
1040                                 _relative_save_offset = ndr->offset;
1041                                 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->manufacturer_url));
1042                                 _mem_save_manufacturer_url_0 = NDR_PULL_GET_MEM_CTX(ndr);
1043                                 NDR_PULL_SET_MEM_CTX(ndr, r->manufacturer_url, 0);
1044                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->manufacturer_url));
1045                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_manufacturer_url_0, 0);
1046                                 if (ndr->offset > ndr->relative_highest_offset) {
1047                                         ndr->relative_highest_offset = ndr->offset;
1048                                 }
1049                                 ndr->offset = _relative_save_offset;
1050                         }
1051                         ndr->flags = _flags_save_string;
1052                 }
1053                 {
1054                         uint32_t _flags_save_string = ndr->flags;
1055                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1056                         if (r->hardware_id) {
1057                                 uint32_t _relative_save_offset;
1058                                 _relative_save_offset = ndr->offset;
1059                                 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->hardware_id));
1060                                 _mem_save_hardware_id_0 = NDR_PULL_GET_MEM_CTX(ndr);
1061                                 NDR_PULL_SET_MEM_CTX(ndr, r->hardware_id, 0);
1062                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->hardware_id));
1063                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_hardware_id_0, 0);
1064                                 if (ndr->offset > ndr->relative_highest_offset) {
1065                                         ndr->relative_highest_offset = ndr->offset;
1066                                 }
1067                                 ndr->offset = _relative_save_offset;
1068                         }
1069                         ndr->flags = _flags_save_string;
1070                 }
1071                 {
1072                         uint32_t _flags_save_string = ndr->flags;
1073                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1074                         if (r->provider) {
1075                                 uint32_t _relative_save_offset;
1076                                 _relative_save_offset = ndr->offset;
1077                                 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->provider));
1078                                 _mem_save_provider_0 = NDR_PULL_GET_MEM_CTX(ndr);
1079                                 NDR_PULL_SET_MEM_CTX(ndr, r->provider, 0);
1080                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->provider));
1081                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_provider_0, 0);
1082                                 if (ndr->offset > ndr->relative_highest_offset) {
1083                                         ndr->relative_highest_offset = ndr->offset;
1084                                 }
1085                                 ndr->offset = _relative_save_offset;
1086                         }
1087                         ndr->flags = _flags_save_string;
1088                 }
1089                 if (r->file_info) {
1090                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->file_info, r->file_count));
1091                 }
1092         }
1093         return NDR_ERR_SUCCESS;
1094 }
1095
1096 void ndr_print_spoolss_Field(struct ndr_print *ndr, const char *name, const union spoolss_Field *r)
1097 {
1098         int level;
1099         level = ndr_print_get_switch_value(ndr, r);
1100         ndr_print_union(ndr, name, level, "spoolss_Field");
1101         switch (level) {
1102                 case PRINTER_NOTIFY_TYPE:
1103                         ndr_print_spoolss_PrintNotifyField(ndr, "field", r->field);
1104                 break;
1105
1106                 case JOB_NOTIFY_TYPE:
1107                         ndr_print_spoolss_JobNotifyField(ndr, "field", r->field);
1108                 break;
1109
1110                 default:
1111                         ndr_print_uint16(ndr, "field", r->field);
1112                 break;
1113
1114         }
1115 }
1116
1117 _PUBLIC_ size_t ndr_size_spoolss_PrinterData(const union spoolss_PrinterData *r, uint32_t level, struct smb_iconv_convenience *ic, int flags)
1118 {
1119         if (!r) {
1120                 return 0;
1121         }
1122         return ndr_size_union(r, flags, level, (ndr_push_flags_fn_t)ndr_push_spoolss_PrinterData, ic);
1123 }
1124
1125 void ndr_print_spoolss_security_descriptor(struct ndr_print *ndr, const char *name, const struct security_descriptor *r)
1126 {
1127         ndr_print_security_descriptor(ndr, name, r);
1128 }
1129
1130 enum ndr_err_code ndr_pull_spoolss_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r)
1131 {
1132         uint32_t _flags_save_STRUCT = ndr->flags;
1133         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NO_RELATIVE_REVERSE);
1134         NDR_CHECK(ndr_pull_security_descriptor(ndr, ndr_flags, r));
1135         ndr->flags = _flags_save_STRUCT;
1136         return NDR_ERR_SUCCESS;
1137 }
1138
1139 enum ndr_err_code ndr_push_spoolss_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r)
1140 {
1141         {
1142                 uint32_t _flags_save_STRUCT = ndr->flags;
1143                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN|LIBNDR_FLAG_NO_RELATIVE_REVERSE);
1144                 if (ndr_flags & NDR_SCALARS) {
1145                         NDR_CHECK(ndr_push_align(ndr, 5));
1146                         NDR_CHECK(ndr_push_security_descriptor_revision(ndr, NDR_SCALARS, r->revision));
1147                         NDR_CHECK(ndr_push_security_descriptor_type(ndr, NDR_SCALARS, r->type));
1148                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->owner_sid));
1149                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->group_sid));
1150                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->sacl));
1151                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->dacl));
1152                         NDR_CHECK(ndr_push_trailer_align(ndr, 5));
1153                 }
1154                 if (ndr_flags & NDR_BUFFERS) {
1155                         if (r->sacl) {
1156                                 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->sacl));
1157                                 NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->sacl));
1158                                 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->sacl));
1159                         }
1160                         if (r->dacl) {
1161                                 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->dacl));
1162                                 NDR_CHECK(ndr_push_security_acl(ndr, NDR_SCALARS|NDR_BUFFERS, r->dacl));
1163                                 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->dacl));
1164                         }
1165                         if (r->owner_sid) {
1166                                 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->owner_sid));
1167                                 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->owner_sid));
1168                                 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->owner_sid));
1169                         }
1170                         if (r->group_sid) {
1171                                 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->group_sid));
1172                                 NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, r->group_sid));
1173                                 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->group_sid));
1174                         }
1175                 }
1176                 ndr->flags = _flags_save_STRUCT;
1177         }
1178         return NDR_ERR_SUCCESS;
1179 }
1180
1181 _PUBLIC_ enum ndr_err_code ndr_push_spoolss_PrinterInfo2(struct ndr_push *ndr, int ndr_flags, const struct spoolss_PrinterInfo2 *r)
1182 {
1183         if (ndr_flags & NDR_SCALARS) {
1184                 NDR_CHECK(ndr_push_align(ndr, 5));
1185                 {
1186                         uint32_t _flags_save_string = ndr->flags;
1187                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1188                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->servername));
1189                         ndr->flags = _flags_save_string;
1190                 }
1191                 {
1192                         uint32_t _flags_save_string = ndr->flags;
1193                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1194                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->printername));
1195                         ndr->flags = _flags_save_string;
1196                 }
1197                 {
1198                         uint32_t _flags_save_string = ndr->flags;
1199                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1200                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->sharename));
1201                         ndr->flags = _flags_save_string;
1202                 }
1203                 {
1204                         uint32_t _flags_save_string = ndr->flags;
1205                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1206                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->portname));
1207                         ndr->flags = _flags_save_string;
1208                 }
1209                 {
1210                         uint32_t _flags_save_string = ndr->flags;
1211                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1212                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->drivername));
1213                         ndr->flags = _flags_save_string;
1214                 }
1215                 {
1216                         uint32_t _flags_save_string = ndr->flags;
1217                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1218                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->comment));
1219                         ndr->flags = _flags_save_string;
1220                 }
1221                 {
1222                         uint32_t _flags_save_string = ndr->flags;
1223                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1224                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->location));
1225                         ndr->flags = _flags_save_string;
1226                 }
1227                 {
1228                         uint32_t _flags_save_spoolss_DeviceMode = ndr->flags;
1229                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
1230                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->devmode));
1231                         ndr->flags = _flags_save_spoolss_DeviceMode;
1232                 }
1233                 {
1234                         uint32_t _flags_save_string = ndr->flags;
1235                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1236                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->sepfile));
1237                         ndr->flags = _flags_save_string;
1238                 }
1239                 {
1240                         uint32_t _flags_save_string = ndr->flags;
1241                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1242                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->printprocessor));
1243                         ndr->flags = _flags_save_string;
1244                 }
1245                 {
1246                         uint32_t _flags_save_string = ndr->flags;
1247                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1248                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->datatype));
1249                         ndr->flags = _flags_save_string;
1250                 }
1251                 {
1252                         uint32_t _flags_save_string = ndr->flags;
1253                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1254                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->parameters));
1255                         ndr->flags = _flags_save_string;
1256                 }
1257                 {
1258                         uint32_t _flags_save_spoolss_security_descriptor = ndr->flags;
1259                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
1260                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->secdesc));
1261                         ndr->flags = _flags_save_spoolss_security_descriptor;
1262                 }
1263                 NDR_CHECK(ndr_push_spoolss_PrinterAttributes(ndr, NDR_SCALARS, r->attributes));
1264                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->priority));
1265                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->defaultpriority));
1266                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->starttime));
1267                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->untiltime));
1268                 NDR_CHECK(ndr_push_spoolss_PrinterStatus(ndr, NDR_SCALARS, r->status));
1269                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->cjobs));
1270                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->averageppm));
1271                 NDR_CHECK(ndr_push_trailer_align(ndr, 5));
1272         }
1273         if (ndr_flags & NDR_BUFFERS) {
1274                 {
1275                         uint32_t _flags_save_string = ndr->flags;
1276                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1277                         if (r->servername) {
1278                                 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->servername));
1279                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->servername));
1280                                 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->servername));
1281                         }
1282                         ndr->flags = _flags_save_string;
1283                 }
1284                 {
1285                         uint32_t _flags_save_string = ndr->flags;
1286                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1287                         if (r->printername) {
1288                                 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->printername));
1289                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->printername));
1290                                 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->printername));
1291                         }
1292                         ndr->flags = _flags_save_string;
1293                 }
1294                 {
1295                         uint32_t _flags_save_string = ndr->flags;
1296                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1297                         if (r->sharename) {
1298                                 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->sharename));
1299                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->sharename));
1300                                 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->sharename));
1301                         }
1302                         ndr->flags = _flags_save_string;
1303                 }
1304                 {
1305                         uint32_t _flags_save_string = ndr->flags;
1306                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1307                         if (r->portname) {
1308                                 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->portname));
1309                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->portname));
1310                                 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->portname));
1311                         }
1312                         ndr->flags = _flags_save_string;
1313                 }
1314                 {
1315                         uint32_t _flags_save_string = ndr->flags;
1316                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1317                         if (r->drivername) {
1318                                 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->drivername));
1319                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->drivername));
1320                                 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->drivername));
1321                         }
1322                         ndr->flags = _flags_save_string;
1323                 }
1324                 {
1325                         uint32_t _flags_save_string = ndr->flags;
1326                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1327                         if (r->comment) {
1328                                 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->comment));
1329                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->comment));
1330                                 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->comment));
1331                         }
1332                         ndr->flags = _flags_save_string;
1333                 }
1334                 {
1335                         uint32_t _flags_save_string = ndr->flags;
1336                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1337                         if (r->location) {
1338                                 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->location));
1339                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->location));
1340                                 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->location));
1341                         }
1342                         ndr->flags = _flags_save_string;
1343                 }
1344                 {
1345                         uint32_t _flags_save_string = ndr->flags;
1346                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1347                         if (r->sepfile) {
1348                                 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->sepfile));
1349                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->sepfile));
1350                                 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->sepfile));
1351                         }
1352                         ndr->flags = _flags_save_string;
1353                 }
1354                 {
1355                         uint32_t _flags_save_string = ndr->flags;
1356                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1357                         if (r->printprocessor) {
1358                                 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->printprocessor));
1359                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->printprocessor));
1360                                 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->printprocessor));
1361                         }
1362                         ndr->flags = _flags_save_string;
1363                 }
1364                 {
1365                         uint32_t _flags_save_string = ndr->flags;
1366                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1367                         if (r->datatype) {
1368                                 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->datatype));
1369                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->datatype));
1370                                 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->datatype));
1371                         }
1372                         ndr->flags = _flags_save_string;
1373                 }
1374                 {
1375                         uint32_t _flags_save_string = ndr->flags;
1376                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
1377                         if (r->parameters) {
1378                                 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->parameters));
1379                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->parameters));
1380                                 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->parameters));
1381                         }
1382                         ndr->flags = _flags_save_string;
1383                 }
1384                 {
1385                         uint32_t _flags_save_spoolss_DeviceMode = ndr->flags;
1386                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
1387                         if (r->devmode) {
1388                                 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->devmode));
1389                                 {
1390                                         struct ndr_push *_ndr_devmode;
1391                                         NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_devmode, 0, -1));
1392                                         NDR_CHECK(ndr_push_spoolss_DeviceMode(_ndr_devmode, NDR_SCALARS, r->devmode));
1393                                         NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_devmode, 0, -1));
1394                                 }
1395                                 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->devmode));
1396                         }
1397                         ndr->flags = _flags_save_spoolss_DeviceMode;
1398                 }
1399                 {
1400                         uint32_t _flags_save_spoolss_security_descriptor = ndr->flags;
1401                         ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
1402                         if (r->secdesc) {
1403                                 NDR_CHECK(ndr_push_relative_ptr2_start(ndr, r->secdesc));
1404                                 {
1405                                         struct ndr_push *_ndr_secdesc;
1406                                         NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_secdesc, 0, -1));
1407                                         NDR_CHECK(ndr_push_spoolss_security_descriptor(_ndr_secdesc, NDR_SCALARS|NDR_BUFFERS, r->secdesc));
1408                                         NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_secdesc, 0, -1));
1409                                 }
1410                                 NDR_CHECK(ndr_push_relative_ptr2_end(ndr, r->secdesc));
1411                         }
1412                         ndr->flags = _flags_save_spoolss_security_descriptor;
1413                 }
1414         }
1415         return NDR_ERR_SUCCESS;
1416 }
1417
1418 _PUBLIC_ void ndr_print_spoolss_Time(struct ndr_print *ndr, const char *name, const struct spoolss_Time *r)
1419 {
1420         struct tm tm;
1421         time_t t;
1422         char *str;
1423
1424         tm.tm_sec       = r->second;
1425         tm.tm_min       = r->minute;
1426         tm.tm_hour      = r->hour;
1427         tm.tm_mday      = r->day;
1428         tm.tm_mon       = r->month - 1;
1429         tm.tm_year      = r->year - 1900;
1430         tm.tm_wday      = r->day_of_week;
1431         tm.tm_yday      = 0;
1432         tm.tm_isdst     = -1;
1433
1434         t = mktime(&tm);
1435
1436         str = timestring(ndr, t);
1437
1438         ndr_print_struct(ndr, name, "spoolss_Time");
1439         ndr->depth++;
1440         ndr_print_string(ndr, "", str);
1441         ndr->depth--;
1442         talloc_free(str);
1443 }