The Samba-Bugzilla – Attachment 7651 Details for
Bug 8995
SMB2 - Persistent File IDs must be unique.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
git-am patchstream containing the backport from master.
bug8995.patchset (text/plain), 59.00 KB, created by
Jeremy Allison
on 2012-06-15 21:13:03 UTC
(
hide
)
Description:
git-am patchstream containing the backport from master.
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2012-06-15 21:13:03 UTC
Size:
59.00 KB
patch
obsolete
>From cd8485d2e009acd93d8150a8926136254dd31b1b Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Sat, 9 Jun 2012 11:09:25 +0200 >Subject: [PATCH 01/21] s3:smbd: set req->smb2req->compat_chain_fsp in > file_fsp() > >metze > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/smbd/files.c | 3 +++ > 1 files changed, 3 insertions(+), 0 deletions(-) > >diff --git a/source3/smbd/files.c b/source3/smbd/files.c >index bdf85db..fafb10d 100644 >--- a/source3/smbd/files.c >+++ b/source3/smbd/files.c >@@ -544,6 +544,9 @@ files_struct *file_fsp(struct smb_request *req, uint16 fid) > fsp = file_fnum(req->sconn, fid); > if (fsp != NULL) { > req->chain_fsp = fsp; >+ if (req->smb2req != NULL) { >+ req->smb2req->compat_chain_fsp = fsp; >+ } > } > return fsp; > } >-- >1.7.7.3 > > >From e295e179a04f76226c9a3ba2d34a5cac18d491ea Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Fri, 8 Jun 2012 12:05:56 +0200 >Subject: [PATCH 02/21] s3:smb2_lock: use smb2req->compat_chain_fsp instead of > looking it up again > >metze > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/smbd/smb2_lock.c | 7 +------ > 1 files changed, 1 insertions(+), 6 deletions(-) > >diff --git a/source3/smbd/smb2_lock.c b/source3/smbd/smb2_lock.c >index 28612ae..f4611eb 100644 >--- a/source3/smbd/smb2_lock.c >+++ b/source3/smbd/smb2_lock.c >@@ -866,10 +866,8 @@ void cancel_pending_lock_requests_by_fid_smb2(files_struct *fsp, > struct smbd_smb2_lock_state *state = NULL; > files_struct *fsp_curr = NULL; > int i = smb2req->current_idx; >- uint64_t in_file_id_volatile; > struct blocking_lock_record *blr = NULL; > const uint8_t *inhdr; >- const uint8_t *inbody; > > nextreq = smb2req->next; > >@@ -888,9 +886,6 @@ void cancel_pending_lock_requests_by_fid_smb2(files_struct *fsp, > continue; > } > >- inbody = (const uint8_t *)smb2req->in.vector[i+1].iov_base; >- in_file_id_volatile = BVAL(inbody, 0x10); >- > state = tevent_req_data(smb2req->subreq, > struct smbd_smb2_lock_state); > if (!state) { >@@ -898,7 +893,7 @@ void cancel_pending_lock_requests_by_fid_smb2(files_struct *fsp, > continue; > } > >- fsp_curr = file_fsp(state->smb1req, (uint16_t)in_file_id_volatile); >+ fsp_curr = smb2req->compat_chain_fsp; > if (fsp_curr == NULL) { > /* Strange - is this even possible ? */ > continue; >-- >1.7.7.3 > > >From 3c2a5902be3e42f6e6ed500ab140f551d69cb674 Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Fri, 8 Jun 2012 11:19:00 +0200 >Subject: [PATCH 03/21] s3:smb2_lock: use fsp->fnum as locking context > >fsp->fnum is the same as in_file_id_volatile. > >When we start to support durable handles we should pass >in_file_id_persistent. > >metze > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/smbd/smb2_lock.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > >diff --git a/source3/smbd/smb2_lock.c b/source3/smbd/smb2_lock.c >index f4611eb..be403ee 100644 >--- a/source3/smbd/smb2_lock.c >+++ b/source3/smbd/smb2_lock.c >@@ -335,7 +335,7 @@ static struct tevent_req *smbd_smb2_lock_send(TALLOC_CTX *mem_ctx, > return tevent_req_post(req, ev); > } > >- locks[i].smblctx = in_file_id_volatile; >+ locks[i].smblctx = fsp->fnum; > locks[i].offset = in_locks[i].offset; > locks[i].count = in_locks[i].length; > >-- >1.7.7.3 > > >From 84d2e5b5743c4cdf004db0146974d565f3689e0f Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Fri, 8 Jun 2012 11:19:00 +0200 >Subject: [PATCH 04/21] s3:smb2_read: pass fsp->fnum to > init_strict_lock_struct() > >fsp->fnum is the same as in_file_id_volatile. > >When we start to support durable handles we should pass >in_file_id_persistent. > >metze > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/smbd/smb2_read.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > >diff --git a/source3/smbd/smb2_read.c b/source3/smbd/smb2_read.c >index 21082e6..3c4b3e7 100644 >--- a/source3/smbd/smb2_read.c >+++ b/source3/smbd/smb2_read.c >@@ -252,7 +252,7 @@ static int smb2_sendfile_send_data(struct smbd_smb2_read_state *state) > } > > init_strict_lock_struct(fsp, >- state->in_file_id_volatile, >+ fsp->fnum, > in_offset, > in_length, > READ_LOCK, >@@ -486,7 +486,7 @@ static struct tevent_req *smbd_smb2_read_send(TALLOC_CTX *mem_ctx, > /* Fallback to synchronous. */ > > init_strict_lock_struct(fsp, >- in_file_id_volatile, >+ fsp->fnum, > in_offset, > in_length, > READ_LOCK, >-- >1.7.7.3 > > >From f1abe8c9c2ef9eb84db8ba52352c4b835625fde8 Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Fri, 8 Jun 2012 11:19:00 +0200 >Subject: [PATCH 05/21] s3:smb2_write: pass fsp->fnum to > init_strict_lock_struct() > >fsp->fnum is the same as in_file_id_volatile. > >When we start to support durable handles we should pass >in_file_id_persistent. > >metze > >Autobuild-User(master): Stefan Metzmacher <metze@samba.org> >Autobuild-Date(master): Sat Jun 9 18:50:32 CEST 2012 on sn-devel-104 > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/smbd/smb2_write.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > >diff --git a/source3/smbd/smb2_write.c b/source3/smbd/smb2_write.c >index b2360ca..9014fa4 100644 >--- a/source3/smbd/smb2_write.c >+++ b/source3/smbd/smb2_write.c >@@ -321,7 +321,7 @@ static struct tevent_req *smbd_smb2_write_send(TALLOC_CTX *mem_ctx, > > /* Fallback to synchronous. */ > init_strict_lock_struct(fsp, >- in_file_id_volatile, >+ fsp->fnum, > in_offset, > in_data.length, > WRITE_LOCK, >-- >1.7.7.3 > > >From 2b59de8189b05ead3e6853be978d9c999288ed41 Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Fri, 8 Jun 2012 10:11:57 +0200 >Subject: [PATCH 06/21] s3:smbd: add file_fsp_smb2() > >metze > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/smbd/files.c | 43 +++++++++++++++++++++++++++++++++++++++++++ > source3/smbd/proto.h | 3 +++ > 2 files changed, 46 insertions(+), 0 deletions(-) > >diff --git a/source3/smbd/files.c b/source3/smbd/files.c >index fafb10d..9cf17ce 100644 >--- a/source3/smbd/files.c >+++ b/source3/smbd/files.c >@@ -551,6 +551,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 e9f4624..929387b 100644 >--- a/source3/smbd/proto.h >+++ b/source3/smbd/proto.h >@@ -373,6 +373,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); >-- >1.7.7.3 > > >From 16939776b66b27ff3c3f4a36e062864133fdf5ed Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Fri, 15 Jun 2012 12:55:52 -0700 >Subject: [PATCH 07/21] s3:smb2_flush: make use of file_fsp_smb2() > >metze >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/smbd/smb2_flush.c | 35 +++++++++-------------------------- > 1 files changed, 9 insertions(+), 26 deletions(-) > >diff --git a/source3/smbd/smb2_flush.c b/source3/smbd/smb2_flush.c >index 5f3c42a..d24cb86 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->smb2.event_ctx, >- req, >- in_file_id_volatile); >+ subreq = smbd_smb2_flush_send(req, req->sconn->smb2.event_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); >-- >1.7.7.3 > > >From 1f1c972686ee78dcdaaf88d75976ef71aa8fe5a9 Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Fri, 15 Jun 2012 13:15:27 -0700 >Subject: [PATCH 08/21] s3:smb2_close: make use of file_fsp_smb2() > >metze >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/smbd/smb2_close.c | 28 ++++++++-------------------- > 1 files changed, 8 insertions(+), 20 deletions(-) > >diff --git a/source3/smbd/smb2_close.c b/source3/smbd/smb2_close.c >index ffe08cc..9459503 100644 >--- a/source3/smbd/smb2_close.c >+++ b/source3/smbd/smb2_close.c >@@ -24,8 +24,8 @@ > #include "../libcli/smb/smb_common.h" > > static NTSTATUS smbd_smb2_close(struct smbd_smb2_request *req, >+ struct files_struct *fsp, > uint16_t in_flags, >- uint64_t in_file_id_volatile, > DATA_BLOB *outbody); > > NTSTATUS smbd_smb2_request_process_close(struct smbd_smb2_request *req) >@@ -37,6 +37,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; > > status = smbd_smb2_request_verify_sizes(req, 0x18); >@@ -54,15 +55,14 @@ 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); > } > > status = smbd_smb2_close(req, >+ in_fsp, > in_flags, >- in_file_id_volatile, > &outbody); > if (!NT_STATUS_IS_OK(status)) { > return smbd_smb2_request_error(req, status); >@@ -73,14 +73,13 @@ NTSTATUS smbd_smb2_request_process_close(struct smbd_smb2_request *req) > } > > static NTSTATUS smbd_smb2_close(struct smbd_smb2_request *req, >+ struct files_struct *fsp, > uint16_t in_flags, >- uint64_t in_file_id_volatile, > DATA_BLOB *outbody) > { > 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; >@@ -94,25 +93,14 @@ static NTSTATUS smbd_smb2_close(struct smbd_smb2_request *req, > ZERO_STRUCT(mdate_ts); > ZERO_STRUCT(cdate_ts); > >- 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, >-- >1.7.7.3 > > >From 5825e1d7a743318deca3dc06f1261baf9c4b0441 Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Fri, 8 Jun 2012 10:36:24 +0200 >Subject: [PATCH 09/21] s3:smb2_break: make use of file_fsp_smb2() > >metze > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/smbd/smb2_break.c | 45 +++++++++++++-------------------------------- > 1 files changed, 13 insertions(+), 32 deletions(-) > >diff --git a/source3/smbd/smb2_break.c b/source3/smbd/smb2_break.c >index ce583ac..2eb2346 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->smb2.event_ctx, >- req, >- in_oplock_level, >- in_file_id_volatile); >+ subreq = smbd_smb2_oplock_break_send(req, req->sconn->smb2.event_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, >-- >1.7.7.3 > > >From 6c0433af5457fc646c420420632be02416a348c6 Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Fri, 8 Jun 2012 10:42:43 +0200 >Subject: [PATCH 10/21] s3:smb2_find: make use of file_fsp_smb2() > >metze > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/smbd/smb2_find.c | 35 +++++++++-------------------------- > 1 files changed, 9 insertions(+), 26 deletions(-) > >diff --git a/source3/smbd/smb2_find.c b/source3/smbd/smb2_find.c >index 3dcc768..59e5b66 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->smb2.event_ctx, >- req, >+ subreq = smbd_smb2_find_send(req, req->sconn->smb2.event_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) { >@@ -207,10 +205,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) > { >@@ -218,7 +216,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; >@@ -241,28 +238,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); >-- >1.7.7.3 > > >From 50a98f5f01f85fe6aa9b36666ee86b852f0a9475 Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Fri, 15 Jun 2012 13:23:47 -0700 >Subject: [PATCH 11/21] s3:smb2_getinfo: make use of file_fsp_smb2() > >metze > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/smbd/smb2_getinfo.c | 41 ++++++++++++----------------------------- > 1 files changed, 12 insertions(+), 29 deletions(-) > >diff --git a/source3/smbd/smb2_getinfo.c b/source3/smbd/smb2_getinfo.c >index c5d2d62..b109de4 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, >@@ -57,6 +57,7 @@ NTSTATUS smbd_smb2_request_process_getinfo(struct smbd_smb2_request *req) > uint32_t in_flags; > 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, 0x29); >@@ -97,22 +98,19 @@ NTSTATUS smbd_smb2_request_process_getinfo(struct smbd_smb2_request *req) > return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER); > } > >- 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_getinfo_send(req, >- req->sconn->smb2.event_ctx, >- req, >+ subreq = smbd_smb2_getinfo_send(req, req->sconn->smb2.event_ctx, >+ req, in_fsp, > in_info_type, > in_file_info_class, > in_output_buffer_length, > in_input_buffer, > in_additional_information, >- in_flags, >- in_file_id_volatile); >+ in_flags); > if (subreq == NULL) { > return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY); > } >@@ -234,19 +232,18 @@ static void smb2_ipc_getinfo(struct tevent_req *req, > static struct tevent_req *smbd_smb2_getinfo_send(TALLOC_CTX *mem_ctx, > struct tevent_context *ev, > struct smbd_smb2_request *smb2req, >+ struct files_struct *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) > { > struct tevent_req *req; > struct smbd_smb2_getinfo_state *state; > struct smb_request *smbreq; > connection_struct *conn = smb2req->tcon->compat_conn; >- files_struct *fsp; > NTSTATUS status; > > req = tevent_req_create(mem_ctx, &state, >@@ -258,28 +255,14 @@ static struct tevent_req *smbd_smb2_getinfo_send(TALLOC_CTX *mem_ctx, > state->status = NT_STATUS_OK; > state->out_output_buffer = data_blob_null; > >- DEBUG(10,("smbd_smb2_getinfo_send: file_id[0x%016llX]\n", >- (unsigned long long)in_file_id_volatile)); >+ DEBUG(10,("smbd_smb2_getinfo_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 (IS_IPC(conn)) { > smb2_ipc_getinfo(req, state, ev, > in_info_type, in_file_info_class); >-- >1.7.7.3 > > >From be7b68e085bd24d42c188a40be31a5df2e65a1d5 Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Fri, 15 Jun 2012 13:25:11 -0700 >Subject: [PATCH 12/21] 3:smb2_setinfo: make use of file_fsp_smb2() > >metze > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/smbd/smb2_setinfo.c | 41 ++++++++++++----------------------------- > 1 files changed, 12 insertions(+), 29 deletions(-) > >diff --git a/source3/smbd/smb2_setinfo.c b/source3/smbd/smb2_setinfo.c >index 751190a..ba91466 100644 >--- a/source3/smbd/smb2_setinfo.c >+++ b/source3/smbd/smb2_setinfo.c >@@ -29,11 +29,11 @@ > static struct tevent_req *smbd_smb2_setinfo_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, > DATA_BLOB in_input_buffer, >- uint32_t in_additional_information, >- uint64_t in_file_id_volatile); >+ uint32_t in_additional_information); > static NTSTATUS smbd_smb2_setinfo_recv(struct tevent_req *req); > > static void smbd_smb2_request_setinfo_done(struct tevent_req *subreq); >@@ -50,6 +50,7 @@ NTSTATUS smbd_smb2_request_process_setinfo(struct smbd_smb2_request *req) > uint32_t in_additional_information; > 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, 0x21); >@@ -85,20 +86,17 @@ NTSTATUS smbd_smb2_request_process_setinfo(struct smbd_smb2_request *req) > return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER); > } > >- 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_setinfo_send(req, >- req->sconn->smb2.event_ctx, >- req, >+ subreq = smbd_smb2_setinfo_send(req, req->sconn->smb2.event_ctx, >+ req, in_fsp, > in_info_type, > in_file_info_class, > in_input_buffer, >- in_additional_information, >- in_file_id_volatile); >+ in_additional_information); > if (subreq == NULL) { > return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY); > } >@@ -155,17 +153,16 @@ struct smbd_smb2_setinfo_state { > static struct tevent_req *smbd_smb2_setinfo_send(TALLOC_CTX *mem_ctx, > struct tevent_context *ev, > struct smbd_smb2_request *smb2req, >+ struct files_struct *fsp, > uint8_t in_info_type, > uint8_t in_file_info_class, > DATA_BLOB in_input_buffer, >- uint32_t in_additional_information, >- uint64_t in_file_id_volatile) >+ uint32_t in_additional_information) > { > struct tevent_req *req = NULL; > struct smbd_smb2_setinfo_state *state = NULL; > struct smb_request *smbreq = NULL; > connection_struct *conn = smb2req->tcon->compat_conn; >- files_struct *fsp = NULL; > NTSTATUS status; > > req = tevent_req_create(mem_ctx, &state, >@@ -175,28 +172,14 @@ static struct tevent_req *smbd_smb2_setinfo_send(TALLOC_CTX *mem_ctx, > } > state->smb2req = smb2req; > >- DEBUG(10,("smbd_smb2_setinfo_send: file_id[0x%016llX]\n", >- (unsigned long long)in_file_id_volatile)); >+ DEBUG(10,("smbd_smb2_setinfo_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 (IS_IPC(conn)) { > tevent_req_nterror(req, NT_STATUS_NOT_SUPPORTED); > return tevent_req_post(req, ev); >-- >1.7.7.3 > > >From 84844b57e6281ca76e00b91dce2c229775e9099f Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Fri, 15 Jun 2012 13:27:55 -0700 >Subject: [PATCH 13/21] s3:smb2_notify: make use of file_fsp_smb2() > >metze > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/smbd/smb2_notify.c | 35 +++++++++-------------------------- > 1 files changed, 9 insertions(+), 26 deletions(-) > >diff --git a/source3/smbd/smb2_notify.c b/source3/smbd/smb2_notify.c >index 49c6a54..72430eb 100644 >--- a/source3/smbd/smb2_notify.c >+++ b/source3/smbd/smb2_notify.c >@@ -36,9 +36,9 @@ struct smbd_smb2_notify_state { > static struct tevent_req *smbd_smb2_notify_send(TALLOC_CTX *mem_ctx, > struct tevent_context *ev, > struct smbd_smb2_request *smb2req, >+ struct files_struct *in_fsp, > uint16_t in_flags, > uint32_t in_output_buffer_length, >- uint64_t in_file_id_volatile, > uint64_t in_completion_filter); > static NTSTATUS smbd_smb2_notify_recv(struct tevent_req *req, > TALLOC_CTX *mem_ctx, >@@ -54,6 +54,7 @@ NTSTATUS smbd_smb2_request_process_notify(struct smbd_smb2_request *req) > uint32_t in_output_buffer_length; > uint64_t in_file_id_persistent; > uint64_t in_file_id_volatile; >+ struct files_struct *in_fsp; > uint64_t in_completion_filter; > struct tevent_req *subreq; > >@@ -77,18 +78,15 @@ NTSTATUS smbd_smb2_request_process_notify(struct smbd_smb2_request *req) > return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER); > } > >- 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_notify_send(req, >- req->sconn->smb2.event_ctx, >- req, >+ subreq = smbd_smb2_notify_send(req, req->sconn->smb2.event_ctx, >+ req, in_fsp, > in_flags, > in_output_buffer_length, >- in_file_id_volatile, > in_completion_filter); > if (subreq == NULL) { > return smbd_smb2_request_error(req, NT_STATUS_NO_MEMORY); >@@ -185,16 +183,15 @@ static bool smbd_smb2_notify_cancel(struct tevent_req *req); > static struct tevent_req *smbd_smb2_notify_send(TALLOC_CTX *mem_ctx, > struct tevent_context *ev, > struct smbd_smb2_request *smb2req, >+ struct files_struct *fsp, > uint16_t in_flags, > uint32_t in_output_buffer_length, >- uint64_t in_file_id_volatile, > uint64_t in_completion_filter) > { > struct tevent_req *req; > struct smbd_smb2_notify_state *state; > struct smb_request *smbreq; > connection_struct *conn = smb2req->tcon->compat_conn; >- files_struct *fsp; > bool recursive = (in_flags & 0x0001) ? true : false; > NTSTATUS status; > >@@ -208,8 +205,8 @@ static struct tevent_req *smbd_smb2_notify_send(TALLOC_CTX *mem_ctx, > state->out_output_buffer = data_blob_null; > state->im = NULL; > >- DEBUG(10,("smbd_smb2_notify_send: file_id[0x%016llX]\n", >- (unsigned long long)in_file_id_volatile)); >+ DEBUG(10,("smbd_smb2_notify_send: %s - fnum[%d]\n", >+ fsp_str_dbg(fsp), fsp->fnum)); > > smbreq = smbd_smb2_fake_smb_request(smb2req); > if (tevent_req_nomem(smbreq, req)) { >@@ -219,20 +216,6 @@ static struct tevent_req *smbd_smb2_notify_send(TALLOC_CTX *mem_ctx, > state->smbreq = smbreq; > smbreq->async_priv = (void *)req; > >- 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); >- } >- > { > char *filter_string; > >-- >1.7.7.3 > > >From e4a11d7851dab6461b892edcd0c46f9580eb6dcd Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Fri, 15 Jun 2012 13:29:24 -0700 >Subject: [PATCH 14/21] s3:smb2_read: make use of file_fsp_smb2() > >metze > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/smbd/smb2_read.c | 40 +++++++++++----------------------------- > 1 files changed, 11 insertions(+), 29 deletions(-) > >diff --git a/source3/smbd/smb2_read.c b/source3/smbd/smb2_read.c >index 3c4b3e7..05e0b6a 100644 >--- a/source3/smbd/smb2_read.c >+++ b/source3/smbd/smb2_read.c >@@ -30,8 +30,8 @@ > static struct tevent_req *smbd_smb2_read_send(TALLOC_CTX *mem_ctx, > struct tevent_context *ev, > struct smbd_smb2_request *smb2req, >+ struct files_struct *in_fsp, > uint32_t in_smbpid, >- uint64_t in_file_id_volatile, > uint32_t in_length, > uint64_t in_offset, > uint32_t in_minimum, >@@ -53,6 +53,7 @@ NTSTATUS smbd_smb2_request_process_read(struct smbd_smb2_request *req) > uint64_t in_offset; > uint64_t in_file_id_persistent; > uint64_t in_file_id_volatile; >+ struct files_struct *in_fsp; > uint32_t in_minimum_count; > uint32_t in_remaining_bytes; > struct tevent_req *subreq; >@@ -80,17 +81,14 @@ NTSTATUS smbd_smb2_request_process_read(struct smbd_smb2_request *req) > return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER); > } > >- 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_read_send(req, >- req->sconn->smb2.event_ctx, >- req, >+ subreq = smbd_smb2_read_send(req, req->sconn->smb2.event_ctx, >+ req, in_fsp, > in_smbpid, >- in_file_id_volatile, > in_length, > in_offset, > in_minimum_count, >@@ -170,7 +168,6 @@ static void smbd_smb2_request_read_done(struct tevent_req *subreq) > struct smbd_smb2_read_state { > struct smbd_smb2_request *smb2req; > files_struct *fsp; >- uint64_t in_file_id_volatile; > uint32_t in_length; > uint64_t in_offset; > uint32_t in_minimum; >@@ -367,8 +364,8 @@ NTSTATUS smb2_read_complete(struct tevent_req *req, ssize_t nread, int err) > static struct tevent_req *smbd_smb2_read_send(TALLOC_CTX *mem_ctx, > struct tevent_context *ev, > struct smbd_smb2_request *smb2req, >+ struct files_struct *fsp, > uint32_t in_smbpid, >- uint64_t in_file_id_volatile, > uint32_t in_length, > uint64_t in_offset, > uint32_t in_minimum, >@@ -379,7 +376,6 @@ static struct tevent_req *smbd_smb2_read_send(TALLOC_CTX *mem_ctx, > struct smbd_smb2_read_state *state = NULL; > struct smb_request *smbreq = NULL; > connection_struct *conn = smb2req->tcon->compat_conn; >- files_struct *fsp = NULL; > ssize_t nread = -1; > struct lock_struct lock; > int saved_errno; >@@ -396,34 +392,20 @@ static struct tevent_req *smbd_smb2_read_send(TALLOC_CTX *mem_ctx, > state->out_data = data_blob_null; > state->out_remaining = 0; > >- DEBUG(10,("smbd_smb2_read: file_id[0x%016llX]\n", >- (unsigned long long)in_file_id_volatile)); >+ DEBUG(10,("smbd_smb2_read: %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_INVALID_DEVICE_REQUEST); > return tevent_req_post(req, ev); > } > > state->fsp = fsp; >- state->in_file_id_volatile = in_file_id_volatile; > > if (IS_IPC(smbreq->conn)) { > struct tevent_req *subreq = NULL; >@@ -526,10 +508,10 @@ static struct tevent_req *smbd_smb2_read_send(TALLOC_CTX *mem_ctx, > > SMB_VFS_STRICT_UNLOCK(conn, fsp, &lock); > >- DEBUG(10,("smbd_smb2_read: file %s handle [0x%016llX] offset=%llu " >+ DEBUG(10,("smbd_smb2_read: file %s fnum[%d] offset=%llu " > "len=%llu returned %lld\n", > fsp_str_dbg(fsp), >- (unsigned long long)in_file_id_volatile, >+ fsp->fnum, > (unsigned long long)in_offset, > (unsigned long long)in_length, > (long long)nread)); >-- >1.7.7.3 > > >From abaa0b9ca258ff1bf6c92fabc9435eaaae6e051a Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Fri, 15 Jun 2012 13:31:59 -0700 >Subject: [PATCH 15/21] s3:smb2_write: make use of file_fsp_smb2() > >metze > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/smbd/smb2_write.c | 35 +++++++++-------------------------- > 1 files changed, 9 insertions(+), 26 deletions(-) > >diff --git a/source3/smbd/smb2_write.c b/source3/smbd/smb2_write.c >index 9014fa4..a8e5ec3 100644 >--- a/source3/smbd/smb2_write.c >+++ b/source3/smbd/smb2_write.c >@@ -28,8 +28,8 @@ > static struct tevent_req *smbd_smb2_write_send(TALLOC_CTX *mem_ctx, > struct tevent_context *ev, > struct smbd_smb2_request *smb2req, >+ struct files_struct *in_fsp, > uint32_t in_smbpid, >- uint64_t in_file_id_volatile, > DATA_BLOB in_data, > uint64_t in_offset, > uint32_t in_flags); >@@ -50,6 +50,7 @@ NTSTATUS smbd_smb2_request_process_write(struct smbd_smb2_request *req) > uint64_t in_offset; > uint64_t in_file_id_persistent; > uint64_t in_file_id_volatile; >+ struct files_struct *in_fsp; > uint32_t in_flags; > struct tevent_req *subreq; > >@@ -88,17 +89,14 @@ NTSTATUS smbd_smb2_request_process_write(struct smbd_smb2_request *req) > in_data_buffer.data = (uint8_t *)req->in.vector[i+2].iov_base; > in_data_buffer.length = in_data_length; > >- 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_write_send(req, >- req->sconn->smb2.event_ctx, >- req, >+ subreq = smbd_smb2_write_send(req, req->sconn->smb2.event_ctx, >+ req, in_fsp, > in_smbpid, >- in_file_id_volatile, > in_data_buffer, > in_offset, > in_flags); >@@ -215,8 +213,8 @@ NTSTATUS smb2_write_complete(struct tevent_req *req, ssize_t nwritten, int err) > static struct tevent_req *smbd_smb2_write_send(TALLOC_CTX *mem_ctx, > struct tevent_context *ev, > struct smbd_smb2_request *smb2req, >+ struct files_struct *fsp, > uint32_t in_smbpid, >- uint64_t in_file_id_volatile, > DATA_BLOB in_data, > uint64_t in_offset, > uint32_t in_flags) >@@ -226,7 +224,6 @@ static struct tevent_req *smbd_smb2_write_send(TALLOC_CTX *mem_ctx, > struct smbd_smb2_write_state *state = NULL; > struct smb_request *smbreq = NULL; > connection_struct *conn = smb2req->tcon->compat_conn; >- files_struct *fsp = NULL; > ssize_t nwritten; > struct lock_struct lock; > >@@ -242,28 +239,14 @@ static struct tevent_req *smbd_smb2_write_send(TALLOC_CTX *mem_ctx, > state->in_length = in_data.length; > state->out_count = 0; > >- DEBUG(10,("smbd_smb2_write: file_id[0x%016llX]\n", >- (unsigned long long)in_file_id_volatile)); >+ DEBUG(10,("smbd_smb2_write: %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); >- } >- > state->fsp = fsp; > > if (IS_IPC(smbreq->conn)) { >-- >1.7.7.3 > > >From b00fbef998c6eedd488331a324a901fc551efa03 Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Fri, 8 Jun 2012 11:57:21 +0200 >Subject: [PATCH 16/21] s3:smb2_lock: make use of file_fsp_smb2() > >metze > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/smbd/smb2_lock.c | 42 ++++++++++++------------------------------ > 1 files changed, 12 insertions(+), 30 deletions(-) > >diff --git a/source3/smbd/smb2_lock.c b/source3/smbd/smb2_lock.c >index be403ee..2c662ca 100644 >--- a/source3/smbd/smb2_lock.c >+++ b/source3/smbd/smb2_lock.c >@@ -46,8 +46,8 @@ static void remove_pending_lock(struct smbd_smb2_lock_state *state, > static struct tevent_req *smbd_smb2_lock_send(TALLOC_CTX *mem_ctx, > struct tevent_context *ev, > struct smbd_smb2_request *smb2req, >+ struct files_struct *in_fsp, > uint32_t in_smbpid, >- uint64_t in_file_id_volatile, > uint16_t in_lock_count, > struct smbd_smb2_lock_element *in_locks); > static NTSTATUS smbd_smb2_lock_recv(struct tevent_req *req); >@@ -62,6 +62,7 @@ NTSTATUS smbd_smb2_request_process_lock(struct smbd_smb2_request *req) > uint16_t in_lock_count; > uint64_t in_file_id_persistent; > uint64_t in_file_id_volatile; >+ struct files_struct *in_fsp; > struct smbd_smb2_lock_element *in_locks; > struct tevent_req *subreq; > const uint8_t *lock_buffer; >@@ -90,12 +91,6 @@ NTSTATUS smbd_smb2_request_process_lock(struct smbd_smb2_request *req) > return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER); > } > >- if (req->compat_chain_fsp) { >- /* skip check */ >- } else if (in_file_id_persistent != in_file_id_volatile) { >- return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED); >- } >- > in_locks = talloc_array(req, struct smbd_smb2_lock_element, > in_lock_count); > if (in_locks == NULL) { >@@ -121,11 +116,14 @@ NTSTATUS smbd_smb2_request_process_lock(struct smbd_smb2_request *req) > lock_buffer += 0x18; > } > >- subreq = smbd_smb2_lock_send(req, >- req->sconn->smb2.event_ctx, >- req, >+ 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_lock_send(req, req->sconn->smb2.event_ctx, >+ req, in_fsp, > in_smbpid, >- in_file_id_volatile, > in_lock_count, > in_locks); > if (subreq == NULL) { >@@ -207,16 +205,14 @@ static void smbd_smb2_request_lock_done(struct tevent_req *subreq) > static struct tevent_req *smbd_smb2_lock_send(TALLOC_CTX *mem_ctx, > struct tevent_context *ev, > struct smbd_smb2_request *smb2req, >+ struct files_struct *fsp, > uint32_t in_smbpid, >- uint64_t in_file_id_volatile, > uint16_t in_lock_count, > struct smbd_smb2_lock_element *in_locks) > { > struct tevent_req *req; > struct smbd_smb2_lock_state *state; > struct smb_request *smb1req; >- connection_struct *conn = smb2req->tcon->compat_conn; >- files_struct *fsp; > int32_t timeout = -1; > bool isunlock = false; > uint16_t i; >@@ -238,22 +234,8 @@ static struct tevent_req *smbd_smb2_lock_send(TALLOC_CTX *mem_ctx, > } > state->smb1req = smb1req; > >- DEBUG(10,("smbd_smb2_lock_send: file_id[0x%016llX]\n", >- (unsigned long long)in_file_id_volatile)); >- >- fsp = file_fsp(smb1req, (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(10,("smbd_smb2_lock_send: %s - fnum[%d]\n", >+ fsp_str_dbg(fsp), fsp->fnum)); > > locks = talloc_array(state, struct smbd_lock_element, in_lock_count); > if (locks == NULL) { >-- >1.7.7.3 > > >From c36194e043003cddec3cdca29eb27ea78ee8071f Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Fri, 15 Jun 2012 13:42:27 -0700 >Subject: [PATCH 17/21] s3:smb2_ioctl: make use of file_fsp_smb2() > >metze > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/smbd/smb2_ioctl.c | 46 +++++++++++++++----------------------------- > 1 files changed, 16 insertions(+), 30 deletions(-) > >diff --git a/source3/smbd/smb2_ioctl.c b/source3/smbd/smb2_ioctl.c >index f94d9dd..d545cd3 100644 >--- a/source3/smbd/smb2_ioctl.c >+++ b/source3/smbd/smb2_ioctl.c >@@ -29,8 +29,8 @@ > static struct tevent_req *smbd_smb2_ioctl_send(TALLOC_CTX *mem_ctx, > struct tevent_context *ev, > struct smbd_smb2_request *smb2req, >+ struct files_struct *in_fsp, > uint32_t in_ctl_code, >- uint64_t in_file_id_volatile, > DATA_BLOB in_input, > uint32_t in_max_output, > uint32_t in_flags); >@@ -47,6 +47,7 @@ NTSTATUS smbd_smb2_request_process_ioctl(struct smbd_smb2_request *req) > uint32_t in_ctl_code; > uint64_t in_file_id_persistent; > uint64_t in_file_id_volatile; >+ struct files_struct *in_fsp = NULL; > uint32_t in_input_offset; > uint32_t in_input_length; > DATA_BLOB in_input_buffer; >@@ -88,20 +89,21 @@ NTSTATUS smbd_smb2_request_process_ioctl(struct smbd_smb2_request *req) > in_input_buffer.data = (uint8_t *)req->in.vector[i+2].iov_base; > in_input_buffer.length = in_input_length; > >- if (req->compat_chain_fsp) { >- /* skip check */ >- } else if (in_file_id_persistent == UINT64_MAX && >+ if (in_file_id_persistent == UINT64_MAX && > in_file_id_volatile == UINT64_MAX) { > /* without a handle */ >- } else if (in_file_id_persistent != in_file_id_volatile) { >- return smbd_smb2_request_error(req, NT_STATUS_FILE_CLOSED); >+ } else { >+ 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_ioctl_send(req, > req->sconn->smb2.event_ctx, >- req, >+ req, in_fsp, > in_ctl_code, >- in_file_id_volatile, > in_input_buffer, > in_max_output_length, > in_flags); >@@ -222,8 +224,8 @@ static void smbd_smb2_ioctl_pipe_read_done(struct tevent_req *subreq); > static struct tevent_req *smbd_smb2_ioctl_send(TALLOC_CTX *mem_ctx, > struct tevent_context *ev, > struct smbd_smb2_request *smb2req, >+ struct files_struct *fsp, > uint32_t in_ctl_code, >- uint64_t in_file_id_volatile, > DATA_BLOB in_input, > uint32_t in_max_output, > uint32_t in_flags) >@@ -231,7 +233,6 @@ static struct tevent_req *smbd_smb2_ioctl_send(TALLOC_CTX *mem_ctx, > struct tevent_req *req; > struct smbd_smb2_ioctl_state *state; > struct smb_request *smbreq; >- files_struct *fsp = NULL; > struct tevent_req *subreq; > > req = tevent_req_create(mem_ctx, &state, >@@ -241,13 +242,15 @@ static struct tevent_req *smbd_smb2_ioctl_send(TALLOC_CTX *mem_ctx, > } > state->smb2req = smb2req; > state->smbreq = NULL; >- state->fsp = NULL; >+ state->fsp = fsp; > state->in_input = in_input; > state->in_max_output = in_max_output; > state->out_output = data_blob_null; > >- DEBUG(10,("smbd_smb2_ioctl: file_id[0x%016llX]\n", >- (unsigned long long)in_file_id_volatile)); >+ DEBUG(10, ("smbd_smb2_ioctl: ctl_code[0x%08x] %s fnum[%d]\n", >+ (unsigned)in_ctl_code, >+ fsp ? fsp_str_dbg(fsp) : "<no handle>", >+ fsp ? fsp->fnum : -1)); > > smbreq = smbd_smb2_fake_smb_request(smb2req); > if (tevent_req_nomem(smbreq, req)) { >@@ -255,23 +258,6 @@ static struct tevent_req *smbd_smb2_ioctl_send(TALLOC_CTX *mem_ctx, > } > state->smbreq = smbreq; > >- if (in_file_id_volatile != UINT64_MAX) { >- 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); >- } >- state->fsp = fsp; >- } >- > switch (in_ctl_code) { > case 0x00060194: /* FSCTL_DFS_GET_REFERRALS */ > { >-- >1.7.7.3 > > >From 0dd1859ccae52429717521713111240665173a2e Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Sat, 9 Jun 2012 11:11:26 +0200 >Subject: [PATCH 18/21] Revert "s3:smbd: set req->smb2req->compat_chain_fsp in > file_fsp()" > >This reverts commit c2716a7d5ccf78f9716b703c22e6cf4d4f179656. > >This is not needed anymore, as we have file_fsp_smb2() now. > >metze > >Autobuild-User(master): Stefan Metzmacher <metze@samba.org> >Autobuild-Date(master): Sun Jun 10 18:04:21 CEST 2012 on sn-devel-104 > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/smbd/files.c | 3 --- > 1 files changed, 0 insertions(+), 3 deletions(-) > >diff --git a/source3/smbd/files.c b/source3/smbd/files.c >index 9cf17ce..d222baf 100644 >--- a/source3/smbd/files.c >+++ b/source3/smbd/files.c >@@ -544,9 +544,6 @@ files_struct *file_fsp(struct smb_request *req, uint16 fid) > fsp = file_fnum(req->sconn, fid); > if (fsp != NULL) { > req->chain_fsp = fsp; >- if (req->smb2req != NULL) { >- req->smb2req->compat_chain_fsp = fsp; >- } > } > return fsp; > } >-- >1.7.7.3 > > >From 8c7e7a4c39c9cb12d8dd7af82381ea194a56bba6 Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Wed, 13 Jun 2012 12:11:51 +0200 >Subject: [PATCH 19/21] s3:smbd: try to make fsp->fh->gen_id as globally > unique as possible > >This makes sure the value is never 0, it's between 1 and UINT32_MAX. > >While fsp->fh->gen_id is 'unsigned long' currently (which might by 8 bytes), >there's some oplock code which truncates it to uint32_t (using IVAL()). > >Which means we could reuse fsp->fh->gen_id as persistent file id >until we have a final fix, which uses database. > >See bug #8995 for more details. > >Based on code from Ira Cooper. Ensure fsp->fh->gen_id starts from >a random point. We will use this as the SMB2 persistent_id. > >metze > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/smbd/files.c | 20 +++++++++++++++++++- > 1 files changed, 19 insertions(+), 1 deletions(-) > >diff --git a/source3/smbd/files.c b/source3/smbd/files.c >index d222baf..0018cee 100644 >--- a/source3/smbd/files.c >+++ b/source3/smbd/files.c >@@ -28,12 +28,26 @@ > #define FILE_HANDLE_OFFSET 0x1000 > > /**************************************************************************** >- Return a unique number identifying this fsp over the life of this pid. >+ Return a unique number identifying this fsp over the life of this pid, >+ and try to make it as globally unique as possible. >+ See bug #8995 for the details. > ****************************************************************************/ > > static unsigned long get_gen_count(struct smbd_server_connection *sconn) > { >+ /* >+ * While fsp->fh->gen_id is 'unsigned long' currently >+ * (which might by 8 bytes), >+ * there's some oplock code which truncates it to >+ * uint32_t(using IVAL()). >+ */ >+ if (sconn->file_gen_counter == 0) { >+ sconn->file_gen_counter = generate_random(); >+ } > sconn->file_gen_counter += 1; >+ if (sconn->file_gen_counter >= UINT32_MAX) { >+ sconn->file_gen_counter = 0; >+ } > if (sconn->file_gen_counter == 0) { > sconn->file_gen_counter += 1; > } >@@ -284,6 +298,10 @@ files_struct *file_find_dif(struct smbd_server_connection *sconn, > int count=0; > files_struct *fsp; > >+ if (gen_id == 0) { >+ return NULL; >+ } >+ > for (fsp=sconn->files; fsp; fsp=fsp->next,count++) { > /* We can have a fsp->fh->fd == -1 here as it could be a stat open. */ > if (file_id_equal(&fsp->file_id, &id) && >-- >1.7.7.3 > > >From 287ea28a4b51e31768f9a633c5e141da20f7fef9 Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Thu, 14 Jun 2012 10:32:43 +0200 >Subject: [PATCH 20/21] s3:smbd: add a fsp_persistent_id() function > >This calculates a 64-bit value that most likely uniquely identifies >the files_struct globally to the server. > >* 32-bit random gen_id >* 16-bit truncated open_time >* 16-bit fnum (valatile_id) > >Based on code from Ira Cooper. Use fsp->fh->gen_id as the persistent >fileid in SMB2. > >Pair-Programmed-With: Michael Adam <obnox@samba.org> > >metze > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/smbd/files.c | 24 ++++++++++++++++++++++++ > source3/smbd/proto.h | 1 + > 2 files changed, 25 insertions(+), 0 deletions(-) > >diff --git a/source3/smbd/files.c b/source3/smbd/files.c >index 0018cee..1031ccf 100644 >--- a/source3/smbd/files.c >+++ b/source3/smbd/files.c >@@ -566,6 +566,30 @@ files_struct *file_fsp(struct smb_request *req, uint16 fid) > return fsp; > } > >+uint64_t fsp_persistent_id(const struct files_struct *fsp) >+{ >+ uint64_t persistent_id; >+ >+ /* >+ * This calculates a number that is most likely >+ * globally unique. In future we will have a database >+ * to make it completely unique. >+ * >+ * 32-bit random gen_id >+ * 16-bit truncated open_time >+ * 16-bit fnum (valatile_id) >+ */ >+ persistent_id = fsp->fh->gen_id & UINT32_MAX; >+ persistent_id <<= 16; >+ persistent_id &= 0x0000FFFFFFFF0000LLU; >+ persistent_id |= fsp->open_time.tv_usec & UINT16_MAX; >+ persistent_id <<= 16; >+ persistent_id &= 0xFFFFFFFFFFFF0000LLU; >+ persistent_id |= fsp->fnum & UINT16_MAX; >+ >+ return persistent_id; >+} >+ > struct files_struct *file_fsp_smb2(struct smbd_smb2_request *smb2req, > uint64_t persistent_id, > uint64_t volatile_id) >diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h >index 929387b..d75138b 100644 >--- a/source3/smbd/proto.h >+++ b/source3/smbd/proto.h >@@ -373,6 +373,7 @@ 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); >+uint64_t fsp_persistent_id(const struct files_struct *fsp); > struct files_struct *file_fsp_smb2(struct smbd_smb2_request *smb2req, > uint64_t persistent_id, > uint64_t volatile_id); >-- >1.7.7.3 > > >From 76b958f4903e610666916250aa2d9443128d24b8 Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Wed, 13 Jun 2012 12:13:01 +0200 >Subject: [PATCH 21/21] s3:smbd: use fsp_persistent_id() as persistent_file_id > part for SMB2 (bug #8995) > >It seems to be important to have unique persistent file ids, >because windows clients seem to index files by server_guid + persistent_file_id. >Which may break, if we just have a 16-bit range per connection >and the client connects multiple times. > >Based on code from Ira Cooper. Use fsp->fh->gen_id as the persistent >fileid in SMB2. > >metze > >Autobuild-User(master): Stefan Metzmacher <metze@samba.org> >Autobuild-Date(master): Thu Jun 14 22:04:13 CEST 2012 on sn-devel-104 > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/smbd/files.c | 10 ++++++---- > source3/smbd/smb2_break.c | 3 ++- > source3/smbd/smb2_create.c | 2 +- > 3 files changed, 9 insertions(+), 6 deletions(-) > >diff --git a/source3/smbd/files.c b/source3/smbd/files.c >index 1031ccf..58c24a8 100644 >--- a/source3/smbd/files.c >+++ b/source3/smbd/files.c >@@ -595,15 +595,12 @@ struct files_struct *file_fsp_smb2(struct smbd_smb2_request *smb2req, > uint64_t volatile_id) > { > struct files_struct *fsp; >+ uint64_t fsp_persistent; > > 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; > } >@@ -612,6 +609,11 @@ struct files_struct *file_fsp_smb2(struct smbd_smb2_request *smb2req, > if (fsp == NULL) { > return NULL; > } >+ fsp_persistent = fsp_persistent_id(fsp); >+ >+ if (persistent_id != fsp_persistent) { >+ return NULL; >+ } > > if (smb2req->tcon == NULL) { > return NULL; >diff --git a/source3/smbd/smb2_break.c b/source3/smbd/smb2_break.c >index 2eb2346..4957a88 100644 >--- a/source3/smbd/smb2_break.c >+++ b/source3/smbd/smb2_break.c >@@ -237,6 +237,7 @@ void send_break_message_smb2(files_struct *fsp, int level) > SMB2_OPLOCK_LEVEL_II : > SMB2_OPLOCK_LEVEL_NONE; > NTSTATUS status; >+ uint64_t fsp_persistent = fsp_persistent_id(fsp); > > DEBUG(10,("send_break_message_smb2: sending oplock break " > "for file %s, fnum = %d, smb2 level %u\n", >@@ -245,7 +246,7 @@ void send_break_message_smb2(files_struct *fsp, int level) > (unsigned int)smb2_oplock_level )); > > status = smbd_smb2_send_oplock_break(fsp->conn->sconn, >- (uint64_t)fsp->fnum, >+ fsp_persistent, > (uint64_t)fsp->fnum, > smb2_oplock_level); > if (!NT_STATUS_IS_OK(status)) { >diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c >index a98422c..c6e3fc3 100644 >--- a/source3/smbd/smb2_create.c >+++ b/source3/smbd/smb2_create.c >@@ -827,7 +827,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx, > if (state->out_file_attributes == 0) { > state->out_file_attributes = FILE_ATTRIBUTE_NORMAL; > } >- state->out_file_id_persistent = result->fnum; >+ state->out_file_id_persistent = fsp_persistent_id(result); > state->out_file_id_volatile = result->fnum; > state->out_context_blobs = out_context_blobs; > >-- >1.7.7.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
metze
:
review+
jra
:
review?
(
ira
)
Actions:
View
Attachments on
bug 8995
:
7640
|
7641
|
7643
|
7644
| 7651