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