spoolss: fix ndr_pull_spoolss_GetPrinterData.
[kai/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
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 3 of the License, or
12    (at your option) any later version.
13
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18
19    You should have received a copy of the GNU General Public License
20    along with this program.  If not, see <http://www.gnu.org/licenses/>.
21 */
22
23
24 #include "includes.h"
25 #include "librpc/gen_ndr/ndr_spoolss.h"
26 #if (_SAMBA_BUILD_ >= 4)
27 #include "param/param.h"
28 #endif
29
30 #define NDR_SPOOLSS_PUSH_ENUM_IN(fn) do { \
31         if (!r->in.buffer && r->in.offered != 0) {\
32                 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
33                         "SPOOLSS Buffer: r->in.offered[%u] but there's no buffer",\
34                         (unsigned)r->in.offered);\
35         } else if (r->in.buffer && r->in.buffer->length != r->in.offered) {\
36                 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
37                         "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of r->in.buffer[%u]",\
38                         (unsigned)r->in.offered, (unsigned)r->in.buffer->length);\
39         }\
40         _r.in.level     = r->in.level;\
41         _r.in.buffer    = r->in.buffer;\
42         _r.in.offered   = r->in.offered;\
43         NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\
44 } while(0)
45
46 #define NDR_SPOOLSS_PUSH_ENUM_OUT(fn) do { \
47         struct ndr_push *_ndr_info;\
48         _r.in.level     = r->in.level;\
49         _r.in.buffer    = r->in.buffer;\
50         _r.in.offered   = r->in.offered;\
51         _r.out.info     = NULL;\
52         _r.out.needed   = r->out.needed;\
53         _r.out.count    = r->out.count;\
54         _r.out.result   = r->out.result;\
55         if (r->out.info && !r->in.buffer) {\
56                 return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
57                         "SPOOLSS Buffer: r->out.info but there's no r->in.buffer");\
58         }\
59         if (r->in.buffer) {\
60                 DATA_BLOB _data_blob_info;\
61                 _ndr_info = ndr_push_init_ctx(ndr, ndr->iconv_convenience);\
62                 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
63                 _ndr_info->flags= ndr->flags;\
64                 if (r->out.info) {\
65                         struct __##fn __r;\
66                         __r.in.level    = r->in.level;\
67                         __r.in.count    = r->out.count;\
68                         __r.out.info    = r->out.info;\
69                         NDR_CHECK(ndr_push___##fn(_ndr_info, flags, &__r)); \
70                 }\
71                 if (r->in.offered > _ndr_info->offset) {\
72                         uint32_t _padding_len = r->in.offered - _ndr_info->offset;\
73                         NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len));\
74                 } else if (r->in.offered < _ndr_info->offset) {\
75                         return ndr_push_error(ndr, NDR_ERR_BUFSIZE,\
76                                 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of out buffer[%u]!",\
77                                 (unsigned)r->in.offered, (unsigned)_ndr_info->offset);\
78                 }\
79                 _data_blob_info = ndr_push_blob(_ndr_info);\
80                 _r.out.info     = &_data_blob_info;\
81         }\
82         NDR_CHECK(ndr_push__##fn(ndr, flags, &_r));\
83 } while(0)
84
85 #define NDR_SPOOLSS_PUSH_ENUM(fn,in,out) do { \
86         struct _##fn _r;\
87         if (flags & NDR_IN) {\
88                 in;\
89                 NDR_SPOOLSS_PUSH_ENUM_IN(fn);\
90         }\
91         if (flags & NDR_OUT) {\
92                 out;\
93                 NDR_SPOOLSS_PUSH_ENUM_OUT(fn);\
94         }\
95 } while(0)
96
97 #define NDR_SPOOLSS_PULL_ENUM_IN(fn) do { \
98         ZERO_STRUCT(r->out);\
99         NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
100         r->in.level     = _r.in.level;\
101         r->in.buffer    = _r.in.buffer;\
102         r->in.offered   = _r.in.offered;\
103         r->out.needed   = _r.out.needed;\
104         if (!r->in.buffer && r->in.offered != 0) {\
105                 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
106                         "SPOOLSS Buffer: r->in.offered[%u] but there's no buffer",\
107                         (unsigned)r->in.offered);\
108         } else if (r->in.buffer && r->in.buffer->length != r->in.offered) {\
109                 return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
110                         "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of r->in.buffer[%u]",\
111                         (unsigned)r->in.offered, (unsigned)r->in.buffer->length);\
112         }\
113 } while(0)
114
115 #define NDR_SPOOLSS_PULL_ENUM_OUT(fn) do { \
116         _r.in.level     = r->in.level;\
117         _r.in.buffer    = r->in.buffer;\
118         _r.in.offered   = r->in.offered;\
119         _r.out.needed   = r->out.needed;\
120         NDR_CHECK(ndr_pull__##fn(ndr, flags, &_r));\
121         r->out.info     = NULL;\
122         r->out.needed   = _r.out.needed;\
123         r->out.count    = _r.out.count;\
124         r->out.result   = _r.out.result;\
125         if (_r.out.info) {\
126                 struct ndr_pull *_ndr_info = ndr_pull_init_blob(_r.out.info, ndr, ndr->iconv_convenience);\
127                 NDR_ERR_HAVE_NO_MEMORY(_ndr_info);\
128                 _ndr_info->flags= ndr->flags;\
129                 if (r->in.offered != _ndr_info->data_size) {\
130                         return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,\
131                                 "SPOOLSS Buffer: offered[%u] doesn't match length of buffer[%u]",\
132                                 (unsigned)r->in.offered, (unsigned)_ndr_info->data_size);\
133                 }\
134                 if (*r->out.needed <= _ndr_info->data_size) {\
135                         struct __##fn __r;\
136                         __r.in.level    = r->in.level;\
137                         __r.in.count    = r->out.count;\
138                         __r.out.info    = NULL;\
139                         NDR_CHECK(ndr_pull___##fn(_ndr_info, flags, &__r));\
140                         r->out.info     = __r.out.info;\
141                 }\
142         }\
143 } while(0)
144
145 #define NDR_SPOOLSS_PULL_ENUM(fn,in,out) do { \
146         struct _##fn _r;\
147         if (flags & NDR_IN) {\
148                 out;\
149                 NDR_SPOOLSS_PULL_ENUM_IN(fn);\
150                 in;\
151         }\
152         if (flags & NDR_OUT) {\
153                 out;\
154                 NDR_SPOOLSS_PULL_ENUM_OUT(fn);\
155         }\
156 } while(0)
157
158 #define _NDR_CHECK_UINT32(call) do {\
159         enum ndr_err_code _ndr_err; \
160         _ndr_err = call; \
161         if (!NDR_ERR_CODE_IS_SUCCESS(_ndr_err)) { \
162                 return 0; \
163         }\
164 } while (0)
165
166 /* TODO: set _ndr_info->flags correct */
167 #define NDR_SPOOLSS_SIZE_ENUM(fn) do { \
168         struct __##fn __r;\
169         DATA_BLOB _data_blob_info;\
170         struct ndr_push *_ndr_info = ndr_push_init_ctx(mem_ctx, iconv_convenience);\
171         if (!_ndr_info) return 0;\
172         _ndr_info->flags|=0;\
173         __r.in.level    = level;\
174         __r.in.count    = count;\
175         __r.out.info    = info;\
176         _NDR_CHECK_UINT32(ndr_push___##fn(_ndr_info, NDR_OUT, &__r)); \
177         _data_blob_info = ndr_push_blob(_ndr_info);\
178         return _data_blob_info.length;\
179 } while(0)
180
181 /*
182   spoolss_EnumPrinters
183 */
184 enum ndr_err_code ndr_push_spoolss_EnumPrinters(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinters *r)
185 {
186         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinters,{
187                 _r.in.flags     = r->in.flags;
188                 _r.in.server    = r->in.server;
189         },{
190                 _r.in.flags     = r->in.flags;
191                 _r.in.server    = r->in.server;
192         });
193         return NDR_ERR_SUCCESS;
194 }
195
196 enum ndr_err_code ndr_pull_spoolss_EnumPrinters(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinters *r)
197 {
198         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrinters,{
199                 r->in.flags     = _r.in.flags;
200                 r->in.server    = _r.in.server;
201         },{
202                 _r.in.flags     = r->in.flags;
203                 _r.in.server    = r->in.server;
204         });
205         return NDR_ERR_SUCCESS;
206 }
207
208 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)
209 {
210         NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrinters);
211 }
212
213 /*
214   spoolss_EnumJobs
215 */
216 enum ndr_err_code ndr_push_spoolss_EnumJobs(struct ndr_push *ndr, int flags, const struct spoolss_EnumJobs *r)
217 {
218         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumJobs,{
219                 _r.in.handle    = r->in.handle;
220                 _r.in.firstjob  = r->in.firstjob;
221                 _r.in.numjobs   = r->in.numjobs;
222         },{
223                 _r.in.handle    = r->in.handle;
224                 _r.in.firstjob  = r->in.firstjob;
225                 _r.in.numjobs   = r->in.numjobs;
226         });
227         return NDR_ERR_SUCCESS;
228 }
229
230 enum ndr_err_code ndr_pull_spoolss_EnumJobs(struct ndr_pull *ndr, int flags, struct spoolss_EnumJobs *r)
231 {
232         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumJobs,{
233                 r->in.handle    = _r.in.handle;
234                 r->in.firstjob  = _r.in.firstjob;
235                 r->in.numjobs   = _r.in.numjobs;
236         },{
237                 _r.in.handle    = r->in.handle;
238                 _r.in.firstjob  = r->in.firstjob;
239                 _r.in.numjobs   = r->in.numjobs;
240         });
241         return NDR_ERR_SUCCESS;
242 }
243
244 uint32_t ndr_size_spoolss_EnumJobss_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, uint32_t level, uint32_t count, union spoolss_JobInfo *info)
245 {
246         NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumJobs);
247 }
248
249 /*
250   spoolss_EnumPrinterDrivers
251 */
252 enum ndr_err_code ndr_push_spoolss_EnumPrinterDrivers(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrinterDrivers *r)
253 {
254         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrinterDrivers,{
255                 _r.in.server            = r->in.server;
256                 _r.in.environment       = r->in.environment;
257         },{
258                 _r.in.server            = r->in.server;
259                 _r.in.environment       = r->in.environment;
260         });
261         return NDR_ERR_SUCCESS;
262 }
263
264 enum ndr_err_code ndr_pull_spoolss_EnumPrinterDrivers(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrinterDrivers *r)
265 {
266         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrinterDrivers,{
267                 r->in.server            = _r.in.server;
268                 r->in.environment       = _r.in.environment;
269         },{
270                 _r.in.server            = r->in.server;
271                 _r.in.environment       = r->in.environment;
272         });
273         return NDR_ERR_SUCCESS;
274 }
275
276 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)
277 {
278         NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrinterDrivers);
279 }
280
281 /*
282   spoolss_EnumForms
283 */
284 enum ndr_err_code ndr_push_spoolss_EnumForms(struct ndr_push *ndr, int flags, const struct spoolss_EnumForms *r)
285 {
286         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumForms,{
287                 _r.in.handle    = r->in.handle;
288         },{
289                 _r.in.handle    = r->in.handle;
290         });
291         return NDR_ERR_SUCCESS;
292 }
293
294 enum ndr_err_code ndr_pull_spoolss_EnumForms(struct ndr_pull *ndr, int flags, struct spoolss_EnumForms *r)
295 {
296         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumForms,{
297                 r->in.handle    = _r.in.handle;
298         },{
299                 _r.in.handle    = r->in.handle;
300         });
301         return NDR_ERR_SUCCESS;
302 }
303
304 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)
305 {
306         NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumForms);
307 }
308
309 /*
310   spoolss_EnumPorts
311 */
312 enum ndr_err_code ndr_push_spoolss_EnumPorts(struct ndr_push *ndr, int flags, const struct spoolss_EnumPorts *r)
313 {
314         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPorts,{
315                 _r.in.servername= r->in.servername;
316         },{
317                 _r.in.servername= r->in.servername;
318         });
319         return NDR_ERR_SUCCESS;
320 }
321
322 enum ndr_err_code ndr_pull_spoolss_EnumPorts(struct ndr_pull *ndr, int flags, struct spoolss_EnumPorts *r)
323 {
324         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPorts,{
325                 r->in.servername= _r.in.servername;
326         },{
327                 _r.in.servername= r->in.servername;
328         });
329         return NDR_ERR_SUCCESS;
330 }
331
332 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)
333 {
334         NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPorts);
335 }
336
337 /*
338   spoolss_EnumMonitors
339 */
340 enum ndr_err_code ndr_push_spoolss_EnumMonitors(struct ndr_push *ndr, int flags, const struct spoolss_EnumMonitors *r)
341 {
342         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumMonitors,{
343                 _r.in.servername= r->in.servername;
344         },{
345                 _r.in.servername= r->in.servername;
346         });
347         return NDR_ERR_SUCCESS;
348 }
349
350 enum ndr_err_code ndr_pull_spoolss_EnumMonitors(struct ndr_pull *ndr, int flags, struct spoolss_EnumMonitors *r)
351 {
352         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumMonitors,{
353                 r->in.servername= _r.in.servername;
354         },{
355                 _r.in.servername= r->in.servername;
356         });
357         return NDR_ERR_SUCCESS;
358 }
359
360 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)
361 {
362         NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumMonitors);
363 }
364
365 /*
366   spoolss_EnumPrintProcessors
367 */
368 enum ndr_err_code ndr_push_spoolss_EnumPrintProcessors(struct ndr_push *ndr, int flags, const struct spoolss_EnumPrintProcessors *r)
369 {
370         NDR_SPOOLSS_PUSH_ENUM(spoolss_EnumPrintProcessors,{
371                 _r.in.servername        = r->in.servername;
372                 _r.in.environment       = r->in.environment;
373         },{
374                 _r.in.servername        = r->in.servername;
375                 _r.in.environment       = r->in.environment;
376         });
377         return NDR_ERR_SUCCESS;
378 }
379
380 enum ndr_err_code ndr_pull_spoolss_EnumPrintProcessors(struct ndr_pull *ndr, int flags, struct spoolss_EnumPrintProcessors *r)
381 {
382         NDR_SPOOLSS_PULL_ENUM(spoolss_EnumPrintProcessors,{
383                 r->in.servername        = _r.in.servername;
384                 r->in.environment       = _r.in.environment;
385         },{
386                 _r.in.servername        = r->in.servername;
387                 _r.in.environment       = r->in.environment;
388         });
389         return NDR_ERR_SUCCESS;
390 }
391
392 uint32_t ndr_size_spoolss_EnumPrinterProcessors_info(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience,
393                                                                                                          uint32_t level, uint32_t count, union spoolss_PrintProcessorInfo *info)
394 {
395         NDR_SPOOLSS_SIZE_ENUM(spoolss_EnumPrintProcessors);
396 }
397
398 /*
399   spoolss_GetPrinterData
400 */
401 enum ndr_err_code ndr_push_spoolss_GetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_GetPrinterData *r)
402 {
403         struct _spoolss_GetPrinterData _r;
404         if (flags & NDR_IN) {
405                 _r.in.handle    = r->in.handle;
406                 _r.in.value_name= r->in.value_name;
407                 _r.in.offered   = r->in.offered;
408                 NDR_CHECK(ndr_push__spoolss_GetPrinterData(ndr, flags, &_r));
409         }
410         if (flags & NDR_OUT) {
411                 struct ndr_push *_ndr_info;
412                 _r.in.handle    = r->in.handle;
413                 _r.in.value_name= r->in.value_name;
414                 _r.in.offered   = r->in.offered;
415                 _r.out.type     = r->out.type;
416                 _r.out.data     = data_blob(NULL, 0);
417                 _r.out.needed   = r->out.needed;
418                 _r.out.result   = r->out.result;
419                 {
420                         struct __spoolss_GetPrinterData __r;
421                         _ndr_info = ndr_push_init_ctx(ndr, ndr->iconv_convenience);
422                         NDR_ERR_HAVE_NO_MEMORY(_ndr_info);
423                         _ndr_info->flags= ndr->flags;
424                         __r.in.type     = *r->out.type;
425                         __r.out.data    = r->out.data;
426                         NDR_CHECK(ndr_push___spoolss_GetPrinterData(_ndr_info, flags, &__r));
427                         if (r->in.offered > _ndr_info->offset) {
428                                 uint32_t _padding_len = r->in.offered - _ndr_info->offset;
429                                 NDR_CHECK(ndr_push_zero(_ndr_info, _padding_len));
430                         }
431                         _r.out.data = ndr_push_blob(_ndr_info);
432                 }
433                 NDR_CHECK(ndr_push__spoolss_GetPrinterData(ndr, flags, &_r));
434         }
435         return NDR_ERR_SUCCESS;
436 }
437
438 enum ndr_err_code ndr_pull_spoolss_GetPrinterData(struct ndr_pull *ndr, int flags, struct spoolss_GetPrinterData *r)
439 {
440         struct _spoolss_GetPrinterData _r;
441         if (flags & NDR_IN) {
442                 ZERO_STRUCT(r->out);
443
444                 _r.in.handle    = r->in.handle;
445                 _r.in.value_name= r->in.value_name;
446                 _r.in.offered   = r->in.offered;
447                 _r.out.type     = r->out.type;
448                 _r.out.data     = data_blob(NULL,0),
449                 _r.out.needed   = r->out.needed;
450                 NDR_CHECK(ndr_pull__spoolss_GetPrinterData(ndr, flags, &_r));
451                 r->in.handle    = _r.in.handle;
452                 r->in.value_name= _r.in.value_name;
453                 r->in.offered   = _r.in.offered;
454                 r->out.needed   = _r.out.needed;
455         }
456         if (flags & NDR_OUT) {
457                 _r.in.handle    = r->in.handle;
458                 _r.in.value_name= r->in.value_name;
459                 _r.in.offered   = r->in.offered;
460                 _r.out.type     = r->out.type;
461                 _r.out.data     = data_blob(NULL,0),
462                 _r.out.needed   = r->out.needed;
463                 _r.out.result   = r->out.result;
464                 NDR_CHECK(ndr_pull__spoolss_GetPrinterData(ndr, flags, &_r));
465                 r->out.type     = _r.out.type;
466                 ZERO_STRUCT(r->out.data);
467                 r->out.needed   = _r.out.needed;
468                 r->out.result   = _r.out.result;
469                 if (_r.out.data.length != r->in.offered) {
470                         return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,
471                                 "SPOOLSS Buffer: r->in.offered[%u] doesn't match length of out buffer[%u]",
472                                 (unsigned)r->in.offered, (unsigned)_r.out.data.length);
473                 }
474                 if (_r.out.data.length > 0 && *r->out.needed <= _r.out.data.length) {
475                         struct __spoolss_GetPrinterData __r;
476                         struct ndr_pull *_ndr_data = ndr_pull_init_blob(&_r.out.data, ndr, ndr->iconv_convenience);
477                         NDR_ERR_HAVE_NO_MEMORY(_ndr_data);
478                         _ndr_data->flags= ndr->flags;
479                         __r.in.type     = *r->out.type;
480                         __r.out.data    = r->out.data;
481                         NDR_CHECK(ndr_pull___spoolss_GetPrinterData(_ndr_data, flags, &__r));
482                         r->out.data     = __r.out.data;
483                 } else {
484                         *r->out.type    = SPOOLSS_PRINTER_DATA_TYPE_NULL;
485                 }
486         }
487         return NDR_ERR_SUCCESS;
488 }
489
490 /*
491   spoolss_SetPrinterData
492 */
493 enum ndr_err_code ndr_push_spoolss_SetPrinterData(struct ndr_push *ndr, int flags, const struct spoolss_SetPrinterData *r)
494 {
495         struct _spoolss_SetPrinterData _r;
496         if (flags & NDR_IN) {
497                 struct ndr_push *_ndr_data;
498                 struct __spoolss_SetPrinterData __r;
499                 DATA_BLOB _data_blob_data;
500
501                 _ndr_data = ndr_push_init_ctx(ndr, ndr->iconv_convenience);
502                 NDR_ERR_HAVE_NO_MEMORY(_ndr_data);
503                 _ndr_data->flags= ndr->flags;
504
505                 __r.in.type     = r->in.type;
506                 __r.out.data    = r->in.data;
507                 NDR_CHECK(ndr_push___spoolss_SetPrinterData(_ndr_data, NDR_OUT, &__r));
508                 _data_blob_data = ndr_push_blob(_ndr_data);
509
510                 _r.in.handle    = r->in.handle;
511                 _r.in.value_name= r->in.value_name;
512                 _r.in.type      = r->in.type;
513                 _r.in.data      = _data_blob_data;
514                 _r.in._offered  = _data_blob_data.length;
515                 _r.out.result   = r->out.result;
516                 NDR_CHECK(ndr_push__spoolss_SetPrinterData(ndr, flags, &_r));
517         }
518         if (flags & NDR_OUT) {
519                 _r.in.handle    = r->in.handle;
520                 _r.in.value_name= r->in.value_name;
521                 _r.in.type      = r->in.type;
522                 _r.in.data      = data_blob(NULL,0),
523                 _r.in._offered  = r->in._offered;
524                 _r.out.result   = r->out.result;
525                 NDR_CHECK(ndr_push__spoolss_SetPrinterData(ndr, flags, &_r));
526         }
527         return NDR_ERR_SUCCESS;
528 }
529
530 uint32_t _ndr_size_spoolss_DeviceMode(struct spoolss_DeviceMode *devmode, struct smb_iconv_convenience *ic, uint32_t flags)
531 {
532         if (!devmode) return 0;
533         return ndr_size_spoolss_DeviceMode(devmode,ic,flags);
534 }