diff options
author | Stefan Metzmacher <metze@samba.org> | 2012-06-08 10:11:57 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2012-06-09 21:23:44 +0200 |
commit | 2a804a359af5bb171afc0d04bb91e48601b8c067 (patch) | |
tree | e7eaae3122f89819a9a6df182c07a5918938d0b4 /source3/smbd | |
parent | 72564052b60c2043f520721e45705c40a2381905 (diff) | |
download | samba-2a804a359af5bb171afc0d04bb91e48601b8c067.tar.gz samba-2a804a359af5bb171afc0d04bb91e48601b8c067.tar.bz2 samba-2a804a359af5bb171afc0d04bb91e48601b8c067.zip |
s3:smbd: add file_fsp_smb2()
metze
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/files.c | 43 | ||||
-rw-r--r-- | 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 1fe5596acf..50ce1b50ca 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 d81feef073..e7bc3eb5b4 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); |