[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Sat Jun 9 17:11:05 MDT 2012


The branch, master has been updated
       via  046dacc s3:smb2_ioctl: make use of file_fsp_smb2()
       via  7753a4a s3:smb2_lock: make use of file_fsp_smb2()
       via  951c5a6 s3:smb2_write: make use of file_fsp_smb2()
       via  564e618 s3:smb2_read: make use of file_fsp_smb2()
       via  0bf3b8a s3:smb2_notify: make use of file_fsp_smb2()
       via  26f37cb s3:smb2_setinfo: make use of file_fsp_smb2()
       via  4bc10b5 s3:smb2_getinfo: make use of file_fsp_smb2()
       via  4dfadfc s3:smb2_find: make use of file_fsp_smb2()
       via  3909ad4 s3:smb2_break: make use of file_fsp_smb2()
       via  2bb6a9e s3:smb2_close: make use of file_fsp_smb2()
       via  9e1e656 s3:smb2_flush: make use of file_fsp_smb2()
       via  2a804a3 s3:smbd: add file_fsp_smb2()
      from  7256405 s3:smb2_write: pass fsp->fnum to init_strict_lock_struct()

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 046daccba59a14ea9bb3827a829529ab20d22656
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jun 8 12:12:59 2012 +0200

    s3:smb2_ioctl: make use of file_fsp_smb2()
    
    metze
    
    Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(master): Sun Jun 10 01:10:15 CEST 2012 on sn-devel-104

commit 7753a4a01b53365cf52d09cd2cb6a62b131d0845
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jun 8 11:57:21 2012 +0200

    s3:smb2_lock: make use of file_fsp_smb2()
    
    metze

commit 951c5a6455f726bdc13bc00300b38bfc32f28c81
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jun 8 11:47:05 2012 +0200

    s3:smb2_write: make use of file_fsp_smb2()
    
    metze

commit 564e618e9f4b8947f070fa41b06e6f04257529aa
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jun 8 11:24:02 2012 +0200

    s3:smb2_read: make use of file_fsp_smb2()
    
    metze

commit 0bf3b8a09ca7a35cd42ea19d7d0bf8f2645c5b80
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jun 8 11:05:58 2012 +0200

    s3:smb2_notify: make use of file_fsp_smb2()
    
    metze

commit 26f37cba82e15872ce2b80044afd11b344b0f9c9
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jun 8 10:54:46 2012 +0200

    s3:smb2_setinfo: make use of file_fsp_smb2()
    
    metze

commit 4bc10b5b72db0b874ce8171386ca9d66d973fe3c
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jun 8 10:46:13 2012 +0200

    s3:smb2_getinfo: make use of file_fsp_smb2()
    
    metze

commit 4dfadfc61d2f860847dcbde100127d7b6cd9d06d
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jun 8 10:42:43 2012 +0200

    s3:smb2_find: make use of file_fsp_smb2()
    
    metze

commit 3909ad4690b75ebcfa8c9060435961d7a71e28a6
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jun 8 10:36:24 2012 +0200

    s3:smb2_break: make use of file_fsp_smb2()
    
    metze

commit 2bb6a9e07fd02594987aa33ce21e5bfb5e541193
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jun 8 10:31:58 2012 +0200

    s3:smb2_close: make use of file_fsp_smb2()
    
    metze

commit 9e1e656c603e2a80c3261b6a87e285c19821757b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jun 8 10:14:45 2012 +0200

    s3:smb2_flush: make use of file_fsp_smb2()
    
    metze

commit 2a804a359af5bb171afc0d04bb91e48601b8c067
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jun 8 10:11:57 2012 +0200

    s3:smbd: add file_fsp_smb2()
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 source3/smbd/files.c        |   43 +++++++++++++++++++++++++++++++++++++++++
 source3/smbd/proto.h        |    3 ++
 source3/smbd/smb2_break.c   |   45 ++++++++++++------------------------------
 source3/smbd/smb2_close.c   |   45 ++++++++++++++----------------------------
 source3/smbd/smb2_find.c    |   35 ++++++++------------------------
 source3/smbd/smb2_flush.c   |   35 ++++++++------------------------
 source3/smbd/smb2_getinfo.c |   41 +++++++++++---------------------------
 source3/smbd/smb2_ioctl.c   |   42 +++++++++++----------------------------
 source3/smbd/smb2_lock.c    |   42 +++++++++++----------------------------
 source3/smbd/smb2_notify.c  |   35 ++++++++------------------------
 source3/smbd/smb2_read.c    |   40 ++++++++++---------------------------
 source3/smbd/smb2_setinfo.c |   41 +++++++++++---------------------------
 source3/smbd/smb2_write.c   |   35 ++++++++------------------------
 13 files changed, 169 insertions(+), 313 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index 1fe5596..50ce1b5 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -581,6 +581,49 @@ files_struct *file_fsp(struct smb_request *req, uint16 fid)
 	return fsp;
 }
 
+struct files_struct *file_fsp_smb2(struct smbd_smb2_request *smb2req,
+				   uint64_t persistent_id,
+				   uint64_t volatile_id)
+{
+	struct files_struct *fsp;
+
+	if (smb2req->compat_chain_fsp != NULL) {
+		return smb2req->compat_chain_fsp;
+	}
+
+	if (persistent_id != volatile_id) {
+		return NULL;
+	}
+
+	if (volatile_id > UINT16_MAX) {
+		return NULL;
+	}
+
+	fsp = file_fnum(smb2req->sconn, (uint16_t)volatile_id);
+	if (fsp == NULL) {
+		return NULL;
+	}
+
+	if (smb2req->tcon == NULL) {
+		return NULL;
+	}
+
+	if (smb2req->tcon->compat_conn != fsp->conn) {
+		return NULL;
+	}
+
+	if (smb2req->session == NULL) {
+		return NULL;
+	}
+
+	if (smb2req->session->vuid != fsp->vuid) {
+		return NULL;
+	}
+
+	smb2req->compat_chain_fsp = fsp;
+	return fsp;
+}
+
 /****************************************************************************
  Duplicate the file handle part for a DOS or FCB open.
 ****************************************************************************/
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index d81feef..e7bc3eb 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -387,6 +387,9 @@ bool file_find_subpath(files_struct *dir_fsp);
 void file_sync_all(connection_struct *conn);
 void file_free(struct smb_request *req, files_struct *fsp);
 files_struct *file_fsp(struct smb_request *req, uint16 fid);
+struct files_struct *file_fsp_smb2(struct smbd_smb2_request *smb2req,
+				   uint64_t persistent_id,
+				   uint64_t volatile_id);
 NTSTATUS dup_file_fsp(struct smb_request *req, files_struct *from,
 		      uint32 access_mask, uint32 share_access,
 		      uint32 create_options, files_struct *to);
diff --git a/source3/smbd/smb2_break.c b/source3/smbd/smb2_break.c
index 310b24b..75505e5 100644
--- a/source3/smbd/smb2_break.c
+++ b/source3/smbd/smb2_break.c
@@ -28,8 +28,8 @@
 static struct tevent_req *smbd_smb2_oplock_break_send(TALLOC_CTX *mem_ctx,
 						      struct tevent_context *ev,
 						      struct smbd_smb2_request *smb2req,
-						      uint8_t in_oplock_level,
-						      uint64_t in_file_id_volatile);
+						      struct files_struct *in_fsp,
+						      uint8_t in_oplock_level);
 static NTSTATUS smbd_smb2_oplock_break_recv(struct tevent_req *req,
 					    uint8_t *out_oplock_level);
 
@@ -42,6 +42,7 @@ NTSTATUS smbd_smb2_request_process_break(struct smbd_smb2_request *req)
 	uint8_t in_oplock_level;
 	uint64_t in_file_id_persistent;
 	uint64_t in_file_id_volatile;
+	struct files_struct *in_fsp;
 	struct tevent_req *subreq;
 
 	status = smbd_smb2_request_verify_sizes(req, 0x18);
@@ -62,17 +63,13 @@ NTSTATUS smbd_smb2_request_process_break(struct smbd_smb2_request *req)
 	in_file_id_persistent		= BVAL(inbody, 0x08);
 	in_file_id_volatile		= BVAL(inbody, 0x10);
 
-	if (req->compat_chain_fsp) {
-		/* skip check */
-	} else if (in_file_id_persistent != in_file_id_volatile) {
+	in_fsp = file_fsp_smb2(req, in_file_id_persistent, in_file_id_volatile);
+	if (in_fsp == NULL) {
 		return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
 	}
 
-	subreq = smbd_smb2_oplock_break_send(req,
-					     req->sconn->ev_ctx,
-					     req,
-					     in_oplock_level,
-					     in_file_id_volatile);
+	subreq = smbd_smb2_oplock_break_send(req, req->sconn->ev_ctx,
+					     req, in_fsp, in_oplock_level);
 	if (subreq == NULL) {
 		return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
 	}
@@ -148,14 +145,12 @@ struct smbd_smb2_oplock_break_state {
 static struct tevent_req *smbd_smb2_oplock_break_send(TALLOC_CTX *mem_ctx,
 						      struct tevent_context *ev,
 						      struct smbd_smb2_request *smb2req,
-						      uint8_t in_oplock_level,
-						      uint64_t in_file_id_volatile)
+						      struct files_struct *fsp,
+						      uint8_t in_oplock_level)
 {
 	struct tevent_req *req;
 	struct smbd_smb2_oplock_break_state *state;
 	struct smb_request *smbreq;
-	connection_struct *conn = smb2req->tcon->compat_conn;
-	files_struct *fsp = NULL;
 	int oplocklevel = map_smb2_oplock_levels_to_samba(in_oplock_level);
 	bool break_to_none = (oplocklevel == NO_OPLOCK);
 	bool result;
@@ -168,30 +163,16 @@ static struct tevent_req *smbd_smb2_oplock_break_send(TALLOC_CTX *mem_ctx,
 	state->smb2req = smb2req;
 	state->out_oplock_level = SMB2_OPLOCK_LEVEL_NONE;
 
-	DEBUG(10,("smbd_smb2_oplock_break_send: file_id[0x%016llX] "
-		"samba level %d\n",
-		(unsigned long long)in_file_id_volatile,
-		oplocklevel));
+	DEBUG(10,("smbd_smb2_oplock_break_send: %s - fnum[%d] "
+		  "samba level %d\n",
+		  fsp_str_dbg(fsp), fsp->fnum,
+		  oplocklevel));
 
 	smbreq = smbd_smb2_fake_smb_request(smb2req);
 	if (tevent_req_nomem(smbreq, req)) {
 		return tevent_req_post(req, ev);
 	}
 
-	fsp = file_fsp(smbreq, (uint16_t)in_file_id_volatile);
-	if (fsp == NULL) {
-		tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
-		return tevent_req_post(req, ev);
-	}
-	if (conn != fsp->conn) {
-		tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
-		return tevent_req_post(req, ev);
-	}
-	if (smb2req->session->vuid != fsp->vuid) {
-		tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
-		return tevent_req_post(req, ev);
-	}
-
 	DEBUG(5,("smbd_smb2_oplock_break_send: got SMB2 oplock break (%u) from client "
 		"for file %s fnum = %d\n",
 		(unsigned int)in_oplock_level,
diff --git a/source3/smbd/smb2_close.c b/source3/smbd/smb2_close.c
index 3df408e..7217f1e 100644
--- a/source3/smbd/smb2_close.c
+++ b/source3/smbd/smb2_close.c
@@ -27,8 +27,8 @@
 static struct tevent_req *smbd_smb2_close_send(TALLOC_CTX *mem_ctx,
 					       struct tevent_context *ev,
 					       struct smbd_smb2_request *smb2req,
-					       uint16_t in_flags,
-					       uint64_t in_file_id_volatile);
+					       struct files_struct *in_fsp,
+					       uint16_t in_flags);
 static NTSTATUS smbd_smb2_close_recv(struct tevent_req *req,
 				     uint16_t *out_flags,
 				     NTTIME *out_creation_time,
@@ -48,6 +48,7 @@ NTSTATUS smbd_smb2_request_process_close(struct smbd_smb2_request *req)
 	uint16_t in_flags;
 	uint64_t in_file_id_persistent;
 	uint64_t in_file_id_volatile;
+	struct files_struct *in_fsp;
 	NTSTATUS status;
 	struct tevent_req *subreq;
 
@@ -61,17 +62,13 @@ NTSTATUS smbd_smb2_request_process_close(struct smbd_smb2_request *req)
 	in_file_id_persistent	= BVAL(inbody, 0x08);
 	in_file_id_volatile	= BVAL(inbody, 0x10);
 
-	if (req->compat_chain_fsp) {
-		/* skip check */
-	} else if (in_file_id_persistent != in_file_id_volatile) {
+	in_fsp = file_fsp_smb2(req, in_file_id_persistent, in_file_id_volatile);
+	if (in_fsp == NULL) {
 		return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
 	}
 
-	subreq = smbd_smb2_close_send(req,
-				      req->sconn->ev_ctx,
-				      req,
-				      in_flags,
-				      in_file_id_volatile);
+	subreq = smbd_smb2_close_send(req, req->sconn->ev_ctx,
+				      req, in_fsp, in_flags);
 	if (subreq == NULL) {
 		return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
 	}
@@ -148,8 +145,8 @@ static void smbd_smb2_request_close_done(struct tevent_req *subreq)
 }
 
 static NTSTATUS smbd_smb2_close(struct smbd_smb2_request *req,
+				struct files_struct *fsp,
 				uint16_t in_flags,
-				uint64_t in_file_id_volatile,
 				uint16_t *out_flags,
 				NTTIME *out_creation_time,
 				NTTIME *out_last_access_time,
@@ -162,7 +159,6 @@ static NTSTATUS smbd_smb2_close(struct smbd_smb2_request *req,
 	NTSTATUS status;
 	struct smb_request *smbreq;
 	connection_struct *conn = req->tcon->compat_conn;
-	files_struct *fsp;
 	struct smb_filename *smb_fname = NULL;
 	struct timespec mdate_ts, adate_ts, cdate_ts, create_date_ts;
 	uint64_t allocation_size = 0;
@@ -185,25 +181,14 @@ static NTSTATUS smbd_smb2_close(struct smbd_smb2_request *req,
 	*out_end_of_file = 0;
 	*out_file_attributes = 0;
 
-	DEBUG(10,("smbd_smb2_close: file_id[0x%016llX]\n",
-		  (unsigned long long)in_file_id_volatile));
+	DEBUG(10,("smbd_smb2_close: %s - fnum[%d]\n",
+		  fsp_str_dbg(fsp), fsp->fnum));
 
 	smbreq = smbd_smb2_fake_smb_request(req);
 	if (smbreq == NULL) {
 		return NT_STATUS_NO_MEMORY;
 	}
 
-	fsp = file_fsp(smbreq, (uint16_t)in_file_id_volatile);
-	if (fsp == NULL) {
-		return NT_STATUS_FILE_CLOSED;
-	}
-	if (conn != fsp->conn) {
-		return NT_STATUS_FILE_CLOSED;
-	}
-	if (req->session->vuid != fsp->vuid) {
-		return NT_STATUS_FILE_CLOSED;
-	}
-
 	posix_open = fsp->posix_open;
 	status = copy_smb_filename(talloc_tos(),
 				fsp->fsp_name,
@@ -270,8 +255,8 @@ static NTSTATUS smbd_smb2_close(struct smbd_smb2_request *req,
 }
 
 struct smbd_smb2_close_state {
+	struct files_struct *in_fsp;
 	uint16_t in_flags;
-	uint64_t in_file_id_volatile;
 	uint16_t out_flags;
 	NTTIME out_creation_time;
 	NTTIME out_last_access_time;
@@ -285,8 +270,8 @@ struct smbd_smb2_close_state {
 static struct tevent_req *smbd_smb2_close_send(TALLOC_CTX *mem_ctx,
 					       struct tevent_context *ev,
 					       struct smbd_smb2_request *smb2req,
-					       uint16_t in_flags,
-					       uint64_t in_file_id_volatile)
+					       struct files_struct *in_fsp,
+					       uint16_t in_flags)
 {
 	struct tevent_req *req;
 	struct smbd_smb2_close_state *state;
@@ -297,12 +282,12 @@ static struct tevent_req *smbd_smb2_close_send(TALLOC_CTX *mem_ctx,
 	if (req == NULL) {
 		return NULL;
 	}
+	state->in_fsp = in_fsp;
 	state->in_flags = in_flags;
-	state->in_file_id_volatile = in_file_id_volatile;
 
 	status = smbd_smb2_close(smb2req,
+				 state->in_fsp,
 				 state->in_flags,
-				 state->in_file_id_volatile,
 				 &state->out_flags,
 				 &state->out_creation_time,
 				 &state->out_last_access_time,
diff --git a/source3/smbd/smb2_find.c b/source3/smbd/smb2_find.c
index eb22118..187a5ff 100644
--- a/source3/smbd/smb2_find.c
+++ b/source3/smbd/smb2_find.c
@@ -28,10 +28,10 @@
 static struct tevent_req *smbd_smb2_find_send(TALLOC_CTX *mem_ctx,
 					      struct tevent_context *ev,
 					      struct smbd_smb2_request *smb2req,
+					      struct files_struct *in_fsp,
 					      uint8_t in_file_info_class,
 					      uint8_t in_flags,
 					      uint32_t in_file_index,
-					      uint64_t in_file_id_volatile,
 					      uint32_t in_output_buffer_length,
 					      const char *in_file_name);
 static NTSTATUS smbd_smb2_find_recv(struct tevent_req *req,
@@ -49,6 +49,7 @@ NTSTATUS smbd_smb2_request_process_find(struct smbd_smb2_request *req)
 	uint32_t in_file_index;
 	uint64_t in_file_id_persistent;
 	uint64_t in_file_id_volatile;
+	struct files_struct *in_fsp;
 	uint16_t in_file_name_offset;
 	uint16_t in_file_name_length;
 	DATA_BLOB in_file_name_buffer;
@@ -115,19 +116,16 @@ NTSTATUS smbd_smb2_request_process_find(struct smbd_smb2_request *req)
 		return smbd_smb2_request_error(req, NT_STATUS_OBJECT_NAME_INVALID);
 	}
 
-	if (req->compat_chain_fsp) {
-		/* skip check */
-	} else if (in_file_id_persistent != in_file_id_volatile) {
+	in_fsp = file_fsp_smb2(req, in_file_id_persistent, in_file_id_volatile);
+	if (in_fsp == NULL) {
 		return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
 	}
 
-	subreq = smbd_smb2_find_send(req,
-				     req->sconn->ev_ctx,
-				     req,
+	subreq = smbd_smb2_find_send(req, req->sconn->ev_ctx,
+				     req, in_fsp,
 				     in_file_info_class,
 				     in_flags,
 				     in_file_index,
-				     in_file_id_volatile,
 				     in_output_buffer_length,
 				     in_file_name_string);
 	if (subreq == NULL) {
@@ -203,10 +201,10 @@ struct smbd_smb2_find_state {
 static struct tevent_req *smbd_smb2_find_send(TALLOC_CTX *mem_ctx,
 					      struct tevent_context *ev,
 					      struct smbd_smb2_request *smb2req,
+					      struct files_struct *fsp,
 					      uint8_t in_file_info_class,
 					      uint8_t in_flags,
 					      uint32_t in_file_index,
-					      uint64_t in_file_id_volatile,
 					      uint32_t in_output_buffer_length,
 					      const char *in_file_name)
 {
@@ -214,7 +212,6 @@ static struct tevent_req *smbd_smb2_find_send(TALLOC_CTX *mem_ctx,
 	struct smbd_smb2_find_state *state;
 	struct smb_request *smbreq;
 	connection_struct *conn = smb2req->tcon->compat_conn;
-	files_struct *fsp;
 	NTSTATUS status;
 	NTSTATUS empty_status;
 	uint32_t info_level;
@@ -237,28 +234,14 @@ static struct tevent_req *smbd_smb2_find_send(TALLOC_CTX *mem_ctx,
 	state->smb2req = smb2req;
 	state->out_output_buffer = data_blob_null;
 
-	DEBUG(10,("smbd_smb2_find_send: file_id[0x%016llX]\n",
-		  (unsigned long long)in_file_id_volatile));
+	DEBUG(10,("smbd_smb2_find_send: %s - fnum[%d]\n",
+		  fsp_str_dbg(fsp), fsp->fnum));
 
 	smbreq = smbd_smb2_fake_smb_request(smb2req);
 	if (tevent_req_nomem(smbreq, req)) {
 		return tevent_req_post(req, ev);
 	}
 
-	fsp = file_fsp(smbreq, (uint16_t)in_file_id_volatile);
-	if (fsp == NULL) {
-		tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
-		return tevent_req_post(req, ev);
-	}
-	if (conn != fsp->conn) {
-		tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
-		return tevent_req_post(req, ev);
-	}
-	if (smb2req->session->vuid != fsp->vuid) {
-		tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
-		return tevent_req_post(req, ev);
-	}
-
 	if (!fsp->is_directory) {
 		tevent_req_nterror(req, NT_STATUS_NOT_SUPPORTED);
 		return tevent_req_post(req, ev);
diff --git a/source3/smbd/smb2_flush.c b/source3/smbd/smb2_flush.c
index fecce45..a0c3f71 100644
--- a/source3/smbd/smb2_flush.c
+++ b/source3/smbd/smb2_flush.c
@@ -27,7 +27,7 @@
 static struct tevent_req *smbd_smb2_flush_send(TALLOC_CTX *mem_ctx,
 					       struct tevent_context *ev,
 					       struct smbd_smb2_request *smb2req,
-					       uint64_t in_file_id_volatile);
+					       struct files_struct *fsp);
 static NTSTATUS smbd_smb2_flush_recv(struct tevent_req *req);
 
 static void smbd_smb2_request_flush_done(struct tevent_req *subreq);
@@ -38,6 +38,7 @@ NTSTATUS smbd_smb2_request_process_flush(struct smbd_smb2_request *req)
 	int i = req->current_idx;
 	uint64_t in_file_id_persistent;
 	uint64_t in_file_id_volatile;
+	struct files_struct *in_fsp;
 	struct tevent_req *subreq;
 
 	status = smbd_smb2_request_verify_sizes(req, 0x18);
@@ -49,16 +50,13 @@ NTSTATUS smbd_smb2_request_process_flush(struct smbd_smb2_request *req)
 	in_file_id_persistent	= BVAL(inbody, 0x08);
 	in_file_id_volatile	= BVAL(inbody, 0x10);
 
-	if (req->compat_chain_fsp) {
-		/* skip check */
-	} else if (in_file_id_persistent != in_file_id_volatile) {
+	in_fsp = file_fsp_smb2(req, in_file_id_persistent, in_file_id_volatile);
+	if (in_fsp == NULL) {
 		return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED);
 	}
 
-	subreq = smbd_smb2_flush_send(req,
-				      req->sconn->ev_ctx,
-				      req,
-				      in_file_id_volatile);
+	subreq = smbd_smb2_flush_send(req, req->sconn->ev_ctx,
+				      req, in_fsp);
 	if (subreq == NULL) {
 		return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY);
 	}
@@ -116,13 +114,12 @@ struct smbd_smb2_flush_state {
 static struct tevent_req *smbd_smb2_flush_send(TALLOC_CTX *mem_ctx,
 					       struct tevent_context *ev,
 					       struct smbd_smb2_request *smb2req,
-					       uint64_t in_file_id_volatile)
+					       struct files_struct *fsp)
 {
 	struct tevent_req *req;
 	struct smbd_smb2_flush_state *state;
 	NTSTATUS status;
 	struct smb_request *smbreq;
-	files_struct *fsp;
 
 	req = tevent_req_create(mem_ctx, &state,
 				struct smbd_smb2_flush_state);
@@ -131,8 +128,8 @@ static struct tevent_req *smbd_smb2_flush_send(TALLOC_CTX *mem_ctx,
 	}
 	state->smb2req = smb2req;
 
-	DEBUG(10,("smbd_smb2_flush: file_id[0x%016llX]\n",
-		  (unsigned long long)in_file_id_volatile));
+	DEBUG(10,("smbd_smb2_flush: %s - fnum[%d]\n",
+		  fsp_str_dbg(fsp), fsp->fnum));
 
 	smbreq = smbd_smb2_fake_smb_request(smb2req);
 	if (tevent_req_nomem(smbreq, req)) {
@@ -144,20 +141,6 @@ static struct tevent_req *smbd_smb2_flush_send(TALLOC_CTX *mem_ctx,
 		return tevent_req_post(req, ev);
 	}
 
-	fsp = file_fsp(smbreq, (uint16_t)in_file_id_volatile);
-	if (fsp == NULL) {
-		tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
-		return tevent_req_post(req, ev);
-	}
-	if (smbreq->conn != fsp->conn) {
-		tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
-		return tevent_req_post(req, ev);
-	}
-	if (smb2req->session->vuid != fsp->vuid) {
-		tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
-		return tevent_req_post(req, ev);
-	}
-
 	if (!CHECK_WRITE(fsp)) {
 		tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
 		return tevent_req_post(req, ev);
diff --git a/source3/smbd/smb2_getinfo.c b/source3/smbd/smb2_getinfo.c
index e7ccdfd..1e0f24c 100644
--- a/source3/smbd/smb2_getinfo.c
+++ b/source3/smbd/smb2_getinfo.c
@@ -29,13 +29,13 @@
 static struct tevent_req *smbd_smb2_getinfo_send(TALLOC_CTX *mem_ctx,
 						 struct tevent_context *ev,
 						 struct smbd_smb2_request *smb2req,
+						 struct files_struct *in_fsp,
 						 uint8_t in_info_type,
 						 uint8_t in_file_info_class,
 						 uint32_t in_output_buffer_length,
 						 DATA_BLOB in_input_buffer,
 						 uint32_t in_additional_information,
-						 uint32_t in_flags,
-						 uint64_t in_file_id_volatile);
+						 uint32_t in_flags);
 static NTSTATUS smbd_smb2_getinfo_recv(struct tevent_req *req,
 				       TALLOC_CTX *mem_ctx,
 				       DATA_BLOB *out_output_buffer,


-- 
Samba Shared Repository


More information about the samba-cvs mailing list