r4757: added the ability of the clisocket level of libcli to handle async
[jelmer/samba4-debian.git] / source / ntvfs / cifs / vfs_cifs.c
index 3e9899cb8ca691864f8f27317394d451b1a41730..1a5a5ac042a95cf358bc01eddcd5ca2df85dbe82 100644 (file)
@@ -88,7 +88,7 @@ static void cifs_socket_handler(struct event_context *ev, struct fd_event *fde,
        
        if (!smbcli_transport_process(private->transport)) {
                /* the connection to our server is dead */
-               close_cnum(tcon);
+               talloc_free(tcon);
        }
 }
 
@@ -121,7 +121,7 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
                return NT_STATUS_INVALID_PARAMETER;
        }
        
-       private = talloc(req->tcon, sizeof(struct cvfs_private));
+       private = talloc_p(req->tcon, struct cvfs_private);
        if (!private) {
                return NT_STATUS_NO_MEMORY;
        }
@@ -152,12 +152,12 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
        smbcli_oplock_handler(private->transport, oplock_handler, private);
        smbcli_transport_idle_handler(private->transport, idle_func, 50000, private);
 
-       private->transport->event.fde->handler = cifs_socket_handler;
-       private->transport->event.fde->private = private;
+       private->transport->socket->event.fde->handler = cifs_socket_handler;
+       private->transport->socket->event.fde->private = private;
 
-       private->transport->event.ctx = event_context_merge(tcon->smb_conn->connection->event.ctx,
-                                                           private->transport->event.ctx);
-       talloc_reference(private, private->transport->event.ctx);
+       private->transport->socket->event.ctx = event_context_merge(tcon->smb_conn->connection->event.ctx,
+                                                                   private->transport->socket->event.ctx);
+       talloc_reference(private, private->transport->socket->event.ctx);
        private->map_generic = lp_parm_bool(req->tcon->service, 
                                            "cifs", "mapgeneric", False);
 
@@ -650,6 +650,15 @@ static NTSTATUS cvfs_async_setup(struct ntvfs_module_context *ntvfs,
        return NT_STATUS_OK;
 }
 
+/*
+  cancel an async call
+*/
+static NTSTATUS cvfs_cancel(struct ntvfs_module_context *ntvfs, 
+                           struct smbsrv_request *req)
+{
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
 /*
   lock a byte range
 */
@@ -855,6 +864,7 @@ NTSTATUS ntvfs_cifs_init(void)
        ops.trans = cvfs_trans;
        ops.logoff = cvfs_logoff;
        ops.async_setup = cvfs_async_setup;
+       ops.cancel = cvfs_cancel;
 
        if (lp_parm_bool(-1, "cifs", "maptrans2", False)) {
                ops.trans2 = cvfs_trans2;
@@ -862,7 +872,7 @@ NTSTATUS ntvfs_cifs_init(void)
 
        /* register ourselves with the NTVFS subsystem. We register
           under the name 'cifs'. */
-       ret = register_backend("ntvfs", &ops);
+       ret = ntvfs_register(&ops);
 
        if (!NT_STATUS_IS_OK(ret)) {
                DEBUG(0,("Failed to register CIFS backend!\n"));