diff options
-rw-r--r-- | source3/smbd/files.c | 34 | ||||
-rw-r--r-- | source3/smbd/proto.h | 3 |
2 files changed, 27 insertions, 10 deletions
diff --git a/source3/smbd/files.c b/source3/smbd/files.c index ef229a4098..cba79aefcf 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -582,22 +582,15 @@ 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 *file_fsp_get(struct smbd_smb2_request *smb2req, + uint64_t persistent_id, + uint64_t volatile_id) { struct smbXsrv_open *op; NTSTATUS status; NTTIME now = 0; struct files_struct *fsp; - if (smb2req->compat_chain_fsp != NULL) { - if (smb2req->compat_chain_fsp->deferred_close) { - return NULL; - } - return smb2req->compat_chain_fsp; - } - now = timeval_to_nttime(&smb2req->request_time); status = smb2srv_open_lookup(smb2req->sconn->conn, @@ -636,6 +629,27 @@ struct files_struct *file_fsp_smb2(struct smbd_smb2_request *smb2req, return NULL; } + 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) { + if (smb2req->compat_chain_fsp->deferred_close) { + return NULL; + } + return smb2req->compat_chain_fsp; + } + + fsp = file_fsp_get(smb2req, persistent_id, volatile_id); + if (fsp == NULL) { + return NULL; + } + smb2req->compat_chain_fsp = fsp; return fsp; } diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 772730203f..603114ecc9 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -387,6 +387,9 @@ void file_sync_all(connection_struct *conn); void fsp_free(files_struct *fsp); 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_get(struct smbd_smb2_request *smb2req, + uint64_t persistent_id, + uint64_t volatile_id); struct files_struct *file_fsp_smb2(struct smbd_smb2_request *smb2req, uint64_t persistent_id, uint64_t volatile_id); |