summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorDavid Disseldorp <ddiss@samba.org>2013-01-15 17:23:04 +0100
committerJeremy Allison <jra@samba.org>2013-01-16 23:15:07 +0100
commit7ca8663e313a55fd6157cf20eb02c2ac8be94a00 (patch)
treea0047d6a489974aea723093fc0c757c2e1803611 /source3/smbd
parent3619b1a7b2b5a2bfe6fdb13ecb4650ae575ab3e8 (diff)
downloadsamba-7ca8663e313a55fd6157cf20eb02c2ac8be94a00.tar.gz
samba-7ca8663e313a55fd6157cf20eb02c2ac8be94a00.tar.bz2
samba-7ca8663e313a55fd6157cf20eb02c2ac8be94a00.zip
smbd: split out file_fsp_get from file_fsp_smb2
Obtain the files_struct from smb2req, persistent_id and volatile_id. Reviewed by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/files.c34
-rw-r--r--source3/smbd/proto.h3
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);