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
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;
}
if (fsp == NULL) {
return NULL;
}
+ fsp_persistent = fsp_persistent_id(fsp);
+
+ if (persistent_id != fsp_persistent) {
+ return NULL;
+ }
if (smb2req->tcon == NULL) {
return NULL;
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",
(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)) {
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;