pass smb2.durable-open.reopen2...:-)
authorStefan Metzmacher <metze@samba.org>
Thu, 23 Feb 2012 07:44:10 +0000 (08:44 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 10 May 2012 16:41:59 +0000 (18:41 +0200)
source3/smbd/smb2_create.c

index 5a6dc3d156dc259bde078a016a8332fc94f9519f..bdc057c5d269592c5de0c792f8fdf550abd32d93 100644 (file)
@@ -461,12 +461,14 @@ static NTSTATUS smb2_create_durable_reconnect(struct smbXsrv_open *op,
                                              struct smb_request *smb1req,
                                              struct smb_filename *smb_fname,
                                              TALLOC_CTX *mem_ctx,
-                                             files_struct **_fsp)
+                                             files_struct **_fsp,
+                                             int *info)
 {
        struct share_mode_lock *sharemode_lock;
        struct share_mode_entry *e;
        files_struct *fsp = NULL;
        NTSTATUS status;
+       bool ok;
 
 DEBUG(0, ("OBNOX - durable_reconnect enter: (%s:%s)\n", __location__, __FUNCTION__));
 
@@ -528,10 +530,6 @@ DEBUG(0, ("OBNOX - durable_reconnect: serverid exists - denying access to durabl
        }
 */
 
-       sharemode_lock->data->share_modes[0].pid =
-               messaging_server_id(op->connection->sconn->msg_ctx);
-       sharemode_lock->data->modified = true;
-
        /*
         * circumstances seems ok, do the open
         */
@@ -543,14 +541,14 @@ DEBUG(0, ("OBNOX - durable_reconnect: failed to create new fsp: %s (%s:%s)\n", n
 
 DEBUG(0, ("OBNOX - durable_reconnect: new fsp created (%s:%s)\n", __location__, __FUNCTION__));
 
+       fsp->fh->private_options = e->private_options;
        fsp->file_id = op->global->backend_file_id;
        fsp->initial_allocation_size = 0;//TODO
        fsp->file_pid = smb1req->smbpid;
        fsp->vuid = smb1req->vuid;//
-       //fsp->open_time = 0;//from->open_time;
+       fsp->open_time = e->time;
        fsp->access_mask = e->access_mask;
        fsp->share_access = e->share_access;
-       fsp->oplock_type = e->op_type;
        fsp->can_lock = true;//from->can_lock;
        fsp->can_read = (fsp->access_mask & (FILE_READ_DATA)) ? True : False;
        if (!CAN_WRITE(conn)) {
@@ -562,8 +560,16 @@ DEBUG(0, ("OBNOX - durable_reconnect: new fsp created (%s:%s)\n", __location__,
        fsp->is_directory = false;//from->is_directory;
        fsp->aio_write_behind = false;//from->aio_write_behind;
 
+       ok = set_file_oplock(fsp, e->op_type);
+
+       sharemode_lock->data->modified = true;
+       e->pid = messaging_server_id(op->connection->sconn->msg_ctx);
+       e->op_mid = smb1req->mid;
+       e->share_file_id = fsp->fh->gen_id;
+
 DEBUG(0, ("OBNOX - durable_reconnect: before open file (%s:%s)\n", __location__, __FUNCTION__));
 
+
        fsp->fh->fd = SMB_VFS_OPEN(conn,
                                   smb_fname,
                                   fsp,
@@ -591,6 +597,8 @@ DEBUG(0, ("OBNOX - durable_reconnect: opened file (%s:%s)\n", __location__, __FU
         *
         * ... think about seek()
         */
+
+       *info = FILE_WAS_OPENED;
        return NT_STATUS_OK;
 }
 
@@ -949,7 +957,8 @@ DEBUG(0, ("OBNOX - dhnc found (%s:%s)\n", __location__, __FUNCTION__));
                                                               smb1req,
                                                               smb_fname,
                                                               mem_ctx,
-                                                              &result);
+                                                              &result,
+                                                              &info);
 
 DEBUG(0, ("OBNOX - durable_reconnect result: %s (%s:%s)\n", nt_errstr(status), __location__, __FUNCTION__));