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