UNFINISHED - move the call to durable reconnect further down,
authorMichael Adam <obnox@samba.org>
Fri, 17 Feb 2012 16:49:54 +0000 (17:49 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 10 May 2012 16:41:48 +0000 (18:41 +0200)
in parallel to the SMB_VFS_CREATE() call. We need some info
(like smb_fname).

source3/smbd/smb2_create.c

index a1cf124fe2fc5f796099b47fa17cc3330e6b0ec4..06336c60c33a9389dd6c487fdf509ce0aee5fb99 100644 (file)
@@ -575,6 +575,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
        struct timespec write_time_ts;
        struct smb2_create_blobs out_context_blobs;
        int requested_oplock_level;
+       bool do_durable_reconnect = false;
 
        ZERO_STRUCT(out_context_blobs);
 
@@ -782,18 +783,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
                                return tevent_req_post(req, ev);
                        }
 
-                       // TODO: implement this function..
-                       status = smb2_create_durable_reconnect(op, smb1req, mem_ctx, &result);
-
-                       if (!NT_STATUS_IS_OK(status)) {
-                               tevent_req_nterror(req, status);
-                               return tevent_req_post(req, ev);
-                       }
-
-                       // TODO: response construction
-
-                       tevent_req_done(req);
-                       return tevent_req_post(req, ev);
+                       do_durable_reconnect = true;
                }
 
                if (alsi) {
@@ -882,28 +872,50 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
 
                in_file_attributes &= ~FILE_FLAG_POSIX_SEMANTICS;
 
-               status = SMB_VFS_CREATE_FILE(smb1req->conn,
-                                            smb1req,
-                                            0, /* root_dir_fid */
-                                            smb_fname,
-                                            in_desired_access,
-                                            in_share_access,
-                                            in_create_disposition,
-                                            in_create_options,
-                                            in_file_attributes,
-                                            map_smb2_oplock_levels_to_samba(requested_oplock_level),
-                                            allocation_size,
-                                            0, /* private_flags */
-                                            sec_desc,
-                                            ea_list,
-                                            &result,
-                                            &info);
-               if (!NT_STATUS_IS_OK(status)) {
-                       if (open_was_deferred(smb1req->sconn, smb1req->mid)) {
-                               return req;
+               /*
+                * For the backend file open procedure, there are
+                * two possible modes: durable_reconnect or not.
+                */
+               if (do_durable_reconnect) {
+                       status = smb2_create_durable_reconnect(op,
+                                                              smb1req,
+                                                              smb_fname,
+                                                              mem_ctx,
+                                                              &result);
+
+                       if (!NT_STATUS_IS_OK(status)) {
+                               tevent_req_nterror(req, status);
+                               return tevent_req_post(req, ev);
                        }
-                       tevent_req_nterror(req, status);
+
+                       // TODO: response construction
+
+                       tevent_req_done(req);
                        return tevent_req_post(req, ev);
+               } else {
+                       status = SMB_VFS_CREATE_FILE(smb1req->conn,
+                                                    smb1req,
+                                                    0, /* root_dir_fid */
+                                                    smb_fname,
+                                                    in_desired_access,
+                                                    in_share_access,
+                                                    in_create_disposition,
+                                                    in_create_options,
+                                                    in_file_attributes,
+                                                    map_smb2_oplock_levels_to_samba(requested_oplock_level),
+                                                    allocation_size,
+                                                    0, /* private_flags */
+                                                    sec_desc,
+                                                    ea_list,
+                                                    &result,
+                                                    &info);
+                       if (!NT_STATUS_IS_OK(status)) {
+                               if (open_was_deferred(smb1req->sconn, smb1req->mid)) {
+                                       return req;
+                               }
+                               tevent_req_nterror(req, status);
+                               return tevent_req_post(req, ev);
+                       }
                }
 
                if (mxac) {