smb2 durable...
authorMichael Adam <obnox@samba.org>
Wed, 22 Feb 2012 16:14:39 +0000 (17:14 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 10 May 2012 16:41:57 +0000 (18:41 +0200)
source3/smbd/smb2_create.c

index fc7ca9fb7711f3d280a7e1c48f8450b7bc207553..e62d881f54bf929c19e06aff024f83e722d7200d 100644 (file)
@@ -25,6 +25,7 @@
 #include "smbd/globals.h"
 #include "../libcli/smb/smb_common.h"
 #include "../librpc/gen_ndr/ndr_security.h"
+#include "libcli/security/security.h"
 #include "../lib/util/tevent_ntstatus.h"
 #include "messages.h"
 #include "librpc/gen_ndr/open_files.h"
@@ -456,8 +457,8 @@ fail:
 }
 
 static NTSTATUS smb2_create_durable_reconnect(struct smbXsrv_open *op,
-                                             /* struct smb_request *smb1req, */
                                              struct connection_struct *conn,
+                                             struct smb_request *smb1req,
                                              struct smb_filename *smb_fname,
                                              TALLOC_CTX *mem_ctx,
                                              files_struct **_fsp)
@@ -526,7 +527,7 @@ DEBUG(0, ("OBNOX - durable_reconnect enter: (%s:%s)\n", __location__, __FUNCTION
        /*
         * circumstances seems ok, do the open
         */
-       status = new_durable_reconnect_fsp(op, conn, smb_fname, mem_ctx, &fsp);
+       status = new_durable_reconnect_fsp(op, conn, smb_fname, conn, &fsp);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
@@ -546,6 +547,24 @@ DEBUG(0, ("OBNOX - durable_reconnect: new fsp created (%s:%s)\n", __location__,
        /* - release the sharemode lock: this writes the changes */
        talloc_free(sharemode_lock);
 
+       fsp->file_id = op->global->backend_file_id;
+       fsp->initial_allocation_size = 0;//TODO
+       fsp->file_pid = 0;//smb1req->pid;
+       fsp->vuid = smb1req->vuid;//
+       //fsp->open_time = 0;//from->open_time;
+       fsp->access_mask = sharemode_lock->data->share_modes[0].access_mask;
+       fsp->share_access = sharemode_lock->data->share_modes[0].share_access;
+       //fsp->oplock_type = sharemode_lock->data->share_modes[0].oplock_type;
+       fsp->can_lock = true;//from->can_lock;
+       fsp->can_read = (fsp->access_mask & (FILE_READ_DATA)) ? True : False;
+       if (!CAN_WRITE(conn)) {
+               fsp->can_write = False;
+       } else {
+               fsp->can_write = (fsp->access_mask & (FILE_WRITE_DATA | FILE_APPEND_DATA)) ? True : False;
+       }
+       fsp->modified = false;//from->modified;
+       fsp->is_directory = false;//from->is_directory;
+       fsp->aio_write_behind = false;//from->aio_write_behind;
 
        /* Q: do this in fsp creation? */
        op->fsp = fsp;
@@ -912,6 +931,7 @@ DEBUG(0, ("OBNOX - dhnc found (%s:%s)\n", __location__, __FUNCTION__));
                if (do_durable_reconnect) {
                        status = smb2_create_durable_reconnect(op,
                                                               smb1req->conn,
+                                                              smb1req,
                                                               smb_fname,
                                                               mem_ctx,
                                                               &result);