DOES NOT COMPILE - call file_new and SMB_VFS_OPEN
authorMichael Adam <obnox@samba.org>
Tue, 14 Feb 2012 00:02:52 +0000 (01:02 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 10 May 2012 16:41:47 +0000 (18:41 +0200)
source3/smbd/smb2_create.c

index 91f1659a87c280d676fe2418643b8dc199843520..feae4bdf4e0e0f23e83e8c870df70d0716280cca 100644 (file)
@@ -391,10 +391,12 @@ static void smbd_smb2_request_create_done(struct tevent_req *tsubreq)
 }
 
 static NTSTATUS smb2_create_durable_reconnect(struct smbXsrv_open *op,
+                                             struct smb_request *smb1req,
                                              TALLOC_CTX *mem_ctx,
                                              files_struct **fsp)
 {
        struct share_mode_lock *sharemode_lock;
+       files_struct *fsp = NULL;
 
        /* 1. check entry in locking.tdb */
 
@@ -446,9 +448,20 @@ static NTSTATUS smb2_create_durable_reconnect(struct smbXsrv_open *op,
                messaging_server_id(op->connection->sconn->msg_ctx);
 
        /*
-        * - reopen the file with SMB_VFS_OPEN()
-        * - build a files_struct
+        * is file_new() appropriate?
+        * or do we need a replacement for this special purpose?
         */
+       status = file_new(smb1req, smb1req->conn, &fsp);
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       /* TODO */
+       fsp->fh->fd = SMB_VFS_OPEN(smb1req->conn, smb_fname, fsp, flags, mode);
+       if (fsp->fh->fd == -1) {
+               /* ... */
+               return ...;
+       }
 
        /* - release the sharemode lock */
        talloc_free(sharemode_lock);
@@ -713,7 +726,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
                        }
 
                        // TODO: implement this function..
-                       status = smb2_create_durable_reconnect(op, mem_ctx, &result);
+                       status = smb2_create_durable_reconnect(op, smb1req, mem_ctx, &result);
 
                        if (!NT_STATUS_IS_OK(status)) {
                                tevent_req_nterror(req, status);