r23792: convert Samba4 to GPLv3
[samba.git] / source / smb_server / smb / nttrans.c
1 /* 
2    Unix SMB/CIFS implementation.
3    NT transaction handling
4    Copyright (C) Andrew Tridgell 2003
5    Copyright (C) James J Myers 2003 <myersjj@samba.org>
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3 of the License, or
10    (at your option) any later version.
11    
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16    
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 */
20 /*
21    This file handles the parsing of transact2 requests
22 */
23
24 #include "includes.h"
25 #include "smb_server/smb_server.h"
26 #include "ntvfs/ntvfs.h"
27 #include "libcli/raw/libcliraw.h"
28 #include "librpc/gen_ndr/ndr_security.h"
29
30 /*
31   hold the state of a nttrans op while in progress. Needed to allow for async backend
32   functions.
33 */
34 struct nttrans_op {
35         struct smb_nttrans *trans;
36         NTSTATUS (*send_fn)(struct nttrans_op *);
37         void *op_info;
38 };
39
40
41 /* setup a nttrans reply, given the data and params sizes */
42 static NTSTATUS nttrans_setup_reply(struct nttrans_op *op, 
43                                     struct smb_nttrans *trans,
44                                     uint32_t param_size, uint32_t data_size,
45                                     uint8_t setup_count)
46 {
47         trans->out.setup_count = setup_count;
48         if (setup_count != 0) {
49                 trans->out.setup = talloc_zero_array(op, uint8_t, setup_count*2);
50                 NT_STATUS_HAVE_NO_MEMORY(trans->out.setup);
51         }
52         trans->out.params = data_blob_talloc(op, NULL, param_size);
53         if (param_size != 0) {
54                 NT_STATUS_HAVE_NO_MEMORY(trans->out.params.data);
55         }
56         trans->out.data = data_blob_talloc(op, NULL, data_size);
57         if (data_size != 0) {
58                 NT_STATUS_HAVE_NO_MEMORY(trans->out.data.data);
59         }
60         return NT_STATUS_OK;
61 }
62
63 /*
64   send a nttrans create reply
65 */
66 static NTSTATUS nttrans_create_send(struct nttrans_op *op)
67 {
68         union smb_open *io = talloc_get_type(op->op_info, union smb_open);
69         uint8_t *params;
70         NTSTATUS status;
71
72         status = nttrans_setup_reply(op, op->trans, 69, 0, 0);
73         NT_STATUS_NOT_OK_RETURN(status);
74         params = op->trans->out.params.data;
75
76         SSVAL(params,        0, io->ntcreatex.out.oplock_level);
77         smbsrv_push_fnum(params, 2, io->ntcreatex.out.file.ntvfs);
78         SIVAL(params,        4, io->ntcreatex.out.create_action);
79         SIVAL(params,        8, 0); /* ea error offset */
80         push_nttime(params, 12, io->ntcreatex.out.create_time);
81         push_nttime(params, 20, io->ntcreatex.out.access_time);
82         push_nttime(params, 28, io->ntcreatex.out.write_time);
83         push_nttime(params, 36, io->ntcreatex.out.change_time);
84         SIVAL(params,       44, io->ntcreatex.out.attrib);
85         SBVAL(params,       48, io->ntcreatex.out.alloc_size);
86         SBVAL(params,       56, io->ntcreatex.out.size);
87         SSVAL(params,       64, io->ntcreatex.out.file_type);
88         SSVAL(params,       66, io->ntcreatex.out.ipc_state);
89         SCVAL(params,       68, io->ntcreatex.out.is_directory);
90
91         return NT_STATUS_OK;
92 }
93
94 /* 
95    parse NTTRANS_CREATE request
96  */
97 static NTSTATUS nttrans_create(struct smbsrv_request *req, 
98                                struct nttrans_op *op)
99 {
100         struct smb_nttrans *trans = op->trans;
101         union smb_open *io;
102         uint16_t fname_len;
103         uint32_t sd_length, ea_length;
104         NTSTATUS status;
105         uint8_t *params;
106
107         if (trans->in.params.length < 54) {
108                 return NT_STATUS_INVALID_PARAMETER;
109         }
110
111         /* parse the request */
112         io = talloc(op, union smb_open);
113         NT_STATUS_HAVE_NO_MEMORY(io);
114
115         io->ntcreatex.level = RAW_OPEN_NTTRANS_CREATE;
116
117         params = trans->in.params.data;
118
119         io->ntcreatex.in.flags            = IVAL(params,  0);
120         io->ntcreatex.in.root_fid         = IVAL(params,  4);
121         io->ntcreatex.in.access_mask      = IVAL(params,  8);
122         io->ntcreatex.in.alloc_size       = BVAL(params, 12);
123         io->ntcreatex.in.file_attr        = IVAL(params, 20);
124         io->ntcreatex.in.share_access     = IVAL(params, 24);
125         io->ntcreatex.in.open_disposition = IVAL(params, 28);
126         io->ntcreatex.in.create_options   = IVAL(params, 32);
127         sd_length                         = IVAL(params, 36);
128         ea_length                         = IVAL(params, 40);
129         fname_len                         = IVAL(params, 44);
130         io->ntcreatex.in.impersonation    = IVAL(params, 48);
131         io->ntcreatex.in.security_flags   = CVAL(params, 52);
132         io->ntcreatex.in.sec_desc         = NULL;
133         io->ntcreatex.in.ea_list          = NULL;
134
135         req_pull_string(req, &io->ntcreatex.in.fname, 
136                         params + 53, 
137                         MIN(fname_len+1, trans->in.params.length - 53),
138                         STR_NO_RANGE_CHECK | STR_TERMINATE);
139         if (!io->ntcreatex.in.fname) {
140                 return NT_STATUS_INVALID_PARAMETER;
141         }
142
143         if (sd_length > trans->in.data.length ||
144             ea_length > trans->in.data.length ||
145             (sd_length+ea_length) > trans->in.data.length) {
146                 return NT_STATUS_INVALID_PARAMETER;
147         }
148
149         /* this call has an optional security descriptor */
150         if (sd_length != 0) {
151                 DATA_BLOB blob;
152                 blob.data = trans->in.data.data;
153                 blob.length = sd_length;
154                 io->ntcreatex.in.sec_desc = talloc(io, struct security_descriptor);
155                 if (io->ntcreatex.in.sec_desc == NULL) {
156                         return NT_STATUS_NO_MEMORY;
157                 }
158                 status = ndr_pull_struct_blob(&blob, io, 
159                                               io->ntcreatex.in.sec_desc, 
160                                               (ndr_pull_flags_fn_t)ndr_pull_security_descriptor);
161                 if (!NT_STATUS_IS_OK(status)) {
162                         return status;
163                 }
164         }
165
166         /* and an optional ea_list */
167         if (ea_length > 4) {
168                 DATA_BLOB blob;
169                 blob.data = trans->in.data.data + sd_length;
170                 blob.length = ea_length;
171                 io->ntcreatex.in.ea_list = talloc(io, struct smb_ea_list);
172                 if (io->ntcreatex.in.ea_list == NULL) {
173                         return NT_STATUS_NO_MEMORY;
174                 }
175
176                 status = ea_pull_list_chained(&blob, io, 
177                                               &io->ntcreatex.in.ea_list->num_eas,
178                                               &io->ntcreatex.in.ea_list->eas);
179                 if (!NT_STATUS_IS_OK(status)) {
180                         return status;
181                 }
182         }
183
184         op->send_fn = nttrans_create_send;
185         op->op_info = io;
186
187         return ntvfs_open(req->ntvfs, io);
188 }
189
190
191 /* 
192    send NTTRANS_QUERY_SEC_DESC reply
193  */
194 static NTSTATUS nttrans_query_sec_desc_send(struct nttrans_op *op)
195 {
196         union smb_fileinfo *io = talloc_get_type(op->op_info, union smb_fileinfo);
197         uint8_t *params;
198         NTSTATUS status;
199
200         status = nttrans_setup_reply(op, op->trans, 4, 0, 0);
201         NT_STATUS_NOT_OK_RETURN(status);
202         params = op->trans->out.params.data;
203
204         status = ndr_push_struct_blob(&op->trans->out.data, op, 
205                                       io->query_secdesc.out.sd, 
206                                       (ndr_push_flags_fn_t)ndr_push_security_descriptor);
207         NT_STATUS_NOT_OK_RETURN(status);
208
209         SIVAL(params, 0, op->trans->out.data.length);
210
211         return NT_STATUS_OK;
212 }
213
214 /* 
215    parse NTTRANS_QUERY_SEC_DESC request
216  */
217 static NTSTATUS nttrans_query_sec_desc(struct smbsrv_request *req, 
218                                        struct nttrans_op *op)
219 {
220         struct smb_nttrans *trans = op->trans;
221         union smb_fileinfo *io;
222
223         if (trans->in.params.length < 8) {
224                 return NT_STATUS_INVALID_PARAMETER;
225         }
226
227         /* parse the request */
228         io = talloc(op, union smb_fileinfo);
229         NT_STATUS_HAVE_NO_MEMORY(io);
230
231         io->query_secdesc.level            = RAW_FILEINFO_SEC_DESC;
232         io->query_secdesc.in.file.ntvfs    = smbsrv_pull_fnum(req, trans->in.params.data, 0);
233         io->query_secdesc.in.secinfo_flags = IVAL(trans->in.params.data, 4);
234
235         op->op_info = io;
236         op->send_fn = nttrans_query_sec_desc_send;
237
238         SMBSRV_CHECK_FILE_HANDLE_NTSTATUS(io->query_secdesc.in.file.ntvfs);
239         return ntvfs_qfileinfo(req->ntvfs, io);
240 }
241
242
243 /* 
244    parse NTTRANS_SET_SEC_DESC request
245  */
246 static NTSTATUS nttrans_set_sec_desc(struct smbsrv_request *req, 
247                                      struct nttrans_op *op)
248 {
249         struct smb_nttrans *trans = op->trans;
250         union smb_setfileinfo *io;
251         NTSTATUS status;
252
253         if (trans->in.params.length < 8) {
254                 return NT_STATUS_INVALID_PARAMETER;
255         }
256
257         /* parse the request */
258         io = talloc(req, union smb_setfileinfo);
259         NT_STATUS_HAVE_NO_MEMORY(io);
260
261         io->set_secdesc.level            = RAW_SFILEINFO_SEC_DESC;
262         io->set_secdesc.in.file.ntvfs    = smbsrv_pull_fnum(req, trans->in.params.data, 0);
263         io->set_secdesc.in.secinfo_flags = IVAL(trans->in.params.data, 4);
264
265         io->set_secdesc.in.sd = talloc(io, struct security_descriptor);
266         NT_STATUS_HAVE_NO_MEMORY(io->set_secdesc.in.sd);
267
268         status = ndr_pull_struct_blob(&trans->in.data, req, 
269                                       io->set_secdesc.in.sd, 
270                                       (ndr_pull_flags_fn_t)ndr_pull_security_descriptor);
271         NT_STATUS_NOT_OK_RETURN(status);
272
273         SMBSRV_CHECK_FILE_HANDLE_NTSTATUS(io->set_secdesc.in.file.ntvfs);
274         return ntvfs_setfileinfo(req->ntvfs, io);
275 }
276
277
278 /* parse NTTRANS_RENAME request
279  */
280 static NTSTATUS nttrans_rename(struct smbsrv_request *req, 
281                                struct nttrans_op *op)
282 {
283         return NT_STATUS_NOT_IMPLEMENTED;
284 }
285
286 /* 
287    parse NTTRANS_IOCTL send
288  */
289 static NTSTATUS nttrans_ioctl_send(struct nttrans_op *op)
290 {
291         union smb_ioctl *info = talloc_get_type(op->op_info, union smb_ioctl);
292         NTSTATUS status;
293
294         /* 
295          * we pass 0 as data_count here,
296          * because we reuse the DATA_BLOB from the smb_ioctl
297          * struct
298          */
299         status = nttrans_setup_reply(op, op->trans, 0, 0, 1);
300         NT_STATUS_NOT_OK_RETURN(status);
301
302         op->trans->out.setup[0]         = 0;
303         op->trans->out.data             = info->ntioctl.out.blob;
304
305         return NT_STATUS_OK;
306 }
307
308
309 /* 
310    parse NTTRANS_IOCTL request
311  */
312 static NTSTATUS nttrans_ioctl(struct smbsrv_request *req, 
313                               struct nttrans_op *op)
314 {
315         struct smb_nttrans *trans = op->trans;
316         union smb_ioctl *nt;
317
318         /* should have at least 4 setup words */
319         if (trans->in.setup_count != 4) {
320                 return NT_STATUS_INVALID_PARAMETER;
321         }
322
323         nt = talloc(op, union smb_ioctl);
324         NT_STATUS_HAVE_NO_MEMORY(nt);
325         
326         nt->ntioctl.level               = RAW_IOCTL_NTIOCTL;
327         nt->ntioctl.in.function         = IVAL(trans->in.setup, 0);
328         nt->ntioctl.in.file.ntvfs       = smbsrv_pull_fnum(req, (uint8_t *)trans->in.setup, 4);
329         nt->ntioctl.in.fsctl            = CVAL(trans->in.setup, 6);
330         nt->ntioctl.in.filter           = CVAL(trans->in.setup, 7);
331         nt->ntioctl.in.max_data         = trans->in.max_data;
332         nt->ntioctl.in.blob             = trans->in.data;
333
334         op->op_info = nt;
335         op->send_fn = nttrans_ioctl_send;
336
337         SMBSRV_CHECK_FILE_HANDLE_NTSTATUS(nt->ntioctl.in.file.ntvfs);
338         return ntvfs_ioctl(req->ntvfs, nt);
339 }
340
341
342 /* 
343    send NTTRANS_NOTIFY_CHANGE reply
344  */
345 static NTSTATUS nttrans_notify_change_send(struct nttrans_op *op)
346 {
347         union smb_notify *info = talloc_get_type(op->op_info, union smb_notify);
348         size_t size = 0;
349         int i;
350         NTSTATUS status;
351         uint8_t *p;
352 #define MAX_BYTES_PER_CHAR 3
353         
354         /* work out how big the reply buffer could be */
355         for (i=0;i<info->nttrans.out.num_changes;i++) {
356                 size += 12 + 3 + (1+strlen(info->nttrans.out.changes[i].name.s)) * MAX_BYTES_PER_CHAR;
357         }
358
359         status = nttrans_setup_reply(op, op->trans, size, 0, 0);
360         NT_STATUS_NOT_OK_RETURN(status);
361         p = op->trans->out.params.data;
362
363         /* construct the changes buffer */
364         for (i=0;i<info->nttrans.out.num_changes;i++) {
365                 uint32_t ofs;
366                 ssize_t len;
367
368                 SIVAL(p, 4, info->nttrans.out.changes[i].action);
369                 len = push_string(p + 12, info->nttrans.out.changes[i].name.s, 
370                                   op->trans->out.params.length - 
371                                   (p+12 - op->trans->out.params.data), STR_UNICODE);
372                 SIVAL(p, 8, len);
373
374                 ofs = len + 12;
375
376                 if (ofs & 3) {
377                         int pad = 4 - (ofs & 3);
378                         memset(p+ofs, 0, pad);
379                         ofs += pad;
380                 }
381
382                 if (i == info->nttrans.out.num_changes-1) {
383                         SIVAL(p, 0, 0);
384                 } else {
385                         SIVAL(p, 0, ofs);
386                 }
387
388                 p += ofs;
389         }
390
391         op->trans->out.params.length = p - op->trans->out.params.data;
392
393         return NT_STATUS_OK;
394 }
395
396 /* 
397    parse NTTRANS_NOTIFY_CHANGE request
398  */
399 static NTSTATUS nttrans_notify_change(struct smbsrv_request *req, 
400                                       struct nttrans_op *op)
401 {
402         struct smb_nttrans *trans = op->trans;
403         union smb_notify *info;
404
405         /* should have at least 4 setup words */
406         if (trans->in.setup_count != 4) {
407                 return NT_STATUS_INVALID_PARAMETER;
408         }
409
410         info = talloc(op, union smb_notify);
411         NT_STATUS_HAVE_NO_MEMORY(info);
412
413         info->nttrans.level                     = RAW_NOTIFY_NTTRANS;
414         info->nttrans.in.completion_filter      = IVAL(trans->in.setup, 0);
415         info->nttrans.in.file.ntvfs             = smbsrv_pull_fnum(req, (uint8_t *)trans->in.setup, 4);
416         info->nttrans.in.recursive              = SVAL(trans->in.setup, 6);
417         info->nttrans.in.buffer_size            = trans->in.max_param;
418
419         op->op_info = info;
420         op->send_fn = nttrans_notify_change_send;
421
422         SMBSRV_CHECK_FILE_HANDLE_NTSTATUS(info->nttrans.in.file.ntvfs);
423         return ntvfs_notify(req->ntvfs, info);
424 }
425
426 /*
427   backend for nttrans requests
428 */
429 static NTSTATUS nttrans_backend(struct smbsrv_request *req, 
430                                 struct nttrans_op *op)
431 {
432         /* the nttrans command is in function */
433         switch (op->trans->in.function) {
434         case NT_TRANSACT_CREATE:
435                 return nttrans_create(req, op);
436         case NT_TRANSACT_IOCTL:
437                 return nttrans_ioctl(req, op);
438         case NT_TRANSACT_RENAME:
439                 return nttrans_rename(req, op);
440         case NT_TRANSACT_QUERY_SECURITY_DESC:
441                 return nttrans_query_sec_desc(req, op);
442         case NT_TRANSACT_SET_SECURITY_DESC:
443                 return nttrans_set_sec_desc(req, op);
444         case NT_TRANSACT_NOTIFY_CHANGE:
445                 return nttrans_notify_change(req, op);
446         }
447
448         /* an unknown nttrans command */
449         return NT_STATUS_DOS(ERRSRV, ERRerror);
450 }
451
452
453 static void reply_nttrans_send(struct ntvfs_request *ntvfs)
454 {
455         struct smbsrv_request *req;
456         uint16_t params_left, data_left;
457         uint8_t *params, *data;
458         struct smb_nttrans *trans;
459         struct nttrans_op *op;
460
461         SMBSRV_CHECK_ASYNC_STATUS(op, struct nttrans_op);
462
463         trans = op->trans;
464
465         /* if this function needs work to form the nttrans reply buffer, then
466            call that now */
467         if (op->send_fn != NULL) {
468                 NTSTATUS status;
469                 status = op->send_fn(op);
470                 if (!NT_STATUS_IS_OK(status)) {
471                         smbsrv_send_error(req, status);
472                         return;
473                 }
474         }
475
476         smbsrv_setup_reply(req, 18 + trans->out.setup_count, 0);
477
478         /* note that we don't check the max_setup count (matching w2k3
479            behaviour) */
480
481         if (trans->out.params.length > trans->in.max_param) {
482                 smbsrv_setup_error(req, NT_STATUS_BUFFER_TOO_SMALL);
483                 trans->out.params.length = trans->in.max_param;
484         }
485         if (trans->out.data.length > trans->in.max_data) {
486                 smbsrv_setup_error(req, NT_STATUS_BUFFER_TOO_SMALL);
487                 trans->out.data.length = trans->in.max_data;
488         }
489
490         params_left = trans->out.params.length;
491         data_left   = trans->out.data.length;
492         params      = trans->out.params.data;
493         data        = trans->out.data.data;
494
495         /* we need to divide up the reply into chunks that fit into
496            the negotiated buffer size */
497         do {
498                 uint16_t this_data, this_param, max_bytes;
499                 uint_t align1 = 1, align2 = (params_left ? 2 : 0);
500                 struct smbsrv_request *this_req;
501
502                 max_bytes = req_max_data(req) - (align1 + align2);
503
504                 this_param = params_left;
505                 if (this_param > max_bytes) {
506                         this_param = max_bytes;
507                 }
508                 max_bytes -= this_param;
509
510                 this_data = data_left;
511                 if (this_data > max_bytes) {
512                         this_data = max_bytes;
513                 }
514
515                 /* don't destroy unless this is the last chunk */
516                 if (params_left - this_param != 0 || 
517                     data_left - this_data != 0) {
518                         this_req = smbsrv_setup_secondary_request(req);
519                 } else {
520                         this_req = req;
521                 }
522
523                 req_grow_data(req, this_param + this_data + (align1 + align2));
524
525                 SSVAL(this_req->out.vwv, 0, 0); /* reserved */
526                 SCVAL(this_req->out.vwv, 2, 0); /* reserved */
527                 SIVAL(this_req->out.vwv, 3, trans->out.params.length);
528                 SIVAL(this_req->out.vwv, 7, trans->out.data.length);
529
530                 SIVAL(this_req->out.vwv, 11, this_param);
531                 SIVAL(this_req->out.vwv, 15, align1 + PTR_DIFF(this_req->out.data, this_req->out.hdr));
532                 SIVAL(this_req->out.vwv, 19, PTR_DIFF(params, trans->out.params.data));
533
534                 SIVAL(this_req->out.vwv, 23, this_data);
535                 SIVAL(this_req->out.vwv, 27, align1 + align2 + 
536                       PTR_DIFF(this_req->out.data + this_param, this_req->out.hdr));
537                 SIVAL(this_req->out.vwv, 31, PTR_DIFF(data, trans->out.data.data));
538
539                 SCVAL(this_req->out.vwv, 35, trans->out.setup_count);
540                 memcpy((char *)(this_req->out.vwv) + VWV(18), trans->out.setup,
541                        sizeof(uint16_t) * trans->out.setup_count);
542                 memset(this_req->out.data, 0, align1);
543                 if (this_param != 0) {
544                         memcpy(this_req->out.data + align1, params, this_param);
545                 }
546                 memset(this_req->out.data+this_param+align1, 0, align2);
547                 if (this_data != 0) {
548                         memcpy(this_req->out.data+this_param+align1+align2, 
549                                data, this_data);
550                 }
551
552                 params_left -= this_param;
553                 data_left -= this_data;
554                 params += this_param;
555                 data += this_data;
556
557                 smbsrv_send_reply(this_req);
558         } while (params_left != 0 || data_left != 0);
559 }
560
561
562 /****************************************************************************
563  Reply to an SMBnttrans request
564 ****************************************************************************/
565 void smbsrv_reply_nttrans(struct smbsrv_request *req)
566 {
567         struct nttrans_op *op;
568         struct smb_nttrans *trans;
569         uint16_t param_ofs, data_ofs;
570         uint16_t param_count, data_count;
571         uint16_t param_total, data_total;
572
573         /* parse request */
574         if (req->in.wct < 19) {
575                 smbsrv_send_error(req, NT_STATUS_FOOBAR);
576                 return;
577         }
578
579         SMBSRV_TALLOC_IO_PTR(op, struct nttrans_op);
580         SMBSRV_SETUP_NTVFS_REQUEST(reply_nttrans_send, NTVFS_ASYNC_STATE_MAY_ASYNC);
581
582         trans = talloc(op, struct smb_nttrans);
583         if (trans == NULL) {
584                 smbsrv_send_error(req, NT_STATUS_NO_MEMORY);
585                 return;
586         }
587
588         op->trans = trans;
589         op->op_info = NULL;
590         op->send_fn = NULL;
591
592         trans->in.max_setup  = CVAL(req->in.vwv, 0);
593         param_total          = IVAL(req->in.vwv, 3);
594         data_total           = IVAL(req->in.vwv, 7);
595         trans->in.max_param  = IVAL(req->in.vwv, 11);
596         trans->in.max_data   = IVAL(req->in.vwv, 15);
597         param_count          = IVAL(req->in.vwv, 19);
598         param_ofs            = IVAL(req->in.vwv, 23);
599         data_count           = IVAL(req->in.vwv, 27);
600         data_ofs             = IVAL(req->in.vwv, 31);
601         trans->in.setup_count= CVAL(req->in.vwv, 35);
602         trans->in.function   = SVAL(req->in.vwv, 36);
603
604         if (req->in.wct != 19 + trans->in.setup_count) {
605                 smbsrv_send_error(req, NT_STATUS_DOS(ERRSRV, ERRerror));
606                 return;
607         }
608
609         /* parse out the setup words */
610         trans->in.setup = talloc_array(req, uint8_t, trans->in.setup_count*2);
611         if (!trans->in.setup) {
612                 smbsrv_send_error(req, NT_STATUS_NO_MEMORY);
613                 return;
614         }
615         memcpy(trans->in.setup, (char *)(req->in.vwv) + VWV(19),
616                sizeof(uint16_t) * trans->in.setup_count);
617
618         if (!req_pull_blob(req, req->in.hdr + param_ofs, param_count, &trans->in.params) ||
619             !req_pull_blob(req, req->in.hdr + data_ofs, data_count, &trans->in.data)) {
620                 smbsrv_send_error(req, NT_STATUS_FOOBAR);
621                 return;
622         }
623
624         /* is it a partial request? if so, then send a 'send more' message */
625         if (param_total > param_count ||
626             data_total > data_count) {
627                 DEBUG(0,("REWRITE: not handling partial nttrans requests!\n"));
628                 smbsrv_send_error(req, NT_STATUS_FOOBAR);
629                 return;
630         }
631
632         ZERO_STRUCT(trans->out);
633         SMBSRV_CALL_NTVFS_BACKEND(nttrans_backend(req, op));
634 }
635
636
637 /****************************************************************************
638  Reply to an SMBnttranss request
639 ****************************************************************************/
640 void smbsrv_reply_nttranss(struct smbsrv_request *req)
641 {
642         smbsrv_send_error(req, NT_STATUS_FOOBAR);
643 }