2 Unix SMB/CIFS implementation.
4 CIFS-on-CIFS NTVFS filesystem backend
6 Copyright (C) Andrew Tridgell 2003
7 Copyright (C) James J Myers 2003 <myersjj@samba.org>
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 2 of the License, or
12 (at your option) any later version.
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.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 this implements a CIFS->CIFS NTVFS filesystem backend.
29 #include "libcli/raw/libcliraw.h"
30 #include "libcli/smb_composite/smb_composite.h"
31 #include "smb_server/smb_server.h"
32 #include "smbd/service_stream.h"
33 #include "auth/auth.h"
34 #include "ntvfs/ntvfs.h"
35 #include "include/dlinklist.h"
37 /* this is stored in ntvfs_private */
39 struct smbcli_tree *tree;
40 struct smbcli_transport *transport;
41 struct smbsrv_tcon *tcon;
42 struct async_info *pending;
47 /* a structure used to pass information to an async handler */
49 struct async_info *next, *prev;
50 struct cvfs_private *cvfs;
51 struct smbsrv_request *req;
52 struct smbcli_request *c_req;
56 #define SETUP_PID private->tree->session->pid = SVAL(req->in.hdr, HDR_PID)
59 a handler for oplock break events from the server - these need to be passed
62 static BOOL oplock_handler(struct smbcli_transport *transport, uint16_t tid, uint16_t fnum, uint8_t level, void *p_private)
64 struct cvfs_private *private = p_private;
66 DEBUG(5,("vfs_cifs: sending oplock break level %d for fnum %d\n", level, fnum));
67 return req_send_oplock_break(private->tcon, fnum, level);
71 connect to a share - used when a tree_connect operation comes in.
73 static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
74 struct smbsrv_request *req, const char *sharename)
76 struct smbsrv_tcon *tcon = req->tcon;
78 struct cvfs_private *private;
79 const char *host, *user, *pass, *domain, *remote_share;
80 struct smb_composite_connect io;
81 struct composite_context *creq;
83 struct cli_credentials *credentials;
86 /* Here we need to determine which server to connect to.
87 * For now we use parametric options, type cifs.
88 * Later we will use security=server and auth_server.c.
90 host = lp_parm_string(req->tcon->service, "cifs", "server");
91 user = lp_parm_string(req->tcon->service, "cifs", "user");
92 pass = lp_parm_string(req->tcon->service, "cifs", "password");
93 domain = lp_parm_string(req->tcon->service, "cifs", "domain");
94 remote_share = lp_parm_string(req->tcon->service, "cifs", "share");
96 remote_share = sharename;
99 machine_account = lp_parm_bool(req->tcon->service, "cifs", "use_machine_account", False);
101 private = talloc_zero(ntvfs, struct cvfs_private);
103 return NT_STATUS_NO_MEMORY;
106 ntvfs->private_data = private;
109 DEBUG(1,("CIFS backend: You must supply server\n"));
110 return NT_STATUS_INVALID_PARAMETER;
114 DEBUG(5, ("CIFS backend: Using specified password\n"));
115 credentials = cli_credentials_init(private);
117 return NT_STATUS_NO_MEMORY;
119 cli_credentials_set_conf(credentials);
120 cli_credentials_set_username(credentials, user, CRED_SPECIFIED);
122 cli_credentials_set_domain(credentials, domain, CRED_SPECIFIED);
124 cli_credentials_set_password(credentials, pass, CRED_SPECIFIED);
125 } else if (machine_account) {
126 DEBUG(5, ("CIFS backend: Using machine account\n"));
127 credentials = cli_credentials_init(private);
128 cli_credentials_set_conf(credentials);
130 cli_credentials_set_domain(credentials, domain, CRED_SPECIFIED);
132 status = cli_credentials_set_machine_account(credentials);
133 if (!NT_STATUS_IS_OK(status)) {
136 } else if (req->session->session_info->credentials) {
137 DEBUG(5, ("CIFS backend: Using delegated credentials\n"));
138 credentials = req->session->session_info->credentials;
140 DEBUG(1,("CIFS backend: You must supply server, user and password and or have delegated credentials\n"));
141 return NT_STATUS_INVALID_PARAMETER;
144 /* connect to the server, using the smbd event context */
145 io.in.dest_host = host;
147 io.in.called_name = host;
148 io.in.credentials = credentials;
149 io.in.fallback_to_anonymous = False;
150 io.in.workgroup = lp_workgroup();
151 io.in.service = remote_share;
152 io.in.service_type = "?????";
154 creq = smb_composite_connect_send(&io, private, tcon->smb_conn->connection->event.ctx);
155 status = smb_composite_connect_recv(creq, private);
156 NT_STATUS_NOT_OK_RETURN(status);
158 private->tree = io.out.tree;
160 private->transport = private->tree->session->transport;
162 private->tcon = req->tcon;
164 tcon->fs_type = talloc_strdup(tcon, "NTFS");
165 tcon->dev_type = talloc_strdup(tcon, "A:");
167 /* we need to receive oplock break requests from the server */
168 smbcli_oplock_handler(private->transport, oplock_handler, private);
170 private->map_generic = lp_parm_bool(req->tcon->service,
171 "cifs", "mapgeneric", False);
177 disconnect from a share
179 static NTSTATUS cvfs_disconnect(struct ntvfs_module_context *ntvfs,
180 struct smbsrv_tcon *tcon)
182 struct cvfs_private *private = ntvfs->private_data;
184 talloc_free(private);
185 ntvfs->private_data = NULL;
191 destroy an async info structure
193 static int async_info_destructor(void *p)
195 struct async_info *async = talloc_get_type(p, struct async_info);
196 DLIST_REMOVE(async->cvfs->pending, async);
201 a handler for simple async replies
202 this handler can only be used for functions that don't return any
203 parameters (those that just return a status code)
205 static void async_simple(struct smbcli_request *c_req)
207 struct async_info *async = c_req->async.private;
208 struct smbsrv_request *req = async->req;
209 req->async_states->status = smbcli_request_simple_recv(c_req);
210 req->async_states->send_fn(req);
214 /* save some typing for the simple functions */
215 #define ASYNC_RECV_TAIL(io, async_fn) do { \
216 if (!c_req) return NT_STATUS_UNSUCCESSFUL; \
218 struct async_info *async; \
219 async = talloc(req, struct async_info); \
220 if (!async) return NT_STATUS_NO_MEMORY; \
223 async->cvfs = private; \
224 async->c_req = c_req; \
225 DLIST_ADD(private->pending, async); \
226 c_req->async.private = async; \
227 talloc_set_destructor(async, async_info_destructor); \
229 c_req->async.fn = async_fn; \
230 req->async_states->state |= NTVFS_ASYNC_STATE_ASYNC; \
231 return NT_STATUS_OK; \
234 #define SIMPLE_ASYNC_TAIL ASYNC_RECV_TAIL(NULL, async_simple)
237 delete a file - the dirtype specifies the file types to include in the search.
238 The name can contain CIFS wildcards, but rarely does (except with OS/2 clients)
240 static NTSTATUS cvfs_unlink(struct ntvfs_module_context *ntvfs,
241 struct smbsrv_request *req, struct smb_unlink *unl)
243 struct cvfs_private *private = ntvfs->private_data;
244 struct smbcli_request *c_req;
248 /* see if the front end will allow us to perform this
249 function asynchronously. */
250 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
251 return smb_raw_unlink(private->tree, unl);
254 c_req = smb_raw_unlink_send(private->tree, unl);
260 a handler for async ioctl replies
262 static void async_ioctl(struct smbcli_request *c_req)
264 struct async_info *async = c_req->async.private;
265 struct smbsrv_request *req = async->req;
266 req->async_states->status = smb_raw_ioctl_recv(c_req, req, async->parms);
267 req->async_states->send_fn(req);
273 static NTSTATUS cvfs_ioctl(struct ntvfs_module_context *ntvfs,
274 struct smbsrv_request *req, union smb_ioctl *io)
276 struct cvfs_private *private = ntvfs->private_data;
277 struct smbcli_request *c_req;
281 /* see if the front end will allow us to perform this
282 function asynchronously. */
283 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
284 return smb_raw_ioctl(private->tree, req, io);
287 c_req = smb_raw_ioctl_send(private->tree, io);
289 ASYNC_RECV_TAIL(io, async_ioctl);
293 check if a directory exists
295 static NTSTATUS cvfs_chkpath(struct ntvfs_module_context *ntvfs,
296 struct smbsrv_request *req, struct smb_chkpath *cp)
298 struct cvfs_private *private = ntvfs->private_data;
299 struct smbcli_request *c_req;
303 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
304 return smb_raw_chkpath(private->tree, cp);
307 c_req = smb_raw_chkpath_send(private->tree, cp);
313 a handler for async qpathinfo replies
315 static void async_qpathinfo(struct smbcli_request *c_req)
317 struct async_info *async = c_req->async.private;
318 struct smbsrv_request *req = async->req;
319 req->async_states->status = smb_raw_pathinfo_recv(c_req, req, async->parms);
320 req->async_states->send_fn(req);
324 return info on a pathname
326 static NTSTATUS cvfs_qpathinfo(struct ntvfs_module_context *ntvfs,
327 struct smbsrv_request *req, union smb_fileinfo *info)
329 struct cvfs_private *private = ntvfs->private_data;
330 struct smbcli_request *c_req;
334 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
335 return smb_raw_pathinfo(private->tree, req, info);
338 c_req = smb_raw_pathinfo_send(private->tree, info);
340 ASYNC_RECV_TAIL(info, async_qpathinfo);
344 a handler for async qfileinfo replies
346 static void async_qfileinfo(struct smbcli_request *c_req)
348 struct async_info *async = c_req->async.private;
349 struct smbsrv_request *req = async->req;
350 req->async_states->status = smb_raw_fileinfo_recv(c_req, req, async->parms);
351 req->async_states->send_fn(req);
355 query info on a open file
357 static NTSTATUS cvfs_qfileinfo(struct ntvfs_module_context *ntvfs,
358 struct smbsrv_request *req, union smb_fileinfo *info)
360 struct cvfs_private *private = ntvfs->private_data;
361 struct smbcli_request *c_req;
365 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
366 return smb_raw_fileinfo(private->tree, req, info);
369 c_req = smb_raw_fileinfo_send(private->tree, info);
371 ASYNC_RECV_TAIL(info, async_qfileinfo);
376 set info on a pathname
378 static NTSTATUS cvfs_setpathinfo(struct ntvfs_module_context *ntvfs,
379 struct smbsrv_request *req, union smb_setfileinfo *st)
381 struct cvfs_private *private = ntvfs->private_data;
382 struct smbcli_request *c_req;
386 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
387 return smb_raw_setpathinfo(private->tree, st);
390 c_req = smb_raw_setpathinfo_send(private->tree, st);
397 a handler for async open replies
399 static void async_open(struct smbcli_request *c_req)
401 struct async_info *async = c_req->async.private;
402 struct smbsrv_request *req = async->req;
403 req->async_states->status = smb_raw_open_recv(c_req, req, async->parms);
404 req->async_states->send_fn(req);
410 static NTSTATUS cvfs_open(struct ntvfs_module_context *ntvfs,
411 struct smbsrv_request *req, union smb_open *io)
413 struct cvfs_private *private = ntvfs->private_data;
414 struct smbcli_request *c_req;
418 if (io->generic.level != RAW_OPEN_GENERIC &&
419 private->map_generic) {
420 return ntvfs_map_open(req, io, ntvfs);
423 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
424 return smb_raw_open(private->tree, req, io);
427 c_req = smb_raw_open_send(private->tree, io);
429 ASYNC_RECV_TAIL(io, async_open);
435 static NTSTATUS cvfs_mkdir(struct ntvfs_module_context *ntvfs,
436 struct smbsrv_request *req, union smb_mkdir *md)
438 struct cvfs_private *private = ntvfs->private_data;
439 struct smbcli_request *c_req;
443 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
444 return smb_raw_mkdir(private->tree, md);
447 c_req = smb_raw_mkdir_send(private->tree, md);
455 static NTSTATUS cvfs_rmdir(struct ntvfs_module_context *ntvfs,
456 struct smbsrv_request *req, struct smb_rmdir *rd)
458 struct cvfs_private *private = ntvfs->private_data;
459 struct smbcli_request *c_req;
463 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
464 return smb_raw_rmdir(private->tree, rd);
466 c_req = smb_raw_rmdir_send(private->tree, rd);
472 rename a set of files
474 static NTSTATUS cvfs_rename(struct ntvfs_module_context *ntvfs,
475 struct smbsrv_request *req, union smb_rename *ren)
477 struct cvfs_private *private = ntvfs->private_data;
478 struct smbcli_request *c_req;
482 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
483 return smb_raw_rename(private->tree, ren);
486 c_req = smb_raw_rename_send(private->tree, ren);
494 static NTSTATUS cvfs_copy(struct ntvfs_module_context *ntvfs,
495 struct smbsrv_request *req, struct smb_copy *cp)
497 return NT_STATUS_NOT_SUPPORTED;
501 a handler for async read replies
503 static void async_read(struct smbcli_request *c_req)
505 struct async_info *async = c_req->async.private;
506 struct smbsrv_request *req = async->req;
507 req->async_states->status = smb_raw_read_recv(c_req, async->parms);
508 req->async_states->send_fn(req);
514 static NTSTATUS cvfs_read(struct ntvfs_module_context *ntvfs,
515 struct smbsrv_request *req, union smb_read *rd)
517 struct cvfs_private *private = ntvfs->private_data;
518 struct smbcli_request *c_req;
522 if (rd->generic.level != RAW_READ_GENERIC &&
523 private->map_generic) {
524 return ntvfs_map_read(req, rd, ntvfs);
527 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
528 return smb_raw_read(private->tree, rd);
531 c_req = smb_raw_read_send(private->tree, rd);
533 ASYNC_RECV_TAIL(rd, async_read);
537 a handler for async write replies
539 static void async_write(struct smbcli_request *c_req)
541 struct async_info *async = c_req->async.private;
542 struct smbsrv_request *req = async->req;
543 req->async_states->status = smb_raw_write_recv(c_req, async->parms);
544 req->async_states->send_fn(req);
550 static NTSTATUS cvfs_write(struct ntvfs_module_context *ntvfs,
551 struct smbsrv_request *req, union smb_write *wr)
553 struct cvfs_private *private = ntvfs->private_data;
554 struct smbcli_request *c_req;
558 if (wr->generic.level != RAW_WRITE_GENERIC &&
559 private->map_generic) {
560 return ntvfs_map_write(req, wr, ntvfs);
563 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
564 return smb_raw_write(private->tree, wr);
567 c_req = smb_raw_write_send(private->tree, wr);
569 ASYNC_RECV_TAIL(wr, async_write);
573 a handler for async seek replies
575 static void async_seek(struct smbcli_request *c_req)
577 struct async_info *async = c_req->async.private;
578 struct smbsrv_request *req = async->req;
579 req->async_states->status = smb_raw_seek_recv(c_req, async->parms);
580 req->async_states->send_fn(req);
586 static NTSTATUS cvfs_seek(struct ntvfs_module_context *ntvfs,
587 struct smbsrv_request *req, struct smb_seek *io)
589 struct cvfs_private *private = ntvfs->private_data;
590 struct smbcli_request *c_req;
594 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
595 return smb_raw_seek(private->tree, io);
598 c_req = smb_raw_seek_send(private->tree, io);
600 ASYNC_RECV_TAIL(io, async_seek);
606 static NTSTATUS cvfs_flush(struct ntvfs_module_context *ntvfs,
607 struct smbsrv_request *req, struct smb_flush *io)
609 struct cvfs_private *private = ntvfs->private_data;
610 struct smbcli_request *c_req;
614 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
615 return smb_raw_flush(private->tree, io);
618 c_req = smb_raw_flush_send(private->tree, io);
626 static NTSTATUS cvfs_close(struct ntvfs_module_context *ntvfs,
627 struct smbsrv_request *req, union smb_close *io)
629 struct cvfs_private *private = ntvfs->private_data;
630 struct smbcli_request *c_req;
634 if (io->generic.level != RAW_CLOSE_GENERIC &&
635 private->map_generic) {
636 return ntvfs_map_close(req, io, ntvfs);
639 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
640 return smb_raw_close(private->tree, io);
643 c_req = smb_raw_close_send(private->tree, io);
649 exit - closing files open by the pid
651 static NTSTATUS cvfs_exit(struct ntvfs_module_context *ntvfs,
652 struct smbsrv_request *req)
654 struct cvfs_private *private = ntvfs->private_data;
655 struct smbcli_request *c_req;
659 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
660 return smb_raw_exit(private->tree->session);
663 c_req = smb_raw_exit_send(private->tree->session);
669 logoff - closing files open by the user
671 static NTSTATUS cvfs_logoff(struct ntvfs_module_context *ntvfs,
672 struct smbsrv_request *req)
674 /* we can't do this right in the cifs backend .... */
679 setup for an async call - nothing to do yet
681 static NTSTATUS cvfs_async_setup(struct ntvfs_module_context *ntvfs,
682 struct smbsrv_request *req,
691 static NTSTATUS cvfs_cancel(struct ntvfs_module_context *ntvfs,
692 struct smbsrv_request *req)
694 struct cvfs_private *private = ntvfs->private_data;
696 /* find the matching request */
697 struct async_info *a;
698 for (a=private->pending;a;a=a->next) {
699 if (SVAL(a->req->in.hdr, HDR_MID) == SVAL(req->in.hdr, HDR_MID)) {
705 return NT_STATUS_INVALID_PARAMETER;
708 return smb_raw_ntcancel(a->c_req);
714 static NTSTATUS cvfs_lock(struct ntvfs_module_context *ntvfs,
715 struct smbsrv_request *req, union smb_lock *lck)
717 struct cvfs_private *private = ntvfs->private_data;
718 struct smbcli_request *c_req;
722 if (lck->generic.level != RAW_LOCK_GENERIC &&
723 private->map_generic) {
724 return ntvfs_map_lock(req, lck, ntvfs);
727 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
728 return smb_raw_lock(private->tree, lck);
731 c_req = smb_raw_lock_send(private->tree, lck);
736 set info on a open file
738 static NTSTATUS cvfs_setfileinfo(struct ntvfs_module_context *ntvfs,
739 struct smbsrv_request *req,
740 union smb_setfileinfo *info)
742 struct cvfs_private *private = ntvfs->private_data;
743 struct smbcli_request *c_req;
747 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
748 return smb_raw_setfileinfo(private->tree, info);
750 c_req = smb_raw_setfileinfo_send(private->tree, info);
757 a handler for async fsinfo replies
759 static void async_fsinfo(struct smbcli_request *c_req)
761 struct async_info *async = c_req->async.private;
762 struct smbsrv_request *req = async->req;
763 req->async_states->status = smb_raw_fsinfo_recv(c_req, req, async->parms);
764 req->async_states->send_fn(req);
768 return filesystem space info
770 static NTSTATUS cvfs_fsinfo(struct ntvfs_module_context *ntvfs,
771 struct smbsrv_request *req, union smb_fsinfo *fs)
773 struct cvfs_private *private = ntvfs->private_data;
774 struct smbcli_request *c_req;
778 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
779 return smb_raw_fsinfo(private->tree, req, fs);
782 c_req = smb_raw_fsinfo_send(private->tree, req, fs);
784 ASYNC_RECV_TAIL(fs, async_fsinfo);
788 return print queue info
790 static NTSTATUS cvfs_lpq(struct ntvfs_module_context *ntvfs,
791 struct smbsrv_request *req, union smb_lpq *lpq)
793 return NT_STATUS_NOT_SUPPORTED;
797 list files in a directory matching a wildcard pattern
799 static NTSTATUS cvfs_search_first(struct ntvfs_module_context *ntvfs,
800 struct smbsrv_request *req, union smb_search_first *io,
801 void *search_private,
802 BOOL (*callback)(void *, union smb_search_data *))
804 struct cvfs_private *private = ntvfs->private_data;
808 return smb_raw_search_first(private->tree, req, io, search_private, callback);
811 /* continue a search */
812 static NTSTATUS cvfs_search_next(struct ntvfs_module_context *ntvfs,
813 struct smbsrv_request *req, union smb_search_next *io,
814 void *search_private,
815 BOOL (*callback)(void *, union smb_search_data *))
817 struct cvfs_private *private = ntvfs->private_data;
821 return smb_raw_search_next(private->tree, req, io, search_private, callback);
825 static NTSTATUS cvfs_search_close(struct ntvfs_module_context *ntvfs,
826 struct smbsrv_request *req, union smb_search_close *io)
828 struct cvfs_private *private = ntvfs->private_data;
832 return smb_raw_search_close(private->tree, io);
836 a handler for async trans2 replies
838 static void async_trans2(struct smbcli_request *c_req)
840 struct async_info *async = c_req->async.private;
841 struct smbsrv_request *req = async->req;
842 req->async_states->status = smb_raw_trans2_recv(c_req, req, async->parms);
843 req->async_states->send_fn(req);
847 static NTSTATUS cvfs_trans2(struct ntvfs_module_context *ntvfs,
848 struct smbsrv_request *req, struct smb_trans2 *trans2)
850 struct cvfs_private *private = ntvfs->private_data;
851 struct smbcli_request *c_req;
855 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
856 return smb_raw_trans2(private->tree, req, trans2);
859 c_req = smb_raw_trans2_send(private->tree, trans2);
861 ASYNC_RECV_TAIL(trans2, async_trans2);
865 /* SMBtrans - not used on file shares */
866 static NTSTATUS cvfs_trans(struct ntvfs_module_context *ntvfs,
867 struct smbsrv_request *req, struct smb_trans2 *trans2)
869 return NT_STATUS_ACCESS_DENIED;
873 a handler for async change notify replies
875 static void async_changenotify(struct smbcli_request *c_req)
877 struct async_info *async = c_req->async.private;
878 struct smbsrv_request *req = async->req;
879 req->async_states->status = smb_raw_changenotify_recv(c_req, req, async->parms);
880 req->async_states->send_fn(req);
883 /* change notify request - always async */
884 static NTSTATUS cvfs_notify(struct ntvfs_module_context *ntvfs,
885 struct smbsrv_request *req, struct smb_notify *info)
887 struct cvfs_private *private = ntvfs->private_data;
888 struct smbcli_request *c_req;
892 /* this request doesn't make sense unless its async */
893 if (!(req->async_states->state & NTVFS_ASYNC_STATE_MAY_ASYNC)) {
894 return NT_STATUS_INVALID_PARAMETER;
897 c_req = smb_raw_changenotify_send(private->tree, info);
899 ASYNC_RECV_TAIL(info, async_changenotify);
903 initialise the CIFS->CIFS backend, registering ourselves with the ntvfs subsystem
905 NTSTATUS ntvfs_cifs_init(void)
908 struct ntvfs_ops ops;
912 /* fill in the name and type */
914 ops.type = NTVFS_DISK;
916 /* fill in all the operations */
917 ops.connect = cvfs_connect;
918 ops.disconnect = cvfs_disconnect;
919 ops.unlink = cvfs_unlink;
920 ops.chkpath = cvfs_chkpath;
921 ops.qpathinfo = cvfs_qpathinfo;
922 ops.setpathinfo = cvfs_setpathinfo;
923 ops.openfile = cvfs_open;
924 ops.mkdir = cvfs_mkdir;
925 ops.rmdir = cvfs_rmdir;
926 ops.rename = cvfs_rename;
927 ops.copy = cvfs_copy;
928 ops.ioctl = cvfs_ioctl;
929 ops.read = cvfs_read;
930 ops.write = cvfs_write;
931 ops.seek = cvfs_seek;
932 ops.flush = cvfs_flush;
933 ops.close = cvfs_close;
934 ops.exit = cvfs_exit;
935 ops.lock = cvfs_lock;
936 ops.setfileinfo = cvfs_setfileinfo;
937 ops.qfileinfo = cvfs_qfileinfo;
938 ops.fsinfo = cvfs_fsinfo;
940 ops.search_first = cvfs_search_first;
941 ops.search_next = cvfs_search_next;
942 ops.search_close = cvfs_search_close;
943 ops.trans = cvfs_trans;
944 ops.logoff = cvfs_logoff;
945 ops.async_setup = cvfs_async_setup;
946 ops.cancel = cvfs_cancel;
947 ops.notify = cvfs_notify;
949 if (lp_parm_bool(-1, "cifs", "maptrans2", False)) {
950 ops.trans2 = cvfs_trans2;
953 /* register ourselves with the NTVFS subsystem. We register
954 under the name 'cifs'. */
955 ret = ntvfs_register(&ops);
957 if (!NT_STATUS_IS_OK(ret)) {
958 DEBUG(0,("Failed to register CIFS backend!\n"));